/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2c3e50;
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --success: #27ae60;
    --success-dark: #219653;
    --warning: #f39c12;
    --purple: #9b59b6;
    --purple-dark: #8e44ad;
    --gray: #95a5a6;
    --gray-dark: #7f8c8d;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --border: #e0e0e0;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --radius: 10px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-dark);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 10px 25px;
}

.btn-logout:hover {
    background: var(--danger-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.3);
}

.btn-download {
    background: var(--success);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-download:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
}

.btn-save-dates {
    background: var(--purple);
    color: white;
    padding: 10px 25px;
    height: 42px;
}

.btn-save-dates:hover {
    background: var(--purple-dark);
    transform: translateY(-2px);
}

/* ===== LOGIN/REGISTER PAGES ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-container h1 {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 30px;
    font-size: 2.2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form input {
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-dark);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.date-controls {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.date-form {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.date-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.date-group label {
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.date-form input[type="date"] {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

/* ===== STUDENTS TABLE ===== */
.students-table {
    width: 100%;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border-collapse: collapse;
}

.students-table thead {
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    color: white;
}

.students-table th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.students-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.students-table tbody tr:hover {
    background-color: var(--light);
    transform: scale(1.005);
}

.students-table td {
    padding: 16px 15px;
    font-size: 0.95rem;
}

.students-table td:first-child {
    font-weight: 500;
    color: var(--secondary);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--secondary);
    margin-bottom: 25px;
    font-size: 1.8rem;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

/* ===== FORM STYLES ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.categories label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: var(--transition);
}

.categories label:hover {
    background: #e9ecef;
}

.categories input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Validation styles */
input.valid {
    border-color: var(--success) !important;
    background: #f0fff4 !important;
}

input.invalid {
    border-color: var(--danger) !important;
    background: #fff5f5 !important;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

/* ===== MESSAGES ===== */
.error-message {
    background: #ffeaea;
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    margin-top: 10px;
}

.success-message {
    background: #eaffea;
    color: var(--success);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    margin-top: 10px;
}

.warning-message {
    background: #fff5e6;
    color: var(--warning);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    margin-top: 10px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .date-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-group {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .students-table {
        font-size: 0.9rem;
        display: block;
        overflow-x: auto;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 2vh auto;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* ===== CATEGORY COLORS ===== */
.category-AI { color: var(--primary); }
.category-AII { color: var(--purple); }
.category-B { color: var(--success); }
.category-C { color: var(--warning); }
.category-D { color: var(--danger); }
.category-E { color: #1abc9c; }
.category-F { color: #d35400; }

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.full-width { width: 100%; }
.hidden { display: none; }