:root {
    --primary: #0D9488;
    /* أخضر زمردي طبي عصري */
    --primary-dark: #0F766E;
    --primary-light: #CCFBF1;
    --secondary: #0284C7;
    /* أزرق سماوي طبي */
    --bg-main: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-dark: #0F172A;
    --text-muted: #475569;
    --danger: #DC2626;
    --danger-light: #FEF2F2;
    --danger-border: #FECACA;
    --success: #16A34A;
    --success-light: #F0FDF4;
    --success-border: #BBF7D0;
    --border: #E2E8F0;
    --shadow-sm: 0 4px 6px -1px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 20px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 25px -5px rgba(13, 148, 136, 0.14);
}

html {
    font-size: 16px;
    /* يتغير ديناميكياً من شريط كبار السن */
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.75;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* شريط كبار السن */
.a11y-bar {
    background: #0F172A;
    color: #F8FAFC;
    padding: 0.45rem 0;
    font-size: 0.85rem;
}

.a11y-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.a11y-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #CBD5E1;
}

.a11y-controls {
    display: flex;
    gap: 0.4rem;
}

.a11y-controls button {
    background: #1E293B;
    color: white;
    border: 1px solid #334155;
    padding: 0.2rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: 0.2s;
}

.a11y-controls button:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* الشريط العلوي */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.9rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.logo-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 15px rgba(13, 148, 136, 0.25);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.logo span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
}

.why-btn {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    border: 2px solid #F59E0B;
    padding: 0.65rem 1.2rem;
    border-radius: 50px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);
}

.why-btn:hover {
    transform: translateY(-2px);
    background: #FDE68A;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3);
}

/* التحكم في الصفحات */
.page-view {
    display: none;
    flex: 1;
    animation: fadePage 0.3s ease;
}

.page-view.active {
    display: block;
}

@keyframes fadePage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* القسم الترحيبي والبحث */
.hero {
    background: radial-gradient(circle at top right, #CCFBF1 0%, #E0F2FE 50%, #F8FAFC 100%);
    padding: 3.2rem 0 2.8rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    color: var(--primary-dark);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--primary-light);
}

.hero h2 {
    font-size: 1.95rem;
    font-weight: 800;
    color: var(--text-dark);
    max-width: 750px;
    margin: 0 auto 0.8rem;
    line-height: 1.4;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 650px;
    margin: 0 auto 1.6rem;
}

.search-box {
    max-width: 580px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i.fa-magnifying-glass {
    position: absolute;
    right: 1.2rem;
    color: var(--primary);
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    padding: 0.95rem 3rem 0.95rem 2.8rem;
    border-radius: 50px;
    border: 2px solid var(--border);
    background: white;
    font-size: 1rem;
    color: var(--text-dark);
    box-shadow: var(--shadow-md);
    transition: 0.25s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.clear-search {
    position: absolute;
    left: 1rem;
    background: #E2E8F0;
    border: none;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

/* شبكة الأقسام */
.main-section {
    padding: 3rem 1.25rem 4.5rem;
}

.section-title {
    text-align: center;
    margin-bottom: 2.2rem;
}

.section-title h3 {
    font-size: 1.6rem;
    font-weight: 800;
}

.section-title p {
    color: var(--text-muted);
    font-size: 1rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 22px;
    padding: 1.8rem 1.4rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1.1rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: 0.3s;
}

.category-card:hover .card-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: scale(1.06);
}

.category-card h4 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.category-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

.card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: #F1F5F9;
    color: var(--primary-dark);
    padding: 0.55rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.2s;
}

.category-card:hover .card-action {
    background: var(--primary);
    color: white;
}

/* الصفحات الداخلية (تفاصيل الدواء + لماذا) */
.page-container {
    padding: 2rem 1.25rem 4rem;
}

.top-nav-bar {
    margin-bottom: 1.5rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--border);
    padding: 0.75rem 1.4rem;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(4px);
}

.detail-card {
    background: white;
    border-radius: 24px;
    padding: 2.2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #F1F5F9;
}

.detail-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.detail-icon {
    width: 4.2rem;
    height: 4.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    flex-shrink: 0;
}

.detail-title-group h2 {
    font-size: 1.65rem;
    font-weight: 800;
}

.audio-btn {
    background: #EFF6FF;
    color: var(--secondary);
    border: 2px solid #BFDBFE;
    padding: 0.7rem 1.3rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.audio-btn:hover,
.audio-btn.speaking {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* قسم المقارنة البصرية (الصح والغلط بالصور) */
.visual-comparison-section {
    margin-bottom: 2.5rem;
}

.sub-heading {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.25rem;
}

.visual-card {
    border-radius: 18px;
    overflow: hidden;
    border: 3px solid;
    background: white;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.visual-card.wrong {
    border-color: var(--danger);
    background: var(--danger-light);
}

.visual-card.right {
    border-color: var(--success);
    background: var(--success-light);
}

.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.visual-card.wrong .status-badge {
    background: var(--danger);
}

.visual-card.right .status-badge {
    background: var(--success);
}

.visual-media-box {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.visual-card.wrong .visual-media-box {
    background: #FEE2E2;
    color: var(--danger);
}

.visual-card.right .visual-media-box {
    background: #DCFCE7;
    color: var(--success);
}

.visual-media-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.illustration-fallback {
    text-align: center;
    padding: 1.2rem;
}

.illustration-fallback i {
    font-size: 3.2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.illustration-fallback span {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 600;
}

.visual-caption {
    padding: 1rem 1.1rem;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
}

.visual-card.wrong .visual-caption {
    color: #991B1B;
}

.visual-card.right .visual-caption {
    color: #166534;
}

/* خطوات التخلص السليم */
.steps-list {
    list-style: none;
    margin: 1rem 0 2rem;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: #F8FAFC;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border);
    font-size: 1.02rem;
}

.step-num {
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.warning-box {
    background: var(--danger-light);
    border-right: 5px solid var(--danger);
    padding: 1.2rem 1.4rem;
    border-radius: 14px;
    color: #991B1B;
    margin-bottom: 2rem;
}

.warning-box h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 1.1rem;
}

/* الفيديو والمشاركة */
.video-box {
    margin-bottom: 2rem;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #F8FAFC;
}

.video-placeholder {
    padding: 2.2rem;
    text-align: center;
    color: var(--text-muted);
}

.video-placeholder i {
    font-size: 2.8rem;
    color: #EF4444;
    margin-bottom: 0.5rem;
}

.share-bar {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 18px;
    padding: 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.whatsapp-btn {
    background: #25D366;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    transition: 0.2s;
}

.whatsapp-btn:hover {
    background: #1EBE5D;
    transform: translateY(-2px);
}

/* صفحة لماذا */
.why-page-card {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.why-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.why-icon {
    width: 4.5rem;
    height: 4.5rem;
    background: #FEF3C7;
    color: #D97706;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1rem;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.4rem;
    margin-bottom: 2.5rem;
}

.why-card {
    background: #F8FAFC;
    padding: 1.6rem;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.why-card-icon {
    width: 3rem;
    height: 3rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 0.9rem;
}

.why-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.why-cta {
    background: linear-gradient(135deg, #CCFBF1, #E0F2FE);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
}

.why-cta h3 {
    margin-bottom: 0.5rem;
}

.why-cta p {
    margin-bottom: 1.2rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 1.8rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.no-results i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.footer {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

@media (max-width: 640px) {
    .hero h2 {
        font-size: 1.5rem;
    }

    .detail-card,
    .why-page-card {
        padding: 1.4rem;
    }
}