/* الأنماط الرئيسية للموقع */
:root {
    --primary-color: #4b359b;
    --primary-dark: #362874;
    --primary-light: #5a4ab0;
    --accent-color: #f4b41a;
    --accent-hover: #d99c11;
    --btn-orange: #e67e22;
    --btn-orange-hover: #d35400;
    --bg-color: #f0f2f5;
    --top-bar-bg: #221b52;
    --text-color: #1e293b;
    --border-color: #cbd5e1;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}
body, input, select, textarea, button { font-family: 'Tajawal', sans-serif !important; }
body { background-color: var(--bg-color); color: var(--text-color); margin: 0; padding: 15px; font-size: 0.95em; line-height: 1.5; }
#login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(34, 27, 82, 0.85); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.login-box { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); width: 350px; text-align: center; border-top: 6px solid var(--primary-color); }
.login-box h2 { margin-top: 0; color: var(--primary-color); font-weight: 800; }
.login-box input { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid var(--border-color); border-radius: 6px; box-sizing: border-box; font-weight: bold; text-align: center; }
.login-note { font-size: 0.75em; color: #94a3b8; margin-top: 15px; line-height: 1.4; }
#app-content { display: none; }
.bar-top-header { background-color: var(--top-bar-bg) !important; border: none !important; border-radius: 12px; padding: 20px; margin-bottom: 15px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; }
.brand-section { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
.brand-info h1 { margin: 0; color: #fff; font-size: 1.5em; font-weight: 800; line-height: 1.2; display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-info h1::before { content: '📚'; background: var(--accent-color); border-radius: 8px; padding: 6px; font-size: 0.9em; }
.brand-info p { margin: 5px 0 0 0; color: var(--accent-color); font-size: 0.9em; font-weight: 700; }
.nav-buttons-section { width: 100%; max-width: 1300px; margin: 0 auto; display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 6px; }
.btn-blue { background-color: var(--primary-color); color: #ffffff; border: 2px solid transparent; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.85em; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 5px; text-decoration: none; white-space: nowrap; }
.btn-blue:hover { background-color: var(--primary-dark); }
.btn-blue.active { background-color: var(--btn-orange) !important; color: #fff !important; border-color: var(--btn-orange) !important; font-weight: 800 !important; box-shadow: 0 4px 10px rgba(230, 126, 34, 0.4); }
#btn-settings { background-color: var(--accent-color); color: #221b52; font-weight: 800; }
#btn-settings:hover { background-color: var(--accent-hover); }
#btn-logout { background-color: var(--danger-color); color: #fff; font-weight: 800; }
#btn-logout:hover { background-color: #b91c1c; }
.section-bar { background: #fff; padding: 15px 18px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; border: 1px solid var(--border-color); }
.classes-card-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; width: 100%; }
.class-card-item { background-color: #fff; color: var(--primary-color); padding: 12px; border-radius: 8px; border: 2px solid var(--border-color); text-align: center; cursor: pointer; transition: 0.2s; font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.class-card-item:hover { border-color: var(--primary-color); background-color: #f8fafc; }
.class-card-item.active { background-color: var(--primary-color) !important; color: #fff !important; border-color: var(--accent-color) !important; border-width: 3px; font-weight: 800 !important; box-shadow: 0 4px 12px rgba(75, 53, 155, 0.3); }
.stat-badge { padding: 8px 12px; border-radius: 6px; font-size: 0.85em; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; transition: all 0.2s ease; border: 2px solid transparent; }
.stat-badge:hover { opacity: 0.8; transform: translateY(-2px); }
.stat-badge.cash { color: #0284c7; background: #e0f2fe; }
.stat-badge.womd { color: #7c3aed; background: #ede9fe; }
.stat-badge.unpaid { color: #ef4444; background: #fee2e2; }
.stat-badge.active-filter { border-color: currentColor; box-shadow: 0 0 0 2px #fff inset, 0 4px 10px rgba(0,0,0,0.1); transform: scale(1.05); }
.btn-action-warning { background-color: var(--btn-orange); color: white; border: none; padding: 8px 14px; border-radius: 6px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-action-warning:hover { background-color: var(--btn-orange-hover); }
.btn-action-print { background-color: var(--primary-color); color: white; border: none; padding: 8px 14px; border-radius: 6px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-action-print:hover { background-color: var(--primary-dark); }
.btn-action-print:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-action-print.btn-undo { background-color: #64748b; }
.btn-edit { background-color: var(--accent-color); color: #000; padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9em; font-weight: bold; }
.btn-del { background-color: var(--danger-color); color: white; padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9em; }
.cards-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-bottom: 20px; }
.list-view { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.list-view .student-card { flex-direction: row; align-items: center; padding: 10px; }
.list-view .student-card-header { border-bottom: none; border-left: 2px solid var(--border-color); padding: 0 15px 0 0; min-width: 150px; text-align: right; font-size: 1.1em; background: transparent; }
.list-view .student-card-body { display: flex; flex-direction: row; flex-wrap: wrap; gap: 15px; flex-grow: 1; padding: 0; }
.list-view .card-field { width: auto; margin: 0; gap: 5px; }
.list-view .card-field input, .list-view .card-field select { width: 110px; }
.list-view .student-card-actions { background: transparent; border-top: none; padding: 0; width: auto; }
.student-card { background: #fff; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: hidden; display: flex; flex-direction: column; }
.student-card.paid-row { border-right: 5px solid var(--success-color); }
.student-card:not(.paid-row) { border-right: 5px solid var(--danger-color); }
.student-card-header { padding: 12px; text-align: center; font-weight: 800; font-size: 1.2em; color: var(--primary-color); background: #f8fafc; border-bottom: 1px solid var(--border-color); }
.student-card-body { padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.card-field { display: flex; align-items: center; justify-content: space-between; }
.card-field label { font-weight: 700; color: #475569; font-size: 0.9em; }
.card-field input, .card-field select { width: 65%; padding: 6px; border: 1px solid var(--border-color); border-radius: 4px; font-weight: 700; }
.student-card-actions { padding: 10px; background: #f8fafc; border-top: 1px solid var(--border-color); display: flex; justify-content: center; gap: 10px; }
.page-view { display: none; }
.page-view.active { display: block; }
.inner-tabs { display: flex; gap: 5px; flex-wrap: wrap; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; }
.inner-tabs .btn-blue { flex: 1; min-width: 120px; padding: 10px 5px; font-size: 0.9em; }
.admin-charts { display: flex; justify-content: space-around; align-items: flex-end; height: 150px; background: #f8fafc; padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); }
.admin-chart-item { display: flex; flex-direction: column; align-items: center; width: 25%; height: 100%; justify-content: flex-end; }
.chart-label { font-weight: 800; margin-bottom: 5px; font-size: 0.9em; }
.chart-bar-container { width: 40px; height: 100px; background: #e2e8f0; border-radius: 4px 4px 0 0; position: relative; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; border-radius: 4px 4px 0 0; transition: height 0.5s ease; }
.chart-bar.cash-bar { background: #0284c7; }
.chart-bar.womd-bar { background: #7c3aed; }
.chart-bar.unpaid-bar { background: #ef4444; }
.chart-value { font-weight: 800; margin-top: 5px; color: #1e293b; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.summary-block { background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); border-top: 4px solid var(--primary-color); }
.summary-block h3 { margin: 0 0 8px 0; font-size: 1em; text-align: center; color: var(--primary-color); font-weight: 800; }
.calc-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 0.88em; font-weight: 700; }
.phone-card-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.phone-card-item { background: #fff; border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.phone-card-item .name-row { font-weight: 800; color: var(--primary-color); font-size: 1.1em; border-bottom: 1px dashed #cbd5e1; padding-bottom: 5px; }
.phone-card-item .inputs-row { display: flex; gap: 10px; flex-wrap: wrap; }
.phone-card-item .input-group { display: flex; align-items: center; gap: 5px; flex-grow: 1; min-width: 140px; }
.phone-card-item .input-group input { flex-grow: 1; padding: 6px; border: 1px solid #cbd5e1; border-radius: 4px; font-weight: 700; text-align: center; }
@media (min-width: 901px) { .phone-card-list .phone-card-item .input-group { min-width: 0; flex-basis: 100%; } }
.custom-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(34, 27, 82, 0.75); z-index: 1500; justify-content: center; align-items: center; }
.custom-modal-content { background: #fff; width: 90%; max-width: 600px; border-radius: 12px; padding: 22px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); border-top: 6px solid var(--primary-color); display: flex; flex-direction: column; }
.custom-modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border-color); padding-bottom: 8px; margin-bottom: 15px; }
#dialog-modal { z-index: 2500; }
.dialog-box { background: #fff; border-radius: 12px; padding: 22px; width: 90%; max-width: 420px; box-shadow: 0 15px 40px rgba(0,0,0,0.25); border-top: 6px solid var(--primary-color); }
.dialog-box h3 { margin: 0 0 12px 0; color: var(--primary-color); font-weight: 800; }
.dialog-box p { margin: 0 0 15px 0; font-weight: 700; color: #334155; line-height: 1.5; white-space: pre-line; }
.dialog-box input, .dialog-box textarea { width: 100%; padding: 9px; border: 1px solid var(--border-color); border-radius: 6px; box-sizing: border-box; font-weight: 700; margin-bottom: 10px; }
.dialog-box .btn-row { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.btn-danger { background-color: var(--danger-color); border-color: var(--danger-color); }
.btn-cancel { background-color: #64748b; border-color: #64748b; }
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--top-bar-bg); color: #fff; padding: 10px 20px; border-radius: 8px; font-weight: 700; font-size: 0.9em; box-shadow: 0 6px 20px rgba(0,0,0,0.25); opacity: 0; transform: translateY(-10px); transition: all 0.3s ease; border-right: 5px solid var(--accent-color); min-width: 180px; text-align: center; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-right-color: var(--danger-color); }
.toast.warn { border-right-color: var(--warning-color); }
.btn-wa { background-color: #25D366; color: #fff; border: none; border-radius: 6px; padding: 5px 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn-wa:disabled { opacity: 0.4; cursor: not-allowed; }
.printable-list-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.printable-list-table th, .printable-list-table td { border: 1px solid #000; padding: 8px; text-align: center; font-size: 0.9em; }
@media (max-width: 900px) {
    .nav-buttons-section { flex-direction: column; flex-wrap: wrap; }
    .btn-blue { width: 100%; }
    .list-view .student-card { flex-direction: column; align-items: stretch; }
    .list-view .student-card-header { border-left: none; border-bottom: 1px solid var(--border-color); padding: 0 0 10px 0; margin-bottom: 10px; text-align: center; }
    .list-view .student-card-body { flex-direction: column; }
    .list-view .card-field input, .list-view .card-field select { width: 65%; }
    .list-view .student-card-actions { justify-content: center; padding-top: 10px; border-top: 1px dashed var(--border-color); }
    .phone-card-list { grid-template-columns: 1fr; }
}
@media (min-width: 601px) and (max-width: 900px) {
    .phone-card-list { grid-template-columns: repeat(2, 1fr); }
    .nav-buttons-section { flex-direction: row; flex-wrap: wrap; }
    .btn-blue { width: auto; flex: 1 1 45%; }
}
.sync-status { margin-top: 6px; font-size: 0.8em; font-weight: 700; text-align: center; color: #cbd5e1; }
.sync-status.ok { color: #86efac; } .sync-status.busy { color: #fde68a; } .sync-status.err { color: #fca5a5; }
