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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #475569;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

header .nav-btn:hover {
    background: var(--border);
    border-color: var(--text-secondary);
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Auth Card */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.auth-card h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.auth-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

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

.form-input {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

/* Dashboard Elements */
.student-welcome {
    background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
    border: 1px solid #4338ca;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.student-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.info-item {
    background: rgba(15, 23, 42, 0.4);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Class Cards Grid */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.class-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.class-card:hover {
    transform: translateY(-4px);
    border-color: var(--text-secondary);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.class-card.selected {
    border-color: var(--success);
    background: linear-gradient(180deg, #1e293b 0%, #064e3b 100%);
}

.class-card.locked {
    opacity: 0.75;
    background: #1e293b;
    border-color: #334155;
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.class-letter {
    font-size: 2rem;
    font-weight: 800;
    color: #818cf8;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-open { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-locked { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-full { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.class-details {
    margin-bottom: 1.5rem;
}

.class-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.class-detail-label {
    color: var(--text-secondary);
}

.class-detail-val {
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

.progress-bar.full {
    background-color: var(--warning);
}

.btn-select {
    width: 100%;
    padding: 0.6rem;
    border-radius: 0.5rem;
    border: none;
    background-color: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.btn-select:disabled {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
    border: 1px solid var(--border);
}

/* Alert Message Box */
.alert-box {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

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

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

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

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: #f8fafc;
}

.admin-columns {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

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

.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    color: #cbd5e1;
}

/* Excel upload dropzone */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--bg-primary);
}

.upload-dropzone:hover {
    border-color: var(--accent);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-input {
    display: none;
}

/* Student Table Styling */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

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

.student-table th, .student-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.student-table th {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
}

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

.student-table tr.displaced {
    background-color: rgba(239, 68, 68, 0.05);
}

.student-table tr.locked {
    background-color: rgba(16, 185, 129, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Tabs Styling */
.tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
