/* ============================================================
   1. RESET & BASE (المتغيرات الجديدة)
   ============================================================ */

:root {
    /* الألوان الأساسية من الشعار */
    --primary-color: #22559f;      /* KidCode */
    --primary-dark: #1a437c;       /* أزرق غامق للـ Hover */
    --secondary-color: #39a66f;    /* -EG */
    --secondary-dark: #2b8557;     /* أخضر غامق للـ Hover */
    --text-slogan: #3f596f;        /* لون الجملة "أمان طفلك في صفحة واحدة" */

    /* الألوان المكملة */
    --danger-color: #e63946;       /* أحمر للنجدة */
    --warning-color: #f4a261;      /* برتقالي للتنبيهات */

    /* الخلفيات والنصوص */
    --bg-body: #f4f7fb;
    --bg-white: #ffffff;
    --text-primary: #1A1A2E;
    --text-secondary: #64748B;
    --text-light: #94A3B8;
    --border-color: #dce3ed;

    /* الظلال */
    --shadow-sm: 0 2px 8px rgba(34, 85, 159, 0.06);
    --shadow-md: 0 8px 30px rgba(34, 85, 159, 0.10);
    --shadow-lg: 0 20px 50px rgba(34, 85, 159, 0.15);

    /* الزوايا */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 60px;

    /* الخطوط */
    --font-arabic: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    --font-english: 'Inter', 'Segoe UI', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-arabic);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    padding-top: 80px; /* مساحة للهيدر الثابت */
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 30px 0;
}

/* ============================================================
   2. الهيدر الثابت (الجديد)
   ============================================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--primary-color);
    padding: 12px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    direction: rtl;
}

.site-header .logo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-decoration: none;
    color: white;
}

.site-header .logo .brand {
    font-family: var(--font-english);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}
.site-header .logo .brand .kid {
    color: #ffffff;
}
.site-header .logo .brand .eg {
    color: var(--secondary-color);
}
.site-header .logo .tagline {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    margin-top: -4px;
}

.site-header .nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.site-header .nav-links a {
    color: rgba(255, 255, 255, 0.85);
    padding: 6px 16px;
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}
.site-header .nav-links a:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}
.site-header .nav-links a.cta-link {
    background: var(--secondary-color);
    color: var(--primary-color);
}
.site-header .nav-links a.cta-link:hover {
    background: white;
    border-color: white;
}

/* ============================================================
   3. COMMON COMPONENTS
   ============================================================ */

.card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 28px 30px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    border: 1px solid rgba(34, 85, 159, 0.04);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 22px;
}
.card-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-arabic);
    text-decoration: none;
    min-height: 56px;
}
.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background: var(--secondary-dark);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}
.btn-danger:hover {
    background: #c62836;
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--text-primary);
}
.btn-warning:hover {
    background: #e69500;
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.form-group {
    margin-bottom: 24px;
}
.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.form-group .required::after {
    content: " *";
    color: var(--danger-color);
}

input, select, textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: var(--font-arabic);
    background: var(--bg-white);
    color: var(--text-primary);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(34, 85, 159, 0.08);
}

.id-field-wrapper {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    transition: all 0.3s ease;
    overflow: hidden;
    direction: ltr;
}
.id-field-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(34, 85, 159, 0.08);
}
.id-prefix {
    background: var(--bg-body);
    padding: 0 18px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary-color);
    border-left: 2px solid var(--border-color);
    font-family: var(--font-english);
    display: flex;
    align-items: center;
}
.id-input-field {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-family: var(--font-english);
    direction: ltr;
    text-align: left;
    outline: none;
    font-weight: 600;
}

.image-preview {
    width: 150px;
    height: 150px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-body);
    cursor: pointer;
    transition: all 0.3s ease;
}
.image-preview:hover {
    border-color: var(--primary-color);
    background: rgba(34, 85, 159, 0.03);
}
.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-preview .placeholder {
    color: var(--text-light);
    font-size: 0.85rem;
    text-align: center;
    padding: 15px;
}

.message {
    margin-top: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    display: none;
}
.message.success {
    background: #e8f5ee;
    color: var(--secondary-dark);
    display: block;
    border-right: 4px solid var(--secondary-color);
}
.message.error {
    background: #fee2e2;
    color: #991B1B;
    display: block;
    border-right: 4px solid var(--danger-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
}
.error-message.show {
    display: block;
}
.success-message {
    background: #e8f5ee;
    color: var(--secondary-dark);
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-top: 20px;
    display: none;
    font-weight: 700;
    border-right: 4px solid var(--secondary-color);
}
.success-message.show {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-overlay.show {
    display: flex;
}
.modal-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 90%;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 20px 0 25px;
}
.checkbox-group input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin-top: 4px;
    cursor: pointer;
    accent-color: var(--primary-color);
}
.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.95rem;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: 700;
}
.loading.show {
    display: block;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
}

.btn-wa-container {
    text-align: center;
    margin: 20px 0;
}
.btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #25D366;
    color: white;
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-xl);
    text-decoration: none;
    font-weight: 700;
    max-width: 100%;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.btn-wa:hover {
    background: #128C7E;
    transform: scale(1.02);
    color: white;
    text-decoration: none;
}

.site-footer {
    background: var(--primary-color);
    color: rgba(255, 255, 255, 0.8);
    padding: 30px 24px;
    text-align: center;
    margin-top: 50px;
    direction: rtl;
}
.site-footer a {
    color: var(--secondary-color);
    font-weight: 600;
}
.site-footer a:hover {
    color: white;
}
.site-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.site-footer .footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}
.site-footer .footer-links a:hover {
    color: var(--secondary-color);
}
.site-footer p {
    font-size: 0.8rem;
    opacity: 0.6;
    margin: 0;
}

/* ============================================================
   4. MEDIA QUERIES (العامة)
   ============================================================ */

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    .site-header {
        padding: 10px 16px;
    }
    .site-header .logo .brand {
        font-size: 1.4rem;
    }
    .site-header .logo .tagline {
        font-size: 0.6rem;
    }
    .site-header .nav-links a {
        font-size: 0.75rem;
        padding: 4px 12px;
    }
    .card {
        padding: 20px;
    }
    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .site-header {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
    }
    .site-header .logo {
        align-items: center;
    }
    .site-header .nav-links {
        justify-content: center;
    }
    .site-header .nav-links a {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    .site-footer .footer-links {
        gap: 12px;
    }
    .site-footer .footer-links a {
        font-size: 0.8rem;
    }
}