/* ==========================================================================
   تصميم بسيط، جميل، أنيق وغير معقد
   مدرسة الرازي الابتدائية للبنين - بوابة TIMSS
   ========================================================================== */

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    
    --accent: #0284c7;
    --success: #16a34a;
    --gold: #d97706;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-focus: #93c5fd;

    --text-title: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;

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

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
    --shadow-btn: 0 6px 20px rgba(29, 78, 216, 0.28);

    --font-heading: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-body);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ---------------------------------------------------------
   Header - ترويسة الصفحة
--------------------------------------------------------- */
.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.school-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-title);
    line-height: 1.25;
}

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

.header-tag {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Main Section & Hero Card - البطاقة الرئيسية المباشرة
--------------------------------------------------------- */
.main-section {
    flex: 1;
    padding: 2rem 0;
}

.hero-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 2.25rem;
    align-items: center;
    margin-bottom: 2.5rem;
}

/* صورة البوستر */
.poster-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.poster-image {
    width: 100%;
    max-width: 360px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: block;
}

.poster-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-card);
}

.zoom-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* مربع الإجراءات والزر */
.action-box {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.badge-tag {
    align-self: flex-start;
    background: #ecfdf5;
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-title);
    line-height: 1.25;
}

.hero-code {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 700;
    direction: ltr;
    display: inline-block;
}

.hero-desc {
    color: var(--text-body);
    font-size: 1rem;
    line-height: 1.6;
}

/* ---------------------------------------------------------
   الزر الرئيسي للدخول - واضح، كبير ومباشر
--------------------------------------------------------- */
.btn-enter {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    text-decoration: none;
    padding: 1.1rem 1.6rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-btn);
    display: flex;
    align-items: center;
    gap: 1.1rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    margin-top: 0.5rem;
}

.btn-enter:hover {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(29, 78, 216, 0.38);
}

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

.btn-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.btn-caption {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.btn-caption strong {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
}

.btn-caption small {
    font-size: 0.82rem;
    color: #dbeafe;
}

/* الإجراءات الثانوية */
.secondary-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 0.25rem;
}

.btn-copy {
    background: #f1f5f9;
    color: var(--text-title);
    border: 1px solid var(--border);
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: var(--transition);
}

.btn-copy:hover {
    background: #e2e8f0;
}

.link-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    direction: ltr;
    font-family: monospace;
    background: #f8fafc;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    word-break: break-all;
}

/* شريط الجوائز الهادئ */
.prize-pill {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    color: #b45309;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.prize-pill i {
    font-size: 1.1rem;
    color: var(--gold);
}

/* ---------------------------------------------------------
   معرض الصور الإضافية - تصميم مرتب وأنيق
--------------------------------------------------------- */
.gallery-wrapper {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
}

.gallery-head {
    margin-bottom: 1.25rem;
}

.gallery-head h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-title);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-head p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.gallery-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    background: #f8fafc;
    aspect-ratio: 3 / 4;
    transition: var(--transition);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.04);
}

.item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.item-overlay span {
    background: #ffffff;
    color: var(--text-title);
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.gallery-item:hover .item-overlay {
    opacity: 1;
}

/* بطاقة إضافة صور جديدة */
.gallery-add-card {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    gap: 0.45rem;
    color: var(--text-muted);
}

.gallery-add-card i {
    font-size: 2rem;
    color: #94a3b8;
}

.gallery-add-card span {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-title);
}

.gallery-add-card small {
    font-size: 0.76rem;
    line-height: 1.4;
}

/* ---------------------------------------------------------
   Footer - التذييل
--------------------------------------------------------- */
.site-footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
}

.footer-content p {
    font-size: 0.95rem;
    color: var(--text-title);
    margin-bottom: 0.25rem;
}

.footer-content small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---------------------------------------------------------
   Lightbox Modal - نافذة عرض الصورة
--------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 650px;
    max-height: 90vh;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: block;
}

.modal-close {
    position: absolute;
    top: -40px;
    left: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.2rem;
    cursor: pointer;
    line-height: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #0f172a;
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1100;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ---------------------------------------------------------
   التجاوب مع الهواتف الذكية (Responsive)
--------------------------------------------------------- */
@media (max-width: 820px) {
    .hero-card {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .poster-box {
        order: 2;
    }

    .poster-image {
        max-width: 300px;
    }

    .action-box {
        order: 1;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .btn-enter {
        padding: 1rem 1.25rem;
    }

    .btn-caption strong {
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .hero-card {
        padding: 1.25rem 1rem;
    }

    .btn-enter {
        gap: 0.75rem;
    }

    .btn-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .secondary-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-copy {
        justify-content: center;
    }
}
