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

:root {
    /* Color Palette */
    --bg-dark: #070913;
    --bg-main: #0c0f24;
    --card-bg: rgba(18, 24, 48, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --primary-hover: #4338ca;
    --secondary: #06b6d4;
    --secondary-hover: #0891b2;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    /* Layout Tokens */
    --font-family: 'Outfit', sans-serif;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Layout Utilities */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 40px;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 14, 30, 0.95);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: var(--transition);
}

.sidebar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar for Sidebar Menu */
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    box-shadow: inset 3px 0 0 var(--secondary);
}

.sidebar-user {
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Navbar / Top Bar (For mobile & header details) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    padding: 28px;
    margin-bottom: 28px;
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Typography & Titles */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

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

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.cyan::before { background: var(--secondary); }
.stat-card.emerald::before { background: var(--success); }
.stat-card.amber::before { background: var(--warning); }
.stat-card.rose::before { background: var(--danger); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.stat-info p {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    font-size: 2rem;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

/* Forms layout & controls */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group.col-span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.col-span-2 {
        grid-column: span 1;
    }
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label.required::after {
    content: " *";
    color: var(--danger);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    padding: 12px 16px;
    background: rgba(10, 14, 30, 0.6);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23cbd5e1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
    background: rgba(10, 14, 30, 0.8);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 30px;
    border-top: 1px solid var(--card-border);
    padding-top: 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.btn-cyan {
    background-color: var(--secondary);
    color: #080c14;
    font-weight: 600;
}

.btn-cyan:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Table Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--card-border);
}

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

.table-premium th {
    background-color: rgba(10, 14, 30, 0.8);
    color: var(--text-secondary);
    padding: 16px 20px;
    font-weight: 600;
    border-bottom: 2px solid var(--card-border);
}

.table-premium td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.table-premium tbody tr {
    transition: var(--transition);
}

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

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

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

/* Alert Notifications */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out;
}

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

.alert-success {
    background-color: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.alert-close {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: var(--transition);
}

.alert-close:hover { opacity: 1; }

/* Login Page Styling */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, #fff 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* Scan / Attendance Interface */
.scanner-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
}

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

.scanner-viewport {
    background: #000;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3;
    border: 2px solid var(--card-border);
}

.scanner-laser {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    animation: scanning 2s linear infinite;
    z-index: 5;
}

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

.status-indicator-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: var(--border-radius-md);
    padding: 40px 24px;
    height: 100%;
    border: 2px solid transparent;
    transition: var(--transition);
}

.status-indicator-box.idle {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--card-border);
    color: var(--text-secondary);
}

.status-indicator-box.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.status-indicator-box.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.status-indicator-box.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.status-icon-huge {
    font-size: 5rem;
    margin-bottom: 16px;
}

/* Printable ID Card Design */
.id-card-wrapper {
    display: flex;
    justify-content: center;
    padding: 30px 0;
}

.id-card {
    width: 320px;
    height: 520px;
    background: #0d122b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: white;
}

.id-card-header {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 24px 16px;
    text-align: center;
}

.id-card-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.id-card-header p {
    font-size: 0.75rem;
    opacity: 0.9;
    letter-spacing: 0.05em;
}

.id-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #1a2245;
    border: 4px solid #0d122b;
    margin-top: -50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--secondary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.id-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    width: 100%;
    text-align: center;
}

.id-details h4 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.id-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.id-qr {
    background: white;
    padding: 10px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
}

.id-qr img {
    display: block;
    width: 100px;
    height: 100px;
}

/* Tutorials & Materials Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.resource-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
    transition: var(--transition);
}

.resource-card:hover {
    border-color: var(--secondary);
    transform: translateY(-4px);
}

.resource-meta {
    font-size: 0.75rem;
    color: var(--secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.resource-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.resource-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.resource-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
}

/* Custom Search & Filter Row */
.search-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 240px;
}

/* Mobile responsive menu button */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

@media (max-width: 992px) {
    .menu-toggle {
        display: block;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
}

/* Print Overrides */
@media print {
    .sidebar, .top-bar, .no-print, .btn, .alert {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: black !important;
    }
    .glass-panel {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .id-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
}
