/* لوحة متابعة التقويم والاعتماد المدرسي - تصميم احترافي */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

:root {
    --primary: #0d9488;
    --primary-light: #14b8a6;
    --primary-dark: #0f766e;
    --accent: #0891b2;
    --accent-hover: #0e7490;
    --success: #059669;
    --danger: #e11d48;
    --danger-hover: #be123c;
    --bg-body: #f0fdfa;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    direction: rtl;
    background: var(--bg-card);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100%;
    width: 100%;
    margin: 0;
    overflow-x: hidden;
}

/* الهيدر */
.header {
    flex-shrink: 0;
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header-title-block h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    margin-bottom: 0.2rem;
}

.header-welcome {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.95);
    font-weight: 500;
}

.header-icons {
    display: flex;
    gap: 1rem;
}

.header-icons a {
    color: white;
    opacity: 0.9;
    transition: opacity 0.2s;
    font-size: 1.25rem;
}

.header-icons a:hover {
    opacity: 1;
}

.header-info {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    font-size: 0.95rem;
    opacity: 0.95;
}

.header-info span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.header-info strong {
    font-weight: 600;
}

/* التنقل */
.nav-tabs {
    flex-shrink: 0;
    width: 100%;
    background: var(--bg-card);
    padding: 0 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}

.nav-tabs a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tabs a:hover {
    color: var(--primary);
    background: #f0fdfa;
}

.nav-tabs a.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* المحتوى الرئيسي - يملأ الشاشة بالكامل */
.main-content {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100vw;
    padding: 0;
    overflow-y: auto;
    min-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.domain-section {
    background: var(--bg-card);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    flex: 1;
    min-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    width: 100%;
}

.domain-header {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.domain-icon {
    font-size: 2rem;
    line-height: 1;
}

.domain-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.2rem;
}

.domain-subtitle {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    margin: 0;
}

.sub-section {
    flex: 1;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.sub-section h3 {
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
    color: var(--text);
    font-weight: 600;
}

.sub-nav {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.sub-nav a {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    background: #f8fafc;
    color: var(--text-muted);
}

.sub-nav a:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.sub-nav a.btn-primary {
    background: var(--primary);
    color: white;
}

.sub-nav a.btn-primary:hover {
    background: var(--primary-light);
}

.evidence-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.evidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.evidence-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-input, .filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-input {
    min-width: 180px;
}
.advanced-search .search-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.advanced-search .search-row .search-input { flex: 1; }
.advanced-search .search-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.advanced-search .filter-date { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; }

.report-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.report-actions h3 {
    margin: 0;
}

.evidence-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
}

.evidence-count .badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* جدول الشواهد */
.evidence-table-wrapper {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.evidence-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.evidence-table th,
.evidence-table td {
    padding: 1rem 1.25rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.evidence-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.evidence-table tbody tr {
    transition: background 0.15s;
}

.evidence-table tbody tr:hover {
    background: #f8fafc;
}

.evidence-table .link-cell a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.evidence-table .link-cell a:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* أزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: #f8fafc;
}

/* مودال */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 52, 96, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f8fafc;
}

/* تنبيهات لوحة التحكم */
.dashboard-alerts {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.dashboard-alerts h3 { margin: 0 0 0.5rem 0; font-size: 1rem; }
.dashboard-alerts p { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: var(--text); }
.dashboard-alerts ul { margin: 0; padding-right: 1.25rem; }
.dashboard-alerts li { margin-bottom: 0.35rem; }
.dashboard-alerts a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.dashboard-alerts a:hover { text-decoration: underline; }
.dashboard-alerts.urgent { background: #fee2e2; border-color: #dc2626; }

/* لوحة التحكم */
.dashboard-overview {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-stats .stat-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
}

.dashboard-stats .stat-card.highlight .stat-number,
.dashboard-stats .stat-card.highlight .stat-label {
    color: white;
}

.dashboard-overview h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.progress-section {
    margin-bottom: 2rem;
}

.progress-item {
    margin-bottom: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.3s;
}

.progress-warn {
    font-size: 0.8rem;
    color: var(--danger);
    display: block;
    margin-top: 0.25rem;
}

.assessment-section {
    margin-bottom: 2rem;
}
.assessment-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.assessment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.assessment-label { flex: 1; font-size: 0.95rem; }
.assessment-stars { display: flex; gap: 0.2rem; }
.assessment-stars .star {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #cbd5e1;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}
.assessment-stars .star:hover:not([disabled]) { color: #f59e0b; }
.assessment-stars .star.active { color: #f59e0b; }
.assessment-stars .star[disabled] { cursor: default; opacity: 0.8; }
.assessment-value {
    min-width: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.dashboard-chart {
    margin-bottom: 0;
    max-width: 100%;
}
.dashboard-chart canvas { max-height: 220px; }

.domain-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.domain-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.domain-card:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow);
}

.domain-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.domain-card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.domain-card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.domain-card.report-card {
    border-style: dashed;
}

/* صفحة تسجيل الدخول - تصميم احترافي */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
    padding: 2rem 1rem;
}

.login-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    max-width: 900px;
    width: 100%;
}

.login-brand {
    flex: 1;
    min-width: 280px;
    text-align: center;
    color: #ffffff;
}

.login-brand-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.login-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.login-brand p {
    font-size: 1rem;
    opacity: 0.95;
}

.login-container {
    flex: 1;
    min-width: 320px;
    max-width: 420px;
}

.login-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.2);
}

.login-card-header {
    margin-bottom: 1.75rem;
}

.login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.login-card-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .form-group label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.login-form .form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.btn-login .btn-arrow {
    opacity: 0.8;
    transition: transform 0.2s;
}

.btn-login:hover .btn-arrow {
    transform: translateX(-4px);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.login-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
    .login-wrapper { flex-direction: column; gap: 2rem; }
    .login-brand h1 { font-size: 1.25rem; }
}

/* التقرير النهائي */
.report-content {
    flex: 1;
    overflow-y: auto;
}

.report-summary h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.report-summary p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card.small {
    padding: 1rem;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card.small .stat-number {
    font-size: 1.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: block;
}

/* صفحات الأقسام الأخرى */
.domain-section .coming-soon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.domain-section .coming-soon p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

@media print {
    .header, .nav-tabs, .btn, .modal-overlay, .evidence-actions, .sub-nav { display: none !important; }
    body { background: white; }
    .domain-section { box-shadow: none; border: 1px solid #ddd; }
}
