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

/* ===========================
   DESIGN TOKENS
=========================== */
:root {
    /* === Palette === */
    --bg: hsl(220, 30%, 97%);
    --bg-card: hsl(0, 0%, 100%);
    --bg-card-hover: hsl(220, 25%, 96%);
    --border: hsl(220, 20%, 92%);
    --border-bright: hsl(220, 20%, 80%);

    /* === Brand Blue === */
    --primary: hsl(214, 90%, 52%);
    --primary-glow: hsla(214, 90%, 52%, 0.12);
    --primary-dark: hsl(214, 90%, 44%);

    /* === Semantic Colors === */
    --success: hsl(152, 60%, 40%);
    --success-glow: hsla(152, 60%, 40%, 0.12);
    --warning: hsl(38, 90%, 50%);
    --warning-glow: hsla(38, 90%, 50%, 0.12);
    --danger: hsl(0, 72%, 56%);
    --danger-glow: hsla(0, 72%, 56%, 0.10);
    --pause: hsl(270, 55%, 58%);
    --pause-glow: hsla(270, 55%, 58%, 0.10);
    --secondary: hsl(255, 65%, 55%);
    --secondary-glow: hsla(255, 65%, 55%, 0.12);

    /* === Text === */
    --text: hsl(222, 25%, 14%);
    --text-muted: hsl(220, 12%, 46%);
    --text-faint: hsl(220, 10%, 62%);

    /* === Layout === */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --sidebar-w: 248px;
    --shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 32px rgba(15, 23, 42, 0.09);
}

/* ===========================
   RESET & BASE
=========================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===========================
   ALERTS
=========================== */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: hsla(0, 72%, 56%, 0.22);
}

.alert-success {
    background: var(--success-glow);
    color: var(--success);
    border-color: hsla(152, 65%, 42%, 0.22);
}

/* ===========================
   CARDS
=========================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===========================
   LOGIN PAGE
=========================== */
/* ===========================
   LOGIN PAGE (SPLIT DESIGN)
=========================== */
.login-split-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--bg-card);
}

/* --- Left Side: Branding --- */
.login-branding {
    flex: 1.2;
    position: relative;
    background: url('../asset/the-jopwell-collection-ok-NPMRCcHg-unsplash.jpg') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: white;
}

.login-branding::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, hsla(255, 65%, 45%, 0.9), hsla(214, 90%, 40%, 0.85));
    z-index: 1;
}

.branding-content {
    position: relative;
    z-index: 2;
    max-width: 500px;
}

.branding-logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.branding-logo span {
    color: hsla(210, 100%, 80%, 1);
}

.branding-content h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.branding-content p {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 3rem;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.feature-number {
    width: 28px;
    height: 28px;
    background: hsla(0, 0%, 100%, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.feature-text span {
    font-size: 0.85rem;
    opacity: 0.75;
}

/* --- Right Side: Form --- */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.login-header {
    margin-bottom: 2.5rem;
    text-align: left;
}

.login-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 1024px) {
    .login-branding {
        display: none;
    }

    .login-form-side {
        background: var(--bg-card);
    }
}

.form-group {
    margin-bottom: 1.2rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: hsl(210, 30%, 99%);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    background: white;
    font-family: inherit;
}

.form-control-sm:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger-glow);
}

/* ===========================
   WELCOME SECTION (PAGE HEADER)
=========================== */
.welcome-section {
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.welcome-section h1 {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--text);
}

.welcome-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.gps-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.2rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

.dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-faint);
    transition: background 0.3s;
}

.dot.active {
    background: var(--success);
    animation: pulse 2s infinite;
}

.dot.error {
    background: var(--danger);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--success-glow);
    }

    70% {
        box-shadow: 0 0 0 8px transparent;
    }

    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

/* 4-button grid */
.clock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-clock {
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    cursor: pointer;
    padding: 1.8rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn-clock::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: brightness(1.06);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-clock:not(:disabled):hover {
    transform: translateY(-4px);
}

.btn-clock:not(:disabled):hover::before {
    opacity: 0.08;
}

.btn-clock:active {
    transform: translateY(0);
}

.btn-clock i {
    font-size: 2rem;
    opacity: 0.9;
}

.btn-clock .label {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.btn-clock .sub {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 400;
}

.btn-in {
    background: linear-gradient(135deg, hsl(152, 60%, 40%), hsl(152, 65%, 46%));
    box-shadow: 0 6px 24px var(--success-glow);
}

.btn-out {
    background: linear-gradient(135deg, hsl(0, 68%, 50%), hsl(0, 72%, 58%));
    box-shadow: 0 6px 24px var(--danger-glow);
}

.btn-pause {
    background: linear-gradient(135deg, hsl(270, 50%, 52%), hsl(270, 58%, 60%));
    box-shadow: 0 6px 24px var(--pause-glow);
}

.btn-resume {
    background: linear-gradient(135deg, hsl(38, 85%, 48%), hsl(38, 92%, 54%));
    box-shadow: 0 6px 24px var(--warning-glow);
}

.btn-clock:disabled {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-clock:disabled i,
.btn-clock:disabled .label {
    color: var(--text-faint) !important;
}

/* ===========================
   TABLES
=========================== */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: hsla(210, 30%, 96%, 0.95);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge-late {
    background: var(--danger-glow);
    color: var(--danger);
    border: 1px solid hsla(0, 72%, 56%, 0.22);
}

.badge-ok {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid hsla(152, 65%, 42%, 0.22);
}

.badge-pause {
    background: var(--pause-glow);
    color: var(--pause);
    border: 1px solid hsla(270, 55%, 58%, 0.22);
}

.badge-absent {
    background: hsl(220, 18%, 93%);
    color: var(--text-muted);
}

/* ===========================
   ADMIN STATS GRID (BENTO STYLE)
=========================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}


.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--warning);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.02em;
    display: block;
}

.stat-value.danger {
    color: var(--danger);
}

.stat-value.warning {
    color: var(--warning);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    background: var(--primary-glow);
    color: var(--primary);
}

/* ===========================
   FORM ROW (Admin add user)
=========================== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* ===========================
   EXPORT BUTTON
=========================== */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

/* ===========================
   FOOTER
=========================== */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-faint);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ===========================
   RESPONSIVE (Mobile clocks & grid tweaks)
=========================== */
@media (max-width: 600px) {
    .clock-grid {
        gap: 0.75rem;
    }

    .btn-clock {
        padding: 1.4rem 0.5rem;
    }

    .btn-clock i {
        font-size: 1.6rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   UTILITIES & ANIMATIONS
=========================== */
.btn-loading {
    position: relative !important;
    color: transparent !important;
    pointer-events: none !important;
}

.btn-loading i {
    opacity: 0 !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   ALERTS (FLASH MESSAGES)
=========================== */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out forwards;
}

.alert i {
    font-size: 1.2rem;
}

.alert-success {
    background: var(--primary-glow);
    color: var(--primary);
}

.alert-danger {
    background: var(--danger-glow);
    color: var(--danger);
}

.alert-warning {
    background: #fef3c7;
    /* yellow glow */
    color: #d97706;
    /* amber */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   DASHBOARD LAYOUT (SIDEBAR)
=========================== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: var(--primary);
    flex-shrink: 0;
}

.sidebar-header .logo {
    color: #fff !important;
}

.sidebar-header .logo span {
    color: #fff !important;
    opacity: 0.9;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.875rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    padding: 1rem 0.5rem 0.4rem;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.18s;
    position: relative;
}

.nav-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-glow);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

.nav-item.danger {
    color: var(--danger);
}

.nav-item.danger:hover {
    background: var(--danger-glow);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2rem 2rem 4rem 2rem;
    min-width: 0;
}

/* Mobile Topbar (Visible only on mobile for dashboard) */
.mobile-topbar {
    display: none;
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: var(--shadow);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    z-index: 998;
}

/* ===========================
   RESPONSIVE LAYOUT
=========================== */
@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-top: 84px;
    }

    .mobile-topbar {
        display: flex;
    }

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

.fa-info-circle:hover {
    cursor: pointer;
}