/* ===== UNIVERSAL STYLES ===== */
:root {
    --primary-color: #4299e1;
    --primary-dark: #3182ce;
    --primary-light: #90cdf4;
    --secondary-color: #48bb78;
    --secondary-dark: #38a169;
    --danger-color: #e53e3e;
    --warning-color: #ed8936;
    --dark-color: #2d3748;
    --light-color: #f7fafc;
    --border-color: #e2e8f0;
    --text-color: #4a5568;
    --text-light: #718096;
    --success-color: #48bb78;
    --error-color: #e53e3e;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 25px 30px;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 32px;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.school-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.school-tagline {
    font-size: 14px;
    opacity: 0.9;
}

/* ===== NAVIGATION ===== */
.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.15);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    text-decoration: none;
}

.nav-link.active {
    background: white;
    color: var(--primary-color);
}

/* ===== CONTENT AREA ===== */
.content-wrapper {
    background: white;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.content {
    padding: 30px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.content-header h1 {
    color: var(--dark-color);
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 25px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    color: var(--dark-color);
    font-size: 20px;
    margin: 0;
}

.card-header .icon {
    font-size: 24px;
    color: var(--primary-color);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group label.required::after {
    content: " *";
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #edf2f7;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c53030 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(229, 62, 62, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.table th {
    background: var(--light-color);
    color: var(--dark-color);
    font-weight: 600;
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(66, 153, 225, 0.05);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== MESSAGES ===== */
.message {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.message i {
    font-size: 18px;
}

.message-success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.message-error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.message-warning {
    background: #feebc8;
    color: #744210;
    border: 1px solid #fbd38d;
}

.message-info {
    background: #bee3f8;
    color: #2c5282;
    border: 1px solid #90cdf4;
}

/* ===== LOADING STATES ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.loading-overlay.active {
    display: flex;
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.ml-1 { margin-left: 10px; }
.mr-1 { margin-right: 10px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }
.gap-3 { gap: 30px; }
.hidden { display: none; }

/* ===== LOGO UPLOAD ===== */
.logo-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.logo-preview {
    width: 150px;
    height: 150px;
    border: 3px dashed var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--light-color);
    transition: var(--transition);
}

.logo-preview:hover {
    border-color: var(--primary-color);
    background: #edf2f7;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.logo-preview.no-logo::before {
    content: "🖼️";
    font-size: 40px;
    opacity: 0.5;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .content {
        padding: 20px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .content-header h1 {
        font-size: 24px;
    }
}


/* Loading overlay styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Logout button style */
.nav-link.logout {
    color: var(--danger-color) !important;
    background: rgba(229, 62, 62, 0.1) !important;
}

.nav-link.logout:hover {
    background: rgba(229, 62, 62, 0.2) !important;
}


/* ===== ENHANCED MARKS ENTRY STYLES ===== */

/* Active cell highlighting */
.active-cell {
    background-color: #ebf8ff !important;
    box-shadow: inset 0 0 0 2px var(--primary-color) !important;
    z-index: 20;
    position: relative;
}

/* Quick actions toolbar */
.quick-actions-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.action-group {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 5px 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.action-group label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.quick-fill-btn {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 40px;
}

/* Attendance control panel */
.attendance-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 15px;
    background: #fffaf0;
    border-radius: 6px;
    border: 1px solid #fbd38d;
}

.attendance-control input {
    width: 60px;
    padding: 6px;
    text-align: center;
}

/* Navigation hints */
.nav-hint {
    font-size: 12px;
    color: var(--text-light);
    padding: 8px 15px;
    background: #e6fffa;
    border-radius: var(--radius);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-hint kbd {
    background: var(--dark-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

/* Mark input validation states */
.mark-input.invalid {
    border-color: var(--danger-color);
    background: #fed7d7;
}

.mark-input.warning {
    border-color: var(--warning-color);
    background: #feebc8;
}

.mark-input.valid {
    border-color: var(--success-color);
    background: #c6f6d5;
}

/* Copy button */
.copy-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    opacity: 0.5;
    transition: opacity 0.2s;
    background: var(--light-color);
    border: 1px solid var(--border-color);
}

.copy-btn:hover {
    opacity: 1;
    background: var(--primary-light);
}
/* Container to center or align buttons */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 0;
}

/* The Button Base */
.marksheet-links {
    background-color: #1e293b; /* Professional Slate Blue */
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0; 
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* Keeps the link shape inside the button */
}

/* The Link (The Clickable Area) */
.marksheet-links a {
    display: block;
    padding: 10px 20px;
    color: #f8fafc;
    text-decoration: none;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Hover State */
.marksheet-links:hover {
    background-color: #334155;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* Icon Spacing */
.marksheet-links a span {
    margin-right: 8px;
}

/* Secondary Button Style (Optional - for "Edit Info") */
.marksheet-links:last-child {
    background-color: #ffffff;
    border: 2px solid #1e293b;
}

.marksheet-links:last-child a {
    color: #1e293b;
}

.marksheet-links:last-child:hover {
    background-color: #f1f5f9;
}
/* Responsive adjustments for quick actions */
@media (max-width: 768px) {
    .quick-actions-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-group, .attendance-control {
        width: 100%;
        justify-content: space-between;
    }
    
    .action-group label, .attendance-control label {
        min-width: 120px;
    }
}


/* Excel Import Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: var(--dark-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Excel Actions Toolbar */
.excel-actions-toolbar {
    background: #f0f9ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}