/*
 * Premium Design System - Phase 3 (Slate/Indigo)
 * Attendance & Marks Management System
 */

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

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --slate-bg-dark: #0f172a;
    --slate-card: rgba(30, 41, 59, 0.7);
    --slate-card-hover: rgba(30, 41, 59, 0.85);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --error: #ef4444;
    --sidebar-width: 280px;
    --header-height: 70px;
}

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

body {
    background: var(--slate-bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0, transparent 50%), 
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.04) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glass Basics */
.glass-container {
    background: var(--slate-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.glass-container:hover {
    background: var(--slate-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Layout Management */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    height: 100vh;
    padding: 30px 20px;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    border-radius: 0 30px 30px 0;
    overflow-y: auto;
    background: var(--slate-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

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

/* Mobile Header & Toggle */
.mobile-header {
    display: none;
    height: 60px;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1500;
}

.menu-toggle {
    background: var(--primary);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Sidebar Navigation */
.nav-link {
    padding: 14px 20px;
    border-radius: 16px;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    transform: translateX(5px);
}

.nav-link.active {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    opacity: 0.05;
    border-radius: 50%;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--text-muted));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms & Tables */
.form-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.data-table th {
    padding: 15px 20px;
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-table td {
    padding: 15px 20px;
    background: rgba(30, 41, 59, 0.4);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.data-table tr td:first-child { border-left: 1px solid var(--glass-border); border-radius: 15px 0 0 15px; }
.data-table tr td:last-child { border-right: 1px solid var(--glass-border); border-radius: 0 15px 15px 0; }

/* Responsive Media Queries */
@media (max-width: 1024px) {
    :root { --sidebar-width: 240px; }
    .content-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Table Responsive Handling */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content {
        margin-left: 0;
        margin-top: 60px;
        padding: 20px 15px;
        width: 100%;
    }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 18px !important; }
    .stat-card h2 { font-size: 1.4rem; }
    .glass-container { overflow-x: auto; }

    /* Two-panel admin layouts → stack on mobile */
    .content-grid {
        grid-template-columns: 1fr !important;
    }

    /* Form grids inside register/marks → stack on mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Auth pages mobile tweaks */
    .setup-card {
        padding: 25px 20px !important;
        max-width: 100% !important;
        border-radius: 16px !important;
    }

    .setup-title {
        font-size: 1.4rem;
    }

    .setup-subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
    }

    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .setup-wrapper {
        padding: 15px 10px;
        align-items: flex-start;
        padding-top: 30px;
    }

    .setup-card {
        padding: 20px 16px !important;
    }

    .setup-title {
        font-size: 1.25rem;
    }

    .main-content {
        padding: 15px 10px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Setup & Login Pages */
.setup-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    width: 100%;
}

.setup-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    margin: 0 auto;
}

.setup-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.setup-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* Reusable Layout Classes */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Select dropdown arrow */
select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group {
    margin-bottom: 20px;
}

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

.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

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

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

.animate-fade {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.btn {
    border-radius: 14px;
    padding: 12px 25px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Table Card Wrapper */
.table-card {
    padding: 20px;
    margin-top: 20px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
