:root {
    --primary: #047857; /* Professional School Green */
    --primary-dark: #064e3b;
    --accent: #f59e0b;
    --danger: #ef4444;
    --light: #f8fafc;
    --dark: #1e293b;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }

body {
    margin: 0;
    background-color: var(--light);
    color: var(--dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: var(--primary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--white);
    box-shadow: var(--shadow);
}

.nav-brand { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.nav-controls { display: flex; gap: 15px; align-items: center; }

select.lang-switch {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    outline: none;
}
select.lang-switch option { color: var(--dark); }

/* Layout */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1; /* Pushes footer down */
    width: 100%;
}

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    border-top: 4px solid var(--primary);
}

h3 { margin-top: 0; color: var(--primary-dark); border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; }

/* Forms */
.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8fafc;
}

input:focus, select:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(4, 120, 87, 0.2);
    background: var(--white);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: white;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-success { background: #10b981; }
.btn-warning { background: var(--accent); color: var(--dark); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }

/* Tabs */
.tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #e2e8f0; overflow-x: auto; }
.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1rem;
    color: #64748b;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
}
.tab-btn.active {
    background: var(--primary);
    color: white;
}
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }

/* Tags/Lists */
.tag-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.tag {
    background: #e2e8f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tag-actions { display: flex; gap: 5px; }
.tag i { cursor: pointer; font-style: normal; font-weight: bold; }

/* Tables */
.table-responsive { overflow-x: auto; border-radius: 8px; border: 1px solid #e2e8f0; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { background: #f1f5f9; text-align: left; padding: 15px; font-weight: 700; color: var(--primary-dark); }
td { padding: 15px; border-top: 1px solid #e2e8f0; vertical-align: middle; }
tr:hover { background: #f8fafc; }

/* Row Selection */
tr.selected {
    background-color: #dbeafe !important;
}

tr.selected:hover {
    background-color: #bfdbfe !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* Report Card Styles */
.report-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary);
}

.report-header h1 {
    color: var(--primary-dark);
    margin: 0;
}

.report-header h3 {
    color: var(--dark);
    margin: 10px 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.report-table th {
    background: var(--primary);
    color: white;
    padding: 12px;
    text-align: left;
}

.report-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.report-table tr:nth-child(even) {
    background: #f9f9f9;
}

.signature-section {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    text-align: center;
}

.signature-line {
    border-top: 1px solid #000;
    width: 80%;
    margin: 0 auto;
    padding-top: 20px;
}

/* Footer */
.main-footer {
    background: var(--dark);
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 4px solid var(--accent);
}
.main-footer a { color: var(--white); text-decoration: none; font-weight: bold; }
.main-footer a:hover { color: var(--accent); }

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

/* RTL */
body[dir="rtl"] { text-align: right; }
body[dir="rtl"] th { text-align: right; }
/* Add to style.css */

/* OCR Specific Styles */
.ocr-instructions {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-left: 4px solid var(--primary);
}

.ocr-preview {
    animation: slideDown 0.3s ease;
}

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

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #10b981);
    transition: width 0.3s ease;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

/* Table cell highlighting */
.highlight-match {
    background-color: #dcfce7 !important;
}

.highlight-nomatch {
    background-color: #fef3c7 !important;
}

/* OCR modal */
.ocr-modal {
    max-width: 600px !important;
}

.ocr-status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 5px 0;
    background: #f8fafc;
    border-radius: 6px;
}

.ocr-status-item i.fa-check {
    color: #10b981;
}

.ocr-status-item i.fa-times {
    color: #ef4444;
}

/* Template preview */
.template-preview {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    background: white;
    margin: 15px 0;
}

.template-preview:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}
/* PDF Export Modal Styles */
#pdfExportModal .modal-content {
    max-width: 800px !important;
}

#pdfPreview {
    font-family: Arial, sans-serif;
}

#pdfPreview h2 {
    color: #047857;
    margin-bottom: 20px;
}

#pdfPreview table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
}

#pdfPreview th {
    background: #047857;
    color: white;
    padding: 10px;
    text-align: left;
}

#pdfPreview td {
    padding: 8px;
    border: 1px solid #ddd;
}

/* Assignment Cards */
.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.tag.login { 
    background: #dcfce7; 
    color: #166534; 
}

.tag.delete { 
    background: #fee2e2; 
    color: #991b1b; 
}

.tag.add { 
    background: #dbeafe; 
    color: #1e40af; 
}

.tag.edit { 
    background: #fef3c7; 
    color: #92400e; 
}

/* Button Styles */
.btn-outline {
    background: transparent;
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
}

/* Assignment Cards */
.assignment-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    transition: transform 0.2s;
}

.assignment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Status Colors */
.status-pending { color: #f59e0b; }
.status-approved { color: #10b981; }
.status-rejected { color: #ef4444; }
/* Score Picker Modal */
.score-picker-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.score-picker-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.score-btn {
    padding: 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.1s;
}

.score-btn:hover {
    background: #047857;
    color: white;
    transform: scale(1.1);
}

.score-btn.special {
    background: #fee2e2; /* Red for 0/Absent */
    color: #991b1b;
}
/* Modal Overlay */
.score-picker-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
/* Ensure it displays when JS sets style.display = 'flex' */
.page { padding: 10mm; } 
.header-container { gap: 20px; } /* Ensures logo isn't squashed */

/* ========================================== */
/* ATTENDANCE, PROMOTION & ANALYTICS STYLES  */
/* ========================================== */
.att-opened-input, .att-present-input, .att-absent-input,
.t-att-opened, .t-att-present, .t-att-absent {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 1rem;
}

.att-opened-input:focus, .att-present-input:focus, .att-absent-input:focus,
.t-att-opened:focus, .t-att-present:focus, .t-att-absent:focus {
    background: #ffffff;
    border-color: var(--primary);
    outline: none;
}

#promoteStudentList label:hover,
#attendanceTableBody tr:hover {
    background-color: #f1f5f9;
}
