:root {
    --green-primary: #2E7D52;
    --green-dark: #1B5E3A;
    --green-light: #E8F5E9;
    --beige: #F5F0E8;
    --beige-dark: #E8DFD0;
    --white: #FFFFFF;
    --text-dark: #2C3E2D;
    --text-muted: #6B7B6C;
    --red: #C62828;
    --red-light: #FFEBEE;
    --orange: #E65100;
    --orange-light: #FFF3E0;
    --blue: #1565C0;
    --blue-light: #E3F2FD;
    --shadow: 0 2px 12px rgba(46, 125, 82, 0.08);
    --shadow-lg: 0 8px 32px rgba(46, 125, 82, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --font-main: 'Inter', sans-serif;
    --font-arabic: 'Amiri', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: var(--beige);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.arabic { font-family: var(--font-arabic); direction: rtl; font-size: 1.2em; }

/* Flash Messages */
.flash {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    padding: 14px 24px; border-radius: var(--radius-sm);
    font-weight: 500; animation: slideIn 0.3s ease;
}
.flash-success { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green-primary); }
.flash-error { background: var(--red-light); color: var(--red); border: 1px solid var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Landing Page */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--beige) 0%, var(--green-light) 100%);
    padding: 2rem;
}

.landing-header { text-align: center; margin-bottom: 3rem; }
.landing-header .bismillah { font-family: var(--font-arabic); font-size: 1.5rem; color: var(--green-primary); margin-bottom: 0.5rem; }
.landing-header h1 { font-size: 2.5rem; color: var(--green-dark); font-weight: 700; margin-bottom: 0.5rem; }
.landing-header p { color: var(--text-muted); font-size: 1.1rem; }

.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 700px;
    width: 100%;
    margin-bottom: 2rem;
}

.role-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    display: block;
}
.role-card:hover {
    transform: translateY(-4px);
    border-color: var(--green-primary);
    box-shadow: var(--shadow-lg);
}
.role-card .role-icon {
    width: 72px; height: 72px;
    background: var(--green-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 2rem;
    color: var(--green-primary);
}
.role-card h2 { font-size: 1.35rem; color: var(--green-dark); margin-bottom: 0.5rem; }
.role-card p { color: var(--text-muted); font-size: 0.95rem; }

.enroll-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--green-primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}
.enroll-btn:hover { background: var(--green-dark); }

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--beige) 0%, var(--green-light) 100%);
    padding: 2rem;
}
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card h2 { text-align: center; color: var(--green-dark); margin-bottom: 0.5rem; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: 0.95rem; }
.back-link { display: inline-block; margin-bottom: 1.5rem; color: var(--green-primary); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { text-decoration: underline; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; color: var(--text-dark); font-size: 0.9rem; }
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--beige-dark);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: border-color 0.2s;
    background: var(--white);
}
.form-control:focus { outline: none; border-color: var(--green-primary); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--green-primary); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--beige-dark); color: var(--text-dark); }
.btn-secondary:hover { background: var(--beige); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1.5px solid var(--green-primary); color: var(--green-primary); }
.btn-outline:hover { background: var(--green-light); }

.error-msg { color: var(--red); font-size: 0.85rem; margin-bottom: 1rem; text-align: center; }
.success-msg { color: var(--green-primary); font-size: 0.95rem; text-align: center; padding: 1rem; background: var(--green-light); border-radius: var(--radius-sm); margin-bottom: 1rem; }

/* App Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--green-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo { display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.4rem; font-weight: 700; }
.sidebar-close { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}
.nav-item.active { border-left: 3px solid var(--white); }
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-info { margin-bottom: 0.75rem; }
.user-name { display: block; font-weight: 600; font-size: 0.9rem; }
.user-role { display: block; font-size: 0.8rem; opacity: 0.7; }
.btn-logout {
    display: block;
    text-align: center;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); }

.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }
.top-bar {
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--green-dark); }
.page-heading { font-size: 1.35rem; color: var(--green-dark); font-weight: 600; }
.content-area { padding: 2rem; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.dash-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}
.dash-card:hover { transform: translateY(-2px); }
.dash-card .card-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.dash-card .card-value { font-size: 1.5rem; font-weight: 700; color: var(--green-dark); }
.dash-card .card-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.dash-card.highlight { border-left: 4px solid var(--green-primary); }

/* Cards & Tables */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.card-title { font-size: 1.1rem; font-weight: 600; color: var(--green-dark); margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--beige-dark); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--beige-dark); font-size: 0.9rem; }
.data-table th { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.data-table tr:hover { background: var(--beige); }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-paid, .badge-present { background: var(--green-light); color: var(--green-dark); }
.badge-due, .badge-absent { background: var(--red-light); color: var(--red); }
.badge-leave { background: var(--orange-light); color: var(--orange); }
.badge-teacher-absent { background: var(--blue-light); color: var(--blue); }
.badge-covered { background: #F3E5F5; color: #7B1FA2; }
.badge-pending { background: var(--orange-light); color: var(--orange); }
.badge-default { background: var(--beige); color: var(--text-muted); }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab-btn {
    padding: 10px 20px;
    background: var(--white);
    border: 1.5px solid var(--beige-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}
.tab-btn.active, .tab-btn:hover { background: var(--green-primary); color: var(--white); border-color: var(--green-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Notes List */
.note-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--beige-dark);
}
.note-item:last-child { border-bottom: none; }
.note-type-icon {
    width: 40px; height: 40px;
    background: var(--green-light);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--green-primary);
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.note-content { flex: 1; }
.note-title { font-weight: 600; color: var(--text-dark); margin-bottom: 0.25rem; }
.note-date { font-size: 0.8rem; color: var(--text-muted); }
.note-text { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }

/* Report Card */
.report-section { margin-bottom: 1.25rem; }
.report-section h4 { font-size: 0.9rem; color: var(--green-primary); margin-bottom: 0.25rem; font-weight: 600; }
.report-section p { font-size: 0.95rem; color: var(--text-dark); }
.report-remarks { background: var(--green-light); padding: 1rem; border-radius: var(--radius-sm); margin-top: 1rem; }
.report-remarks h4 { color: var(--green-dark); }

/* Attendance Calendar */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}
.attendance-day {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.attendance-day .day-date { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--text-dark); }

/* Hadith Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 2rem;
}
.modal {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    padding: 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { color: var(--green-dark); margin-bottom: 1.5rem; font-size: 1.5rem; }
.modal .hadith-arabic { font-family: var(--font-arabic); font-size: 1.6rem; direction: rtl; color: var(--green-primary); margin-bottom: 1.25rem; line-height: 1.8; }
.modal .hadith-english { font-size: 1.05rem; color: var(--text-dark); margin-bottom: 1rem; line-height: 1.7; font-style: italic; }
.modal .hadith-source { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 2rem; }
.modal .modal-close { margin-top: 0.5rem; }

/* Book List */
.book-list { list-style: none; }
.book-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--beige-dark);
    transition: background 0.2s;
}
.book-item:hover { background: var(--beige); }
.book-item:last-child { border-bottom: none; }
.book-title { font-weight: 500; color: var(--text-dark); }
.book-type { font-size: 0.8rem; color: var(--text-muted); margin-left: 0.5rem; }

/* Profile */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}
.profile-avatar {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--green-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    color: var(--green-primary);
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info h2 { color: var(--green-dark); margin-bottom: 0.25rem; }
.profile-info p { color: var(--text-muted); }
.profile-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.detail-item label { display: block; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem; }
.detail-item span { font-size: 1rem; color: var(--text-dark); font-weight: 500; }

/* Student List */
.student-list { list-style: none; }
.student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}
.student-item:hover { transform: translateX(4px); }
.student-item a { text-decoration: none; color: inherit; flex: 1; }
.student-name { font-weight: 600; color: var(--green-dark); }

/* Filter Bar */
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { max-width: 200px; }

/* Join Class Button */
.join-class-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 16px 32px;
    background: var(--green-primary);
    color: var(--white);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.join-class-btn:hover { background: var(--green-dark); transform: translateY(-2px); }

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}
.empty-state p { font-size: 1rem; }

.public-header { display:flex; justify-content:space-between; align-items:center; padding:1rem 5%; background:var(--white); box-shadow:var(--shadow); }
.public-header nav { display:flex; gap:1rem; }.public-header nav a,.brand-logo { color:var(--green-dark); text-decoration:none; font-weight:600; }
.brand-logo span { display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:50%; background:var(--green-primary); color:#fff; margin-right:.35rem; font-size:.75rem; }
.site-footer { margin-top:2rem; padding:1rem 5%; background:var(--green-dark); color:#fff; display:flex; justify-content:space-between; gap:1rem; flex-wrap:wrap; font-size:.85rem; }.site-footer a{color:#fff;}
.testimonials { margin:3rem auto 0; max-width:1000px; }.testimonials h2{text-align:center;color:var(--green-dark);}.testimonial-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;}.testimonial-card{background:var(--white);padding:1rem;border-radius:var(--radius);box-shadow:var(--shadow);}.testimonial-card img{width:48px;height:48px;border-radius:50%;object-fit:cover;float:right;}.testimonial-card span{display:block;color:#d39e00;margin-top:.5rem;}

/* Admin Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .stat-number { font-size: 2rem; font-weight: 700; color: var(--green-primary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Action Bar */
.action-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 1.25rem; }
    .landing-header h1 { font-size: 1.75rem; }
    .role-cards { grid-template-columns: 1fr; }
    .profile-header { flex-direction: column; text-align: center; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .attendance-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

.brand-logo{
    display:flex;
    align-items:center;
    gap:12px;
    color:var(--green-dark);
    text-decoration:none;
    font-weight:600;
}

.site-logo{
    width:55px;
    height:55px;
    object-fit:contain;
}

.site-name{
    font-size:1.6rem;
    font-weight:700;
    color:var(--green-dark);
}

.enrollment-choice-page{max-width:980px;margin:3rem auto;padding:0 1rem}.enrollment-choice-intro{text-align:center;margin-bottom:2rem}.enrollment-choice-intro h1{margin:1rem 0 .5rem}.enrollment-choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.5rem}.enrollment-choice-card{background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:2rem;box-shadow:0 12px 30px rgba(15,23,42,.08);transition:transform .2s,box-shadow .2s}.enrollment-choice-card:hover{transform:translateY(-5px);box-shadow:0 18px 38px rgba(15,23,42,.14)}.choice-icon{font-size:2.5rem;margin-bottom:.75rem}.enrollment-choice-card ul{padding-left:1.25rem;min-height:5.5rem}.enrollment-choice-card li{margin:.45rem 0}.slot-options{display:grid;gap:.65rem}.slot-option{display:flex;gap:.75rem;align-items:center;border:1px solid #dbe2ea;border-radius:8px;padding:.75rem;cursor:pointer}.slot-option:hover{border-color:#2563eb;background:#f8fbff}.slot-option input{width:auto}.slot-option small{display:block;color:#64748b;margin-top:.2rem}@media(max-width:650px){.enrollment-choice-grid{grid-template-columns:1fr}.enrollment-choice-card{padding:1.5rem}}
