/* ==============================================================================
   مدرسة محمد الفاتح للبنين - تصميم الهواتف الذكية المخصص
   تصميم نظيف، فائق السلاسة، بدون أي تداخل نصوص
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@500;600;700;800;900&display=swap');

:root {
    --font-app: 'Cairo', system-ui, -apple-system, sans-serif;
    
    /* الألوان الأساسية */
    --color-primary: #0f172a;
    --color-gold: #d97706;
    --color-gold-light: #fef3c7;
    
    /* الوجبة A (صباحي) */
    --shift-a-main: #1d4ed8;
    --shift-a-bg: #eff6ff;
    --shift-a-border: #bfdbfe;
    
    /* الوجبة B (مسائي) */
    --shift-b-main: #047857;
    --shift-b-bg: #ecfdf5;
    --shift-b-border: #a7f3d0;

    --bg-body: #f8fafc;
    --card-surface: #ffffff;
    --text-title: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border-subtle: #e2e8f0;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-card: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-active: 0 8px 20px -3px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    direction: rtl;
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-app);
    background-color: var(--bg-body);
    color: var(--text-title);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.5;
    background-image: radial-gradient(circle at 50% 0%, #edf2f7 0%, #f8fafc 70%);
}

/* حاوية التطبيق المتوافقة مع أجهزة الموبايل */
.mobile-app-wrapper {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem 1.75rem;
    position: relative;
}

/* ==============================================================================
   الشاشة الرئيسية: الشعار واسم المدرسة
   ============================================================================== */
.main-home-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: fadeInView 0.3s ease-out;
}

@keyframes fadeInView {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.school-brand-hero {
    text-align: center;
    padding: 1.25rem 0.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.school-main-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-gold);
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.25);
    margin-bottom: 0.85rem;
}

.school-main-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-title);
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.school-main-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.academic-chip {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    color: var(--text-body);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.85rem;
    border-radius: var(--radius-full);
}

.step-guide-title {
    text-align: center;
    margin: 1rem 0 1.25rem;
    position: relative;
}

.step-guide-title span {
    background: var(--card-surface);
    padding: 0.35rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--color-primary);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ==============================================================================
   زري الوجبتين A و B (مخصص للهاتف: حجم كبير، مساحة لمس مريحة)
   ============================================================================== */
.shifts-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.shift-action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--card-surface);
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: right;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.shift-action-btn:active {
    transform: scale(0.98);
}

/* زر الوجبة A */
.shift-action-btn.shift-a-btn {
    border-color: var(--shift-a-border);
    background: linear-gradient(to left, #ffffff 0%, #f0f7ff 100%);
}
.shift-action-btn.shift-a-btn:hover {
    border-color: var(--shift-a-main);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.16);
}
.shift-a-btn .shift-btn-icon {
    background: var(--shift-a-bg);
    color: var(--shift-a-main);
}
.shift-a-btn .shift-btn-name {
    color: var(--shift-a-main);
}

/* زر الوجبة B */
.shift-action-btn.shift-b-btn {
    border-color: var(--shift-b-border);
    background: linear-gradient(to left, #ffffff 0%, #f0fdf4 100%);
}
.shift-action-btn.shift-b-btn:hover {
    border-color: var(--shift-b-main);
    box-shadow: 0 6px 20px rgba(4, 120, 87, 0.16);
}
.shift-b-btn .shift-btn-icon {
    background: var(--shift-b-bg);
    color: var(--shift-b-main);
}
.shift-b-btn .shift-btn-name {
    color: var(--shift-b-main);
}

.shift-btn-content {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.shift-btn-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.shift-btn-name {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.shift-btn-timing {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.shift-btn-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ==============================================================================
   الشاشة 2: اختيار الصف
   ============================================================================== */
.classes-flow-view, .schedule-flow-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    animation: fadeInView 0.3s ease-out;
}

.flow-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.btn-clean-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-title);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-clean-back:active {
    background: #f1f5f9;
}

.active-shift-tag {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #ffffff;
}

.screen-heading {
    text-align: center;
    margin-bottom: 1.25rem;
}

.screen-heading h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.screen-heading p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* قائمة الصفوف في شكل بطاقات لمس واضحة */
.classes-list-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.class-select-card {
    background: var(--card-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.18s ease;
    text-align: right;
    width: 100%;
}

.class-select-card:hover, .class-select-card:active {
    border-color: var(--color-gold);
    box-shadow: var(--shadow-card);
    transform: translateY(-1px);
}

.class-title-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-title);
    margin-bottom: 0.15rem;
}

.class-section-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.class-open-arrow {
    color: var(--color-gold);
    display: flex;
    align-items: center;
}

/* ==============================================================================
   الشاشة 3: عارض الجدول وأدوات التحميل والتكبير
   ============================================================================== */
.schedule-title-card {
    text-align: center;
    margin-bottom: 1rem;
}

.schedule-title-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-title);
}

.schedule-title-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* شريط الإجراءات: زر التحميل وأدوات التكبير */
.schedule-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-action-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.btn-action-primary:active {
    background: #1e293b;
    transform: scale(0.98);
}

.zoom-tools-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-tool-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-title);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-tool-circle:active {
    background: #f1f5f9;
}

/* إطار صورة الجدول */
.schedule-image-frame {
    background: #0f172a;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-active);
    margin-bottom: 1rem;
    position: relative;
}

.schedule-image-viewport {
    min-height: 380px;
    max-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 0.75rem;
    touch-action: pan-x pan-y;
}

.schedule-img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.15s ease-out;
    transform-origin: center center;
}

.empty-state-notice {
    text-align: center;
    color: #ffffff;
    padding: 2.5rem 1rem;
}

.empty-state-notice h3 {
    font-size: 1.15rem;
    margin: 0.5rem 0 0.25rem;
}

.empty-state-notice p {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* توجيهات سريعة من الإدارة */
.school-quick-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.school-quick-notice strong {
    font-weight: 800;
    margin-left: 0.3rem;
}

/* ==============================================================================
   نافذة ملء الشاشة Lightbox
   ============================================================================== */
.fullscreen-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.fullscreen-modal.active {
    display: flex;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.modal-img-wrapper {
    max-width: 100%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-img-wrapper img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
}

/* تذييل الصفحة البسيط */
.app-simple-footer {
    margin-top: auto;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
}
