@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f6fbf7;
    --bg-secondary: #effaf3;
    --accent-cyan: #16a34a;
    --accent-purple: #15803d;
    --text-primary: #4b5563;
    --text-light: #1f2937;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.22);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.22);
    --glass-bg: rgba(255, 255, 255, 0.73);
    --glass-border: rgba(22, 163, 74, 0.18);
    --glass-shadow: rgba(22, 101, 52, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 25%),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.16), transparent 20%),
        linear-gradient(135deg, #f8fff9 0%, #eefbf3 45%, #e0f7e8 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* APP SHELL */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar {
    width: 280px;
    min-height: 100vh;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 249, 245, 0.95));
    backdrop-filter: blur(14px);
    border-right: 1px solid rgba(22, 163, 74, 0.12);
    padding: 1.2rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 120;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: #166534;
    text-decoration: none;
    background: linear-gradient(135deg, #166534, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid rgba(22, 163, 74, 0.18);
    background: #ffffff;
    padding: 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    list-style: none;
    margin-top: 1.5rem;
    flex: 1;
}

.nav-link {
    color: #4b5563;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.nav-link:hover, .nav-link.active {
    color: #166534;
    background: #ecfdf3;
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.08);
}

.sidebar-user {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(22, 163, 74, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.sidebar-user-info {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.4;
}

.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.75);
    border-bottom: 1px solid rgba(22, 163, 74, 0.12);
    backdrop-filter: blur(10px);
}

.topbar-title {
    font-weight: 700;
    color: #166534;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.login-logo img {
    width: 96px;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(22, 163, 74, 0.15);
    background: #ffffff;
    padding: 8px;
}

.nav-toggle {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1.45rem;
    cursor: pointer;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-backdrop {
    display: none;
}

/* MAIN CONTENT CONTAINER */
.container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* GLASS CARD */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 10px 28px 0 var(--glass-shadow);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 14px 36px 0 rgba(22, 163, 74, 0.12);
}

.card-title {
    color: #166534;
    font-weight: 700;
    font-size: 1.45rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(22, 163, 74, 0.12);
    padding-bottom: 0.8rem;
}

/* FORMS */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background: #f9fffb;
    border: 1px solid #d1fae5;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: #1f2937;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #22c55e;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

select.form-control option {
    background: #ffffff;
    color: #1f2937;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.18);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(22, 163, 74, 0.25);
    filter: brightness(1.04);
}

.btn-secondary {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.btn-secondary:hover {
    background: #dcfce7;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(45deg, #ff0055, #9b003a);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(255, 0, 85, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 85, 0.35);
    filter: brightness(1.1);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* TABLES */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

@media (max-width: 900px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 110;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        display: flex;
    }

    .container {
        padding: 1.25rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .sidebar-brand span {
        font-size: 0.95rem;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    text-align: left;
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-light);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2.5px solid rgba(0, 242, 254, 0.3);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
    vertical-align: middle;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.015);
    color: var(--text-light);
}

/* STATS ROW */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-light);
    margin: 0.5rem 0;
    background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ALERTS */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ec471;
}

.alert-danger {
    background: rgba(255, 0, 85, 0.15);
    border: 1px solid rgba(255, 0, 85, 0.3);
    color: #ff3b6f;
}

.alert-info {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--accent-cyan);
}

/* WEBCAM PREVIEW Presensi / Register */
.webcam-container {
    position: relative;
    max-width: 640px;
    margin: 0 auto 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
}

.webcam-feed {
    width: 100%;
    display: block;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border: 1px solid rgba(0, 242, 254, 0.3);
    z-index: 10;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--accent-cyan), transparent);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: scan 2.5s linear infinite;
}

@keyframes scan {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* AVATAR UPLOAD PREVIEW */
.avatar-preview-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    overflow: hidden;
    margin-bottom: 1rem;
}

.avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(46, 204, 113, 0.2);
    color: #2ec471;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.badge-info {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-danger {
    background: rgba(255, 0, 85, 0.2);
    color: #ff3b6f;
    border: 1px solid rgba(255, 0, 85, 0.4);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
}

.summary-card-hadir {
    border-color: rgba(46, 204, 113, 0.35);
}

.summary-card-sakit {
    border-color: rgba(255, 193, 7, 0.35);
}

.summary-card-izin {
    border-color: rgba(22, 163, 74, 0.35);
}

.summary-card-alpa {
    border-color: rgba(255, 0, 85, 0.35);
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.summary-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-light);
}

.summary-card small {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* RECENT TOAST/FEEDBACK PRESENSI */
.attendance-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .attendance-grid {
        grid-template-columns: 1fr;
    }
}

.toast-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.attendance-toast {
    background: rgba(0, 242, 254, 0.08);
    border: 1.5px solid var(--accent-cyan);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.4s ease forwards;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    object-fit: cover;
}

.toast-info {
    flex: 1;
}

.toast-info h4 {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.toast-info p {
    font-size: 0.8rem;
}

.toast-icon {
    font-size: 1.5rem;
    color: var(--accent-cyan);
}

/* FOOTER */
footer {
    background: rgba(10, 11, 16, 0.9);
    border-top: 1px solid var(--glass-border);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: auto;
}

/* RESPONSIVE MOBILE */
@media (max-width: 900px) {
    body {
        font-size: 0.95rem;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 1rem 1.25rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
        gap: 0.5rem;
    }

    .navbar-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.65rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .navbar-nav.active {
        max-height: 400px;
    }

    .nav-link {
        font-size: 0.92rem;
        padding: 0.45rem 0.75rem;
    }

    .nav-user {
        width: 100%;
        justify-content: flex-end;
        border-left: none;
        padding-left: 0;
        margin-top: 0.5rem;
    }

    .navbar-logo {
        width: 34px;
        height: 34px;
    }

    .container {
        padding: 1.25rem;
    }

    .glass-card {
        padding: 1.5rem;
    }

    .card-title {
        font-size: 1.3rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .form-label {
        font-size: 0.82rem;
    }

    .form-control {
        font-size: 0.92rem;
    }

    .btn {
        width: 100%;
        font-size: 0.92rem;
    }

    .alert {
        font-size: 0.88rem;
    }

    .table th,
    .table td {
        padding: 0.9rem 0.8rem;
        font-size: 0.87rem;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-value {
        font-size: 1.85rem;
    }

    .attendance-toast {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .toast-avatar {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 0.92rem;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-brand {
        font-size: 1.05rem;
    }

    .navbar-nav {
        gap: 0.45rem;
        justify-content: center;
    }

    .nav-link {
        font-size: 0.86rem;
        padding: 0.4rem 0.7rem;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .form-group {
        width: 100%;
    }

    .glass-card {
        padding: 1.25rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .form-label {
        font-size: 0.78rem;
    }

    .form-control {
        font-size: 0.88rem;
    }

    .btn {
        font-size: 0.88rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.6rem;
        font-size: 0.82rem;
    }

    .avatar-preview-container {
        width: 100px;
        height: 100px;
        margin: 0 auto 1rem;
    }

    .badge {
        font-size: 0.72rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    footer {
        padding: 1rem;
        font-size: 0.82rem;
    }
}
