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

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --success-glow: rgba(16, 185, 129, 0.2);
    
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --warning-glow: rgba(245, 158, 11, 0.2);
    
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --info: #0ea5e9;
    --info-gradient: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    
    --font-outfit: 'Outfit', sans-serif;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-inset: inset 0 2px 4px 0 rgba(255, 255, 255, 0.05);

    /* Layout Spacing variables (Desktop default - e.g. laptop view) */
    --sidebar-width: 210px;
    --sidebar-padding: 18px 12px;
    --main-padding: 20px 24px;
    --card-padding: 18px;
    --table-cell-padding: 9px 10px;
    --form-padding: 10px 14px;
    --btn-padding: 10px 20px;
    --logo-margin-bottom: 22px;
    --form-group-margin: 14px;
    --alert-padding: 12px 16px;
    --sidebar-link-padding: 9px 11px;
    --sidebar-link-gap: 9px;
    --admin-header-margin: 18px;
    --modal-padding: 22px;
    --modal-header-margin: 18px;
    --stats-grid-gap: 14px;
    --stats-grid-margin: 20px;
    --stat-card-gap: 6px;
}

html {
    font-size: 13px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-outfit);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 45%);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-premium);
    padding: var(--card-padding);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.glass-card-hover:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.15);
}

/* Typography & Badges */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

.text-muted {
    color: var(--text-secondary);
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
    border-color: rgba(14, 165, 233, 0.2);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: var(--form-group-margin);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--form-padding);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

/* Custom Buttons & Touch Optimizations for Native Feel */
button, 
a, 
input, 
select, 
textarea, 
.btn-premium, 
.btn-secondary, 
.btn-danger, 
.btn-success, 
.mobile-nav-item, 
.sidebar-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Ensure all child elements inside buttons never intercept click events */
.btn-premium *,
.btn-premium svg,
.btn-premium i {
    pointer-events: none;
}

.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--btn-padding);
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: var(--primary-gradient);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s ease, opacity 0.15s ease;
    text-decoration: none;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    opacity: 0.95;
}

.btn-premium:active {
    transform: scale(0.95) !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: transform 0.1s ease, background 0.15s ease;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}
.btn-secondary:active {
    transform: scale(0.95) !important;
}

.btn-danger {
    background: var(--danger-gradient);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s ease;
}
.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}
.btn-danger:active {
    transform: scale(0.95) !important;
}

.btn-success {
    background: var(--success-gradient);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s ease;
}
.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}
.btn-success:active {
    transform: scale(0.95) !important;
}

/* Alerts / Notifications */
.alert-box {
    padding: var(--alert-padding);
    border-radius: 12px;
    margin-bottom: var(--form-group-margin);
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.alert-box-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-box-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Layouts & Sidebar (Admin Panel) */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.9);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: var(--sidebar-padding);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #6366f1, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--logo-margin-bottom);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--sidebar-link-gap);
    padding: var(--sidebar-link-padding);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #6366f1;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.admin-main {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: var(--main-padding);
    min-width: 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--admin-header-margin);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 24px 16px;
    overflow-y: auto;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 580px;
    padding: var(--modal-padding);
    box-shadow: var(--shadow-premium);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    margin: auto;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--modal-header-margin);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Tables and Lists */
.table-container {
    overflow-x: auto;
    width: 100%;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    padding: var(--table-cell-padding);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.premium-table td {
    padding: var(--table-cell-padding);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.premium-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Cards & Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--stats-grid-gap);
    margin-bottom: var(--stats-grid-margin);
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--stat-card-gap);
}

.stat-val {
    font-size: 2.25rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Mobile Friendly Teacher view layout */
.mobile-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #0b0f19;
    position: relative;
    padding-bottom: 84px; /* Space for bottom nav */
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.mobile-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-header-user {
    display: flex;
    flex-direction: column;
}

.mobile-header-user .name {
    font-size: 1.15rem;
    font-weight: 700;
}

.mobile-header-user .role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 70px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.mobile-nav-item.active {
    color: #6366f1;
}

.mobile-nav-item:active {
    transform: scale(0.9) !important;
}

.mobile-nav-item * {
    pointer-events: none;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

/* Punch Button Animation */
.punch-btn-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0;
}

.punch-circle-btn {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    outline: none;
}

.punch-circle-btn.punch-in {
    background: var(--success-gradient);
    box-shadow: 0 0 30px var(--success-glow);
}

.punch-circle-btn.punch-out {
    background: var(--danger-gradient);
    box-shadow: 0 0 30px var(--danger-glow);
}

.punch-circle-btn::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.punch-circle-btn.punch-in::after {
    border-color: rgba(16, 185, 129, 0.3);
    animation: ripplePulse 2s infinite;
}

.punch-circle-btn.punch-out::after {
    border-color: rgba(239, 68, 68, 0.3);
    animation: ripplePulse 2s infinite;
}

.punch-circle-btn:hover {
    transform: scale(1.05);
}

.punch-circle-btn:active {
    transform: scale(0.95);
}

/* Location verification card */
.loc-verify-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    animation: pulseBorder 2s infinite;
}

.loc-verify-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.loc-verify-warning {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.loc-verify-success svg {
    color: var(--success);
    animation: spinSlow 4s linear infinite;
}

.loc-verify-warning svg {
    color: var(--danger);
    animation: shake 0.5s ease infinite alternate;
}

/* Keyframes */
@keyframes ripplePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.4; }
    100% { transform: scale(1.15); opacity: 0; }
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.08); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

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

@keyframes shake {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

/* Grid configurations */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Reports Specific highlight rows */
.report-row-absent {
    background: rgba(239, 68, 68, 0.12) !important;
    border-left: 4px solid var(--danger);
}

.report-row-absent td {
    color: #f87171 !important;
}

/* Table Action Buttons Compression override */
.premium-table .btn-premium {
    padding: 5px 8px !important;
    font-size: 0.72rem !important;
    border-radius: 7px !important;
    gap: 2px !important;
}

/* Hide icons inside table action buttons to save horizontal space */
.premium-table .btn-premium svg,
.premium-table .btn-premium i[data-feather] {
    display: none;
}

/* Compact table cell font */
.premium-table td {
    font-size: 0.82rem;
}
.premium-table th {
    font-size: 0.78rem;
}

/* Table column % widths (Scoped to Teachers management table) */
.teachers-table th:nth-child(1),
.teachers-table td:nth-child(1) { width: 15%; }
.teachers-table th:nth-child(2),
.teachers-table td:nth-child(2) { width: 10%; }
.teachers-table th:nth-child(3),
.teachers-table td:nth-child(3) { width: 7%; }
.teachers-table th:nth-child(4),
.teachers-table td:nth-child(4) { width: 7%; }
.teachers-table th:nth-child(5),
.teachers-table td:nth-child(5) { width: 10%; }
.teachers-table th:nth-child(6),
.teachers-table td:nth-child(6) { width: 9%; }
.teachers-table th:nth-child(7),
.teachers-table td:nth-child(7) { width: 10%; }
.teachers-table th:nth-child(8),
.teachers-table td:nth-child(8) { width: 8%; }
.teachers-table th:nth-child(9),
.teachers-table td:nth-child(9) { width: 6%; }
.teachers-table th:nth-child(10),
.teachers-table td:nth-child(10) { width: 18%; min-width: 0; }

/* Responsive utilities */

/* Standard laptops & scaled desktops (1025px to 1366px) */
@media (max-width: 1366px) {
    html {
        font-size: 12.5px;
    }
    :root {
        --sidebar-width: 200px;
        --sidebar-padding: 16px 10px;
        --main-padding: 18px 20px;
        --card-padding: 14px;
        --table-cell-padding: 7px 8px;
        --stats-grid-gap: 12px;
        --stats-grid-margin: 18px;
    }
}

/* Scaled 1920x1080 at 150% = 1280px CSS viewport */
@media (max-width: 1280px) {
    html {
        font-size: 12px;
    }
    :root {
        --sidebar-width: 188px;
        --sidebar-padding: 14px 10px;
        --main-padding: 16px 18px;
        --card-padding: 14px;
        --table-cell-padding: 6px 7px;
        --sidebar-link-padding: 8px 10px;
        --stats-grid-gap: 10px;
        --stats-grid-margin: 16px;
        --logo-margin-bottom: 18px;
    }
    .sidebar-logo {
        font-size: 1.3rem;
    }
}

/* Medium screen / small laptop (769px to 1024px) */
@media (max-width: 1024px) {
    html {
        font-size: 12.5px;
    }
    :root {
        --sidebar-width: 200px;
        --sidebar-padding: 14px 10px;
        --main-padding: 16px 20px;
        --card-padding: 14px;
        --table-cell-padding: 8px 8px;
        --stats-grid-gap: 10px;
        --stats-grid-margin: 16px;
    }
}

/* Mobile Friendly view rules (<= 768px) */
@media (max-width: 768px) {
    html {
        font-size: 13.5px;
    }
    :root {
        --sidebar-width: 0px; /* Hide sidebar track on mobile */
        --sidebar-padding: 20px 16px;
        --main-padding: 20px 16px;
        --card-padding: 16px;
        --table-cell-padding: 8px 10px;
        --stats-grid-gap: 12px;
        --stats-grid-margin: 20px;
    }
    
    .sidebar {
        width: 250px !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Keep text names visible inside the slide-out mobile drawer */
    .sidebar-logo span {
        display: inline !important;
    }
    .sidebar-link span {
        display: inline !important;
    }
    .sidebar-link {
        justify-content: flex-start !important;
    }
    
    /* Show mobile hamburger toggle button */
    .mobile-toggle-btn {
        display: flex !important;
    }
    
    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 9999;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Fix dropdown indentation in mobile sidebar */
    .sidebar-dropdown-menu {
        padding-left: 16px !important;
    }
}

/* Very large screens / wide monitors (>= 1600px) */
@media (min-width: 1600px) {
    html {
        font-size: 15px;
    }
    :root {
        --sidebar-width: 250px;
        --sidebar-padding: 24px;
        --main-padding: 32px 40px;
        --card-padding: 24px;
        --table-cell-padding: 12px 16px;
        --form-padding: 12px 16px;
        --btn-padding: 12px 24px;
        --logo-margin-bottom: 32px;
        --form-group-margin: 20px;
        --alert-padding: 16px;
        --sidebar-link-padding: 14px 16px;
        --sidebar-link-gap: 12px;
        --admin-header-margin: 24px;
        --modal-padding: 32px;
        --modal-header-margin: 24px;
        --stats-grid-gap: 20px;
        --stats-grid-margin: 32px;
        --stat-card-gap: 8px;
    }
}
