/*
=====================================================
--- 🇸🇦 تصميم الدليل السعودي المتقدم (Saudi Pro) 🇸🇦 ---
=====================================================
*/

/* 1. الإعدادات الأساسية والخطوط
----------------------------------- */
:root {
    --font-primary: 'Tajawal', sans-serif;
    --font-heading: 'Amiri', serif;

    /* ألوان الهوية السعودية */
    --color-bg: #f8fcf9;
    /* خلفية فسدقية فاتحة جداً */
    --color-card-bg: #ffffff;
    --color-text: #2c3e50;
    --color-text-light: #596275;

    --color-primary: #006C35;
    /* الأخضر السعودي الرسمي */
    --color-primary-dark: #004d26;

    --color-accent: #c6a664;
    /* ذهبي أنيق */
    --color-accent-hover: #b39352;

    --color-border: #e3ebe6;

    --shadow-soft: 0 4px 15px rgba(0, 108, 53, 0.05);
    --shadow-medium: 0 8px 30px rgba(0, 108, 53, 0.08);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.8;
    padding-bottom: 50px;
}

/* 2. شريط التنقل (Nav)
----------------------------------- */
.main-nav {
    background-color: var(--color-card-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    padding: 15px 0;
    margin-bottom: 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.8em;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a {
    font-family: var(--font-primary);
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 500;
    margin-right: 25px;
    padding: 8px 0;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    color: var(--color-primary);
}

.nav-links a.active {
    color: var(--color-primary);
    font-weight: 700;
    border-bottom-color: var(--color-accent);
}

/* 3. الهيكل العام ومقدمة الصفحة
----------------------------------- */
.main-container {
    max-width: 850px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 35px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 3em;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 10px;
}

.page-subtitle {
    font-size: 1.25em;
    color: var(--color-text-light);
    max-width: 650px;
    margin: 0 auto;
    font-weight: 400;
}

/* 4. بطاقة البحث الرئيسية (Interpreter Card)
----------------------------------- */
.service-card {
    background-color: var(--color-card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.service-card:hover {
    box-shadow: 0 12px 35px rgba(0, 108, 53, 0.12);
}

/* 5. زر فتح/إغلاق الأداة
----------------------------------- */
.service-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #ffffff;
    transition: background-color 0.3s ease;
}

.service-toggle span {
    font-family: var(--font-primary);
    font-size: 1.5em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-toggle i {
    font-size: 1.2em;
}

.service-toggle .toggle-icon {
    font-size: 1.4em;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.service-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

/* 6. محتوى الأداة (الفورم)
----------------------------------- */
.service-content {
    padding: 30px;
    border-top: 1px solid var(--color-border);
    display: block;
    /* Default is handled by JS slideToggle */
}

.service-prompt {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 15px;
}

/* حقل الإدخال الرئيسي */
.user-input-field {
    width: 100%;
    padding: 14px 20px;
    /* Adjusted padding */
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-family: var(--font-primary);
    font-size: 1.1em;
    color: var(--color-text);
    background-color: #fbfcff;
    transition: all 0.3s ease;
}

.user-input-field:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(198, 166, 100, 0.2);
    background-color: var(--color-card-bg);
}

/* حقل البحث الدائري الكبير */
input#channel-input {
    width: 100%;
    padding: 22px 25px;
    border: 2px solid var(--color-primary);
    border-radius: 50px;
    font-family: var(--font-primary);
    font-size: 1.3em;
    color: var(--color-primary);
    background-color: #ffffff;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 108, 53, 0.08);
    text-align: center;
}

input#channel-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 8px 25px rgba(198, 166, 100, 0.25);
    transform: translateY(-2px);
}

input#channel-input::placeholder {
    color: #999;
    font-weight: 300;
}

/* السؤال الأمني */
.security-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background-color: #f4fcf7;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.security-group .dream-prompt {
    margin-bottom: 0;
    flex-shrink: 0;
    color: var(--color-primary-dark);
}

.security-group input {
    flex-grow: 1;
    border: 1px solid #d1e3d6;
    padding: 10px 15px;
    border-radius: 8px;
    background: #fff;
}

/* 7. زر التفسير/البحث
----------------------------------- */
.saudi-btn {
    width: 100%;
    padding: 18px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-accent), #d4af37);
    color: #fff;
    font-family: var(--font-primary);
    font-size: 1.3em;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 5px 15px rgba(198, 166, 100, 0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.saudi-btn i {
    font-size: 1.2em;
    margin-bottom: 5px;
}

.saudi-btn small {
    font-size: 0.7em;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 4px;
}

.saudi-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(198, 166, 100, 0.4);
}

.saudi-btn:disabled {
    background: #ccc;
    color: #777;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    text-shadow: none;
}

/* Legal Disclaimer */
.legal-disclaimer {
    background-color: #fff3cd;
    color: #555;
    font-size: 0.9rem;
    padding: 12px;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid #ffeeba;
    text-align: center;
    line-height: 1.5;
}

/* رسالة الخطأ */
.limit-message {
    color: #c0392b;
    font-weight: 700;
    padding: 15px;
    text-align: center;
    font-size: 1.1em;
    background-color: #fdeeee;
    border: 1px solid #c0392b;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.limit-message #limit-timer {
    display: none;
    margin-top: 8px;
    font-size: 1.1em;
    color: #a00;
    font-weight: 700;
}

/* 8. صندوق نتيجة التفسير
----------------------------------- */
.ai-interpretation-box {
    margin: 0;
    padding: 30px;
    background-color: #f7fff9;
    /* Green tint */
    border-top: 1px dashed var(--color-border);
    color: var(--color-text);
}

.interpretation-title {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-accent);
    font-weight: 800;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.6em;
}

/* --- [NEW] Service Response Cards (Saudi Style) --- */
.service-card {
    background: #ffffff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border);
    margin-bottom: 25px;
    text-align: right;
    position: relative;
    overflow: hidden;
}

/* Decorative strip on top */
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

.ai-intro {
    font-size: 1.15em;
    color: var(--color-text);
    margin-bottom: 20px;
    font-weight: 600;
    line-height: 1.6;
}

.service-brief {
    background: #f0f7f4;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-right: 5px solid var(--color-primary);
    display: flex;
    align-items: center;
    gap: 15px;
}

.badge-gov {
    background: var(--color-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
}

.service-brief strong {
    color: var(--color-primary-dark);
    font-size: 1.1em;
}

.service-card h4 {
    color: var(--color-primary);
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.steps-list {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.steps-list li {
    position: relative;
    padding-right: 35px;
    margin-bottom: 12px;
    color: var(--color-text);
    font-size: 1.05em;
    line-height: 1.6;
}

/* Custom Checkmark for steps */
.steps-list li::before {
    content: '\f00c';
    /* FontAwesome Check */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: var(--color-accent);
    /* Gold check bg */
    color: #fff;
    border-radius: 50%;
    font-size: 0.7em;
    display: flex;
    justify-content: center;
    align-items: center;
}

.service-note {
    background: #fff8e1;
    /* Yellow/Gold tint */
    color: #856404;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #ffeeba;
}

.service-note i {
    font-size: 1.4em;
    color: var(--color-accent);
}

.official-link-btn {
    display: block;
    width: 100%;
    background: linear-gradient(45deg, var(--color-primary), #2e7d32);
    color: white !important;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1em;
    transition: all 0.3s ease;
    margin-top: 25px;
    box-shadow: 0 5px 15px rgba(0, 108, 53, 0.2);
}

.official-link-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 108, 53, 0.3);
}

.disclaimer-footer {
    margin-top: 20px;
    text-align: center;
    color: #95a5a6;
    border-top: 1px solid #eee;
    padding-top: 15px;
    font-size: 0.9em;
}

/* 9. شاشة التحميل (Modal)
----------------------------------- */
.loading-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 60, 20, 0.8);
    /* Greenish dark overlay */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-in-out;
}

.loading-modal-content {
    background: var(--color-card-bg);
    color: var(--color-primary);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    border-top: 5px solid var(--color-accent);
    animation: slideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.8em;
    color: var(--color-primary);
    margin: 15px 0;
    font-weight: 700;
}

.loading-message {
    font-size: 1.1em;
    color: var(--color-text-light);
    margin-bottom: 20px;
    font-weight: 500;
}

.countdown-timer {
    font-weight: 700;
    color: var(--color-primary);
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: var(--color-border);
    border-radius: 6px;
    margin: 0 auto 20px auto;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), #e7c04e);
    border-radius: 6px;
    transition: width 0.1s linear;
}

/* Modal Articles */
.modal-article {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f7fff9;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text-light);
    transition: background-color 0.3s ease;
    margin: 15px 0;
    text-align: right;
}

.modal-article:hover {
    background-color: #e8f5e9;
    border-color: var(--color-primary);
}

.modal-article-img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background-color: #e0e6f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-article-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-article-title {
    font-size: 0.95em;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-text);
}


/* 10. تنسيق أزرار المشاركة
----------------------------------- */
.share-buttons-container {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px dashed var(--color-border);
    text-align: center;
}

.share-title {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.4em;
    margin-bottom: 20px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    color: white !important;
    text-decoration: none !important;
    font-weight: 700;
    transition: all 0.3s ease;
    min-width: 140px;
    font-size: 1em;
}

.share-btn i {
    margin-left: 10px;
    font-size: 1.1em;
    color: white !important;
}

.whatsapp-btn {
    background-color: #25D366;
}

.whatsapp-btn:hover {
    background-color: #128C7E;
    transform: translateY(-3px);
}

.facebook-btn {
    background-color: #1877F2;
}

.facebook-btn:hover {
    background-color: #1256b3;
    transform: translateY(-3px);
}


/* 11. تصميم متجاوب (Responsive)
----------------------------------- */
@media (max-width: 768px) {
    body {
        padding-bottom: 20px;
    }

    .nav-container {
        flex-direction: column;
        gap: 10px;
    }

    .nav-links a {
        margin: 0 8px;
        font-size: 1em;
    }

    .main-container {
        padding: 0 15px;
    }

    .page-title {
        font-size: 2.2em;
    }

    .page-subtitle {
        font-size: 1em;
    }

    .interpreter-toggle {
        padding: 20px;
        text-align: center;
        flex-direction: column;
        gap: 10px;
    }

    .interpreter-toggle span {
        font-size: 1.3em;
    }

    .interpreter-toggle .toggle-icon {
        display: none;
    }

    .interpreter-content {
        padding: 20px;
    }

    .security-group {
        flex-direction: column;
        align-items: stretch;
    }

    .service-brief {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* 12. Animations
----------------------------------- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 13. الإحصائيات (Stats) - Adapted
----------------------------------- */
.stats-container {
    display: flex;
    justify-content: space-around;
    background-color: var(--color-card-bg);
    border-radius: 20px;
    padding: 25px 20px;
    max-width: 600px;
    margin: 30px auto;
    text-align: center;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--color-border);
    gap: 20px;
}

.stat-box {
    flex: 1;
    padding: 10px;
    position: relative;
}

.stat-box:first-of-type::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: 1px;
    background-color: var(--color-border);
}

.stat-box i {
    font-size: 2.8em;
    color: var(--color-accent);
    margin-bottom: 15px;
    display: block;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--color-primary);
    display: block;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.2;
}

.stat-label {
    font-size: 1.1em;
    color: var(--color-text-light);
    font-weight: 500;
    display: block;
}

@media (max-width: 600px) {
    .stats-container {
        flex-direction: column;
        max-width: 100%;
    }

    .stat-box {
        width: 100%;
        margin-bottom: 20px;
    }

    .stat-box:first-of-type::after {
        width: 60%;
        height: 1px;
        top: auto;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 14. التفاعلات (Reactions)
----------------------------------- */
.reactions-container {
    margin-top: 20px;
    padding: 25px 20px;
    border-top: 1px dashed var(--color-border);
    text-align: center;
    background-color: #fcfdff;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.ai-interpretation-box .reactions-container {
    margin-top: 30px;
    padding-top: 25px;
    padding-bottom: 0;
    background-color: transparent;
    border-radius: 0;
    border: none;
    border-top: 1px dashed var(--color-border);
}

.reactions-prompt {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 20px;
}

.reaction-buttons-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.reaction-btn {
    background-color: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
    color: var(--color-text-light);
}

.reaction-btn i {
    font-size: 1.3em;
    transition: 0.2s;
    color: #adb5bd;
}

.reaction-count {
    font-weight: 700;
    min-width: 12px;
}

.reaction-btn:not(.active):not(:disabled):hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.reaction-btn[data-reaction-type="heart"]:hover i {
    color: #e53935;
}

.reaction-btn[data-reaction-type="like"]:hover i {
    color: #1e88e5;
}

.reaction-btn[data-reaction-type="angry"]:hover i {
    color: #fb8c00;
}

.reaction-btn.active {
    border-color: transparent;
    cursor: default;
}

.reaction-btn[data-reaction-type="heart"].active {
    background: #ffebee;
    color: #c62828;
}

.reaction-btn[data-reaction-type="like"].active {
    background: #e3f2fd;
    color: #1565c0;
}

.reaction-btn[data-reaction-type="angry"].active {
    background: #fff3e0;
    color: #ef6c00;
}

.reaction-message {
    display: block;
    margin-top: 15px;
    color: #087f5b;
    font-weight: 500;
    min-height: 1.2em;
}

/* 15. Content Sections (Articles/SEO)
----------------------------------- */
.content-section {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 15px;
    padding: 40px;
    margin-top: 40px;
    box-shadow: var(--shadow-soft);
}

.content-section h2 {
    font-family: var(--font-heading);
    font-size: 1.8em;
    color: var(--color-primary);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 10px;
}

.content-section ul {
    list-style: none;
    padding-right: 0;
}

.content-section li {
    position: relative;
    padding-right: 30px;
    margin-bottom: 12px;
}

.content-section li::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    color: var(--color-accent);
}

.random-articles-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--color-border);
}

.random-articles-section h2 {
    text-align: center;
    color: var(--color-primary);
    font-size: 2em;
    margin-bottom: 30px;
    font-family: var(--font-heading);
}

.random-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.article-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-medium);
}

.article-card-image {
    width: 100%;
    aspect-ratio: 16/9;
    background: #eef3f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.4s;
}

.article-card:hover img {
    transform: scale(1.05);
}

.article-card-content {
    padding: 15px 20px;
}

.article-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Footer */
footer {
    background: #eef3f8;
    border-top: 1px solid var(--color-border);
    padding: 30px 0;
    margin-top: 50px;
    text-align: center;
    color: var(--color-text-light);
}

.footer-links a {
    margin: 0 10px;
    color: var(--color-text-light);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--color-primary);
}