/*
Theme Name: Memoral V7 (Clinical Reference App)
Version: 7.9.0
Description: رفع باگ‌های هدر موبایل، اصلاح سایز سایدبارها و پروفایل
Author: Farhang & Co.
Text Domain: memoral
*/

/* ==========================================================================
   1. فونت‌های محلی (Local Fonts & Icons)
   ========================================================================== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Material Icons Round';
    font-style: normal;
    font-weight: 400;
    src: url('./fonts/MaterialIconsRound-Regular.woff2') format('woff2');
    font-display: block;
}

.material-icons-round {
    font-family: 'Material Icons Round';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. متغیرهای رنگی و ابعاد (CSS Variables)
   ========================================================================== */
:root {
    /* ---- رنگ اصلی — سبز‌آبی نسخه‌نویسی ---- */
    --primary:       #0d9488;
    --primary-rgb:   13, 148, 136;
    --primary-dark:  #0a7a70;
    --primary-light: rgba(13, 148, 136, 0.12);

    /* ---- رنگ برند ممورال — فقط جاهای برندی ---- */
    --brand:         #1a365d;
    --brand-rgb:     26, 54, 93;
    --brand-light:   rgba(26, 54, 93, 0.10);

    /* ---- accent ---- */
    --accent:        #FF6B6B;
    --accent-rgb:    255, 107, 107;

    /* ---- success ---- */
    --success:       #10B981;
    --success-rgb:   16, 185, 129;
    --success-light: #D1FAE5;

    /* ---- gold ---- */
    --gold:          #F59E0B;
    --gold-rgb:      245, 158, 11;

    /* ---- semantic ---- */
    --warning-bg:     #FFFBEB;
    --warning-text:   #92400E;
    --warning-border: #FCD34D;
    --warning-icon:   #D97706;

    --error-bg:       #FEF2F2;
    --error-text:     #B91C1C;
    --error-border:   #FCA5A5;
    --error-icon:     #EF4444;

    --info-bg:        rgba(13, 148, 136, 0.08);
    --info-text:      #0d9488;
    --info-border:    rgba(13, 148, 136, 0.25);

    /* ---- پس‌زمینه و سطوح ---- */
    --bg:             #F0F4F4;
    --surface:        #FFFFFF;
    --surface-hover:  #F4F9F9;
    --surface-raised: #FFFFFF;

    /* ---- متن ---- */
    --text-main:  #1E293B;
    --text-mid:   #475569;
    --text-light: #94A3B8;

    /* ---- حاشیه و سایه ---- */
    --border:      #E2E8F0;
    --shadow-sm:   0 2px 8px rgba(13, 148, 136, 0.06);
    --shadow-md:   0 4px 16px rgba(13, 148, 136, 0.10);
    --shadow-top:  0 -2px 10px rgba(0,0,0,0.05);

    /* ---- ابعاد ---- */
    --header-h:  80px;
    --nav-h:     65px;
    --radius:    16px;
    --sidebar-w: 320px;
}

[data-theme="dark"] {
    /* ---- رنگ اصلی ---- */
    --primary:       #14b8a6;
    --primary-rgb:   20, 184, 166;
    --primary-light: rgba(20, 184, 166, 0.18);
    --primary-dark:  #0d9488;

    /* ---- رنگ برند ---- */
    --brand:         #4a7ab5;
    --brand-rgb:     74, 122, 181;
    --brand-light:   rgba(74, 122, 181, 0.15);

    /* ---- accent ---- */
    --accent:        #F87171;
    --accent-rgb:    248, 113, 113;

    /* ---- success ---- */
    --success:       #34D399;
    --success-rgb:   52, 211, 153;
    --success-light: rgba(52, 211, 153, 0.15);

    /* ---- gold ---- */
    --gold:          #FBBF24;
    --gold-rgb:      251, 191, 36;

    /* ---- semantic ---- */
    --warning-bg:     rgba(245, 158, 11, 0.10);
    --warning-text:   #FDE68A;
    --warning-border: rgba(245, 158, 11, 0.30);
    --warning-icon:   #FBBF24;

    --error-bg:       rgba(239, 68, 68, 0.10);
    --error-text:     #FCA5A5;
    --error-border:   rgba(239, 68, 68, 0.30);
    --error-icon:     #F87171;

    --info-bg:        rgba(20, 184, 166, 0.12);
    --info-text:      #5eead4;
    --info-border:    rgba(20, 184, 166, 0.28);

    /* ---- پس‌زمینه و سطوح ---- */
    --bg:             #0F1F1E;
    --surface:        #162524;
    --surface-hover:  #1E3332;
    --surface-raised: #1E3332;

    /* ---- متن ---- */
    --text-main:  #F0FDFA;
    --text-mid:   #CBD5E1;
    --text-light: #64748B;

    /* ---- حاشیه و سایه ---- */
    --border:     #1F3B39;
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.45);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.55);
    --shadow-top: 0 -2px 10px rgba(0,0,0,0.5);
}

/* ==========================================================================
   3. استایل‌های پایه
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   4. ساختار اصلی و هدر (Layout & Header)
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s;
    padding-top: env(safe-area-inset-top);
    width: 100%;
}

/* رفع باگ بیرون زدن دکمه‌ها در موبایل */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.header-search-container {
    flex: 1;
    min-width: 0; /* جلوگیری از کشیده شدن فلکس بیش از عرض صفحه */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* جلوگیری از فشرده شدن آیکون‌ها */
}

.brand-name {
    font-weight: 950;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 1px;
    background: var(--surface-hover);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-mid);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #EF4444;
}

.status-dot.online {
    background: var(--success);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface-hover);
    border-radius: 12px;
    padding: 0 14px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
    width: 100%;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
}

.search-input {
    flex: 1;
    min-width: 0; /* مهم برای جلوگیری از شکستن کادر در موبایل */
    border: none;
    background: transparent;
    padding: 10px 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
}

.search-wrapper .material-icons-round {
    color: var(--text-light);
    font-size: 20px;
}

.live-search-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    max-height: 350px;
    overflow-y: auto;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.live-search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-res-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.search-res-item:last-child { border-bottom: none; }
.search-res-item:hover { background: var(--surface-hover); }
.search-res-item .material-icons-round { color: var(--primary); background: var(--primary-light); padding: 6px; border-radius: 8px; }
.search-res-item strong { display: block; font-size: 0.9rem; color: var(--text-main); margin-bottom: 2px; }
.search-res-item small { display: block; font-size: 0.75rem; color: var(--text-mid); }

/* ==========================================================================
   5. کانتینر اصلی محتوا
   ========================================================================== */
#app-container {
    padding-top: var(--header-h);
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
}

.view-tab {
    padding: 20px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   6. منوی کناری (سایدبارها)
   ========================================================================== */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1001;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar {
    position: fixed;
    top: 0;
    width: 85vw;
    max-width: 380px;
    height: 100vh;
    background: var(--surface);
    z-index: 1002;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    padding: calc(env(safe-area-inset-top) + 24px) 24px 24px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
    border-left: 1px solid var(--border);
}

.sidebar-right.active { transform: translateX(0); }

.sidebar-left {
    left: 0;
    right: auto;
    transform: translateX(-100%);
    border-right: 1px solid var(--border);
}

.sidebar-left.active { transform: translateX(0); }

.sidebar-profile-content { display: flex; flex-direction: column; flex: 1; }
.sidebar-bottom-action { margin-top: auto; padding-top: 20px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    color: var(--text-main);
    font-weight: 800;
    border-radius: 12px;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.sidebar-link:hover { background: var(--surface-hover); }
.sidebar-link .material-icons-round { color: var(--text-light); }

.hide-on-mobile { display: none; }

/* ==========================================================================
   7. منوی پایین موبایل
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: var(--shadow-top);
    z-index: 900;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    gap: 4px;
    transition: color 0.2s;
    cursor: pointer;
}

.nav-icon { font-size: 24px; transition: transform 0.2s; }
.nav-text { font-size: 0.7rem; font-weight: 800; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: translateY(-2px); }

/* ==========================================================================
   8. گرید دسته‌بندی‌ها
   ========================================================================== */
.section-header { margin-bottom: 16px; }
.section-title { font-size: 1.15rem; font-weight: 950; color: var(--text-main); display: flex; align-items: center; gap: 8px; }

.cat-circle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 16px;
    margin-bottom: 24px;
}

.cat-item { display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform 0.2s; }
.cat-item:active { transform: scale(0.95); }

.cat-img-wrapper {
    width: 85px;
    height: 85px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
    overflow: hidden;
}

.cat-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.cat-img-wrapper .material-icons-round { font-size: 38px; color: var(--primary); }
.cat-name { font-size: 0.9rem; font-weight: 900; color: var(--text-main); line-height: 1.3; }

/* ==========================================================================
   9. کارت‌های نسخه
   ========================================================================== */
.rx-list { display: flex; flex-direction: column; gap: 12px; }
.rx-card {
    background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex;
    align-items: center; gap: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.rx-card:active { transform: scale(0.98); }

.rx-icon-box { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rx-icon-box .material-icons-round { color: white; font-size: 24px; }
.bg-blue { background: linear-gradient(135deg, var(--primary), #3B82F6); }
.bg-orange { background: linear-gradient(135deg, #F59E0B, #EF4444); }

.rx-content { flex: 1; min-width: 0; }
.rx-title { font-weight: 900; font-size: 1.05rem; color: var(--text-main); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rx-subtitle { font-size: 0.8rem; color: var(--text-mid); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.copy-rx-btn { position: absolute; top: 16px; left: 16px; background: var(--surface-hover); border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 8px; z-index: 10; }
.copy-rx-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.content-title-area { position: relative; margin-bottom: 24px; border-bottom: 2px solid var(--primary-light); padding-bottom: 16px; text-align: center; }
.single-floating-btn { position: absolute; top: 0; background: var(--surface-hover); border: 1px solid var(--border); width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-main); cursor: pointer; transition: all 0.2s; }
.single-floating-btn:hover { background: var(--primary-light); color: var(--primary); }
.btn-left { left: 0; } .btn-right { right: 0; }

.clinical-accordion { background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); position: relative; z-index: 2; }
.acc-header { padding: 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; background: var(--surface); transition: background 0.2s; }
.acc-header.active { background: var(--surface-hover); border-bottom: 1px solid var(--border); }
.acc-icon { color: var(--primary); font-size: 22px; }
.acc-title { flex: 1; font-weight: 900; font-size: 0.95rem; color: var(--text-main); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), padding 0.4s ease; padding: 0 16px; font-size: 0.95rem; color: var(--text-mid); line-height: 1.8; }
.acc-body.open { max-height: 5000px; padding: 16px; transition: max-height 0.5s ease-in-out, padding 0.5s ease; }

/* ==========================================================================
   10. نظرات
   ========================================================================== */
.comment-item { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); position: relative; box-shadow: var(--shadow-sm); }
.comment-item.is-pick { border: 2px solid var(--gold); }
.pick-badge { position: absolute; top: -12px; right: 16px; background: var(--gold); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 0.7rem; font-weight: 900; box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3); }
.comment-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.comment-author-info { display: flex; align-items: center; gap: 10px; }
.comment-author-avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--primary-light); object-fit: cover; }
.comment-author-name { font-weight: 900; font-size: 0.9rem; color: var(--text-main); transition: color 0.2s; }
a .comment-author-name:hover { color: var(--primary); }
.comment-date { font-size: 0.75rem; color: var(--text-light); font-weight: 600; }
.comment-body { font-size: 0.95rem; color: var(--text-mid); line-height: 1.7; font-weight: 600; }

.form-group { margin-bottom: 16px; text-align: right; }
.form-input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-hover); color: var(--text-main); font-family: inherit; font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--primary); background: var(--surface); }

/* ==========================================================================
   11. المان‌های UI، دکمه‌ها و آواتار
   ========================================================================== */
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-main); transition: background 0.2s; }
.icon-btn:active { background: var(--surface-hover); }

.auth-btn { width: 100%; background: var(--primary); color: white; border: none; padding: 14px; border-radius: 12px; font-size: 1rem; font-weight: 900; font-family: inherit; cursor: pointer; transition: background 0.2s, transform 0.1s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-btn:active { transform: scale(0.98); }

/* اصلاح سایز و دایره بودن عکس پروفایل در سایدبار */
.avatar-upload-box {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
    border-radius: 50%;
}

.profile-avatar {
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid var(--primary);
    background: var(--surface-hover);
    display: block;
    margin: 0 auto;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: var(--shadow-sm);
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); font-weight: 700; font-size: 0.95rem; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 24px auto; }
.spinner-inline { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle; }
.spinner-inline.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.memoral-pagination { margin-top: 20px; text-align: center; }
.memoral-pagination .page-numbers { display: inline-block; padding: 6px 12px; margin: 0 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-weight: 700; font-size: 0.9rem; transition: background 0.2s; }
.memoral-pagination .page-numbers.current { background: var(--primary); color: white; border-color: var(--primary); }
.memoral-pagination .page-numbers:hover:not(.current) { background: var(--surface-hover); }

.toast { position: fixed; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px); left: 50%; transform: translateX(-50%) translateY(100px); background: #334155; color: white; padding: 12px 24px; border-radius: 30px; font-size: 0.85rem; font-weight: 800; z-index: 3000; opacity: 0; transition: all 0.3s; box-shadow: var(--shadow-md); white-space: nowrap; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ==========================================================================
   12. رسپانسیو و معماری دسکتاپ 3 ستونه
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    .cat-circle-grid { grid-template-columns: repeat(4, 1fr); }
    #app-container { max-width: 700px; }
}

@media (min-width: 1024px) {
    /* عرض سایدبارها اکیداً روی یک مقدار مساوی ثابت می‌شود */
    .sidebar { width: var(--sidebar-w) !important; max-width: 100vw; }
    
    header { left: var(--sidebar-w); right: var(--sidebar-w); width: auto; }
    
    .header-top { padding-bottom: 20px; padding-top: 20px; }
    
    .sidebar-right { transform: translateX(0); border-left: 1px solid var(--border); }
    .sidebar-left { transform: translateX(0); border-right: 1px solid var(--border); }
    
    #app-container {
        margin-left: var(--sidebar-w);
        margin-right: var(--sidebar-w);
        max-width: none;
        width: auto;
        padding-top: 100px;
        padding-bottom: 40px;
        position: relative;
        z-index: 1; 
    }
    
    .bottom-nav { display: none; }
    .overlay { display: none !important; }
    .hide-on-desktop, .close-btn-mobile { display: none !important; }
    
    .hide-on-mobile { display: flex; flex-direction: column;}
    
    .cat-circle-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
    .cat-img-wrapper { width: 95px; height: 95px; }
    .cat-img-wrapper .material-icons-round { font-size: 42px; }
    
    .toast { bottom: 40px; }
}
/* ================================================================
   SINGLE PAGE — Prescription Display & Clinical Accordions
   ================================================================ */

/* ---- بولت‌ها و لیست‌های داخل آکاردئون ---- */
.acc-body ul,
.acc-body ol {
    padding-right: 20px;
    padding-left: 0;
    margin: 8px 0;
}
.acc-body ul { list-style: none; }
.acc-body ul li { position: relative; padding-right: 16px; margin-bottom: 6px; }
.acc-body ul li::before {
    content: '';
    position: absolute;
    right: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.acc-body ol { list-style: none; counter-reset: acc-counter; }
.acc-body ol li {
    counter-increment: acc-counter;
    position: relative;
    padding-right: 28px;
    margin-bottom: 8px;
}
.acc-body ol li::before {
    content: counter(acc-counter);
    position: absolute;
    right: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- هدر آکاردئون با دکمه کپی ---- */
.acc-header { padding: 14px 16px; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; background: var(--surface); transition: background 0.2s; position: relative; }
.acc-header.active { background: var(--surface-hover); border-bottom: 1px solid var(--border); }
.acc-copy-btn {
    margin-right: auto;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    font-size: 16px;
}
.acc-copy-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.acc-copy-btn .material-icons-round { font-size: 17px; }

/* ---- پروتکل درمانی ---- */
.memoral-rx-protocols { display: flex; flex-direction: column; gap: 0; }

.rx-protocol-or {
    text-align: center;
    font-weight: 900;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--accent);
    padding: 12px 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rx-protocol-or::before,
.rx-protocol-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ---- هر آیتم دارو ---- */
.rx-item {
    direction: ltr;
    text-align: left;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

/* شماره + نام دارو */
.rx-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.rx-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 5px;
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 900;
    flex-shrink: 0;
}
.rx-item-name {
    font-weight: 900;
    font-size: 1rem;
    color: var(--text-main);
    flex: 1;
}
.rx-dose {
    font-size: 0.85em;
    color: var(--text-mid);
    font-weight: 700;
}
.rx-item-qty {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: 900;
    flex-shrink: 0;
    direction: ltr;
}

/* دستور + نکات */
.rx-item-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.rx-item-instruction {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 700;
    direction: ltr;
}
.rx-item-instruction .material-icons-round { font-size: 17px; color: var(--success); flex-shrink: 0; margin-top: 1px; }

.rx-item-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-mid);
    font-weight: 600;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: 6px;
    padding: 6px 8px;
    direction: rtl;
    text-align: right;
}
.rx-item-note .material-icons-round { font-size: 15px; color: var(--warning-icon); flex-shrink: 0; margin-top: 1px; }

/* ---- جایگزین‌های دارو ---- */
.rx-alternatives {
    border-top: 1px dashed var(--border);
    margin: 0;
    padding: 10px 14px 12px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rx-alt-label {
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.rx-alt-label::before,
.rx-alt-label::after { content: ''; flex: 1; height: 1px; background: rgba(255, 107, 107, 0.15); }

.rx-alt-item {
    direction: ltr;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rx-alt-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rx-alt-name {
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--text-main);
    flex: 1;
}
.rx-alt-qty {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--surface-hover);
    color: var(--text-mid);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 0.78rem;
    font-weight: 800;
}
.rx-alt-instruction {
    font-size: 0.82rem;
    color: var(--text-mid);
    font-weight: 600;
    direction: rtl;
}

/* ---- قفل VIP ---- */
.vip-lock-overlay {
    text-align: center;
    padding: 28px 16px;
    background: var(--warning-bg);
    border-radius: 14px;
    border: 2px dashed var(--warning-border);
    margin: 4px 0;
}

/* ================================================================
   PRIORITY MEDIUM — Extracted from inline styles
   ================================================================ */

/* ---- content-title-area ---- */
.content-title-area {
    position: relative;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 16px;
    text-align: center;
}
.content-main-title {
    font-size: 1.4rem;
    font-weight: 950;
    color: var(--text-main);
    margin-bottom: 8px;
    padding: 0 50px;
    line-height: 1.4;
    word-break: break-word;
}
.content-sub-title {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    margin-top: 6px;
}

/* ---- section-header ---- */
.section-header { margin-bottom: 14px; }
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-main);
    margin: 0;
}

/* ---- single-floating-btn ---- */
.single-floating-btn {
    position: absolute;
    top: 0;
    z-index: 2;
}
.btn-right { right: 0; }
.btn-left  { left: 0; }

/* ---- صفحه پروفایل ---- */
.profile-stat-card {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: border-color 0.2s;
}
.profile-stat-card:hover { border-color: var(--primary); }
.profile-stat-num   { font-size: 1.4rem; font-weight: 950; }
.profile-stat-label { font-size: 0.78rem; color: var(--text-mid); font-weight: 700; margin-top: 2px; display: flex; align-items: center; justify-content: center; gap: 4px; }

/* ---- VIP badge ---- */
.vip-badge {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---- empty-state ---- */
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
}

/* ---- pick-badge ---- */
.pick-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gold);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* ---- is-pick کامنت ---- */
.comment-item.is-pick {
    border-color: var(--gold) !important;
    background: var(--warning-bg) !important;
}

/* ---- پروتکل‌های نسخه - اضافه ---- */
.rx-dose {
    font-size: 0.85em;
    color: var(--text-mid);
    font-weight: 700;
}

/* ---- dark mode overrides ---- */
/* dark mode overrides moved to CSS variables */

/* ================================================================
   DARK MODE — Component-level overrides
   (متغیرهای semantic کافی نیستن، اینجا تنظیمات بصری اضافه داریم)
   ================================================================ */

/* ---- rx-item (پس‌زمینه کارت داروها) ---- */
[data-theme="dark"] .rx-item {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .rx-item-header {
    background: var(--surface-raised);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .rx-alt-item {
    background: var(--surface-hover);
    border-color: var(--border);
}
[data-theme="dark"] .rx-alternatives {
    background: var(--bg);
}

/* ---- آکاردئون ---- */
[data-theme="dark"] .acc-header { background: var(--surface); }
[data-theme="dark"] .acc-header.active { background: var(--surface-hover); }
[data-theme="dark"] .acc-body { background: var(--surface); }

/* ---- کامنت‌ها ---- */
[data-theme="dark"] .comment-item {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .comment-item.is-pick {
    background: rgba(var(--gold-rgb), 0.06) !important;
    border-color: rgba(var(--gold-rgb), 0.35) !important;
}
[data-theme="dark"] .pick-badge {
    background: rgba(var(--gold-rgb), 0.85);
}

/* ---- فرم‌ها و input ها ---- */
[data-theme="dark"] .form-input {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-main);
}
[data-theme="dark"] .form-input:focus {
    background: var(--surface);
    border-color: var(--primary);
}
[data-theme="dark"] .ep-radio-row {
    background: var(--surface-hover);
    border-color: var(--border);
}
[data-theme="dark"] .ep-radio-row:has(input:checked) {
    background: var(--info-bg);
    border-color: var(--primary);
}

/* ---- auth sidebar ---- */
[data-theme="dark"] .sb-auth-tabs { background: var(--surface-hover); }
[data-theme="dark"] .sb-tab-btn.active {
    background: var(--surface);
    color: var(--primary);
}
[data-theme="dark"] .sb-input-wrap .form-input {
    background: var(--surface-hover);
}

/* ---- دسته‌بندی‌ها ---- */
[data-theme="dark"] .cat-item { background: var(--surface); }
[data-theme="dark"] .cat-img-wrapper {
    background: var(--surface-hover);
    border-color: var(--border);
}
[data-theme="dark"] .cat-name { color: var(--text-main); }

/* ---- rx-card ---- */
[data-theme="dark"] .rx-card {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .rx-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

/* ---- clinical accordion body content ---- */
[data-theme="dark"] .acc-body p,
[data-theme="dark"] .acc-body li,
[data-theme="dark"] .acc-body div { color: var(--text-main); }

/* ---- bottom-nav ---- */
[data-theme="dark"] .bottom-nav {
    background: var(--surface);
    border-top-color: var(--border);
}
[data-theme="dark"] .nav-item { color: var(--text-light); }
[data-theme="dark"] .nav-item.active { color: var(--primary); }

/* ---- header ---- */
[data-theme="dark"] #main-site-header {
    background: var(--surface);
    border-bottom-color: var(--border);
}
[data-theme="dark"] .search-wrapper {
    background: var(--surface-hover);
    border-color: var(--border);
}
[data-theme="dark"] .search-input { color: var(--text-main); }
[data-theme="dark"] .live-search-dropdown {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="dark"] .search-res-item:hover { background: var(--surface-hover); }

/* ---- sidebar ---- */
[data-theme="dark"] .sidebar { background: var(--surface); }
[data-theme="dark"] .sidebar-link { color: var(--text-main); }
[data-theme="dark"] .sidebar-link:hover { background: var(--surface-hover); }

/* ---- spinner ---- */
[data-theme="dark"] .spinner { border-color: var(--border); border-top-color: var(--primary); }

/* ---- empty-state ---- */
[data-theme="dark"] .empty-state { background: var(--surface); border-color: var(--border); }

/* ---- toast ---- */
[data-theme="dark"] .toast { background: var(--surface-raised); color: var(--text-main); border: 1px solid var(--border); }

/* ---- section-title icon colors ---- */
[data-theme="dark"] .acc-icon { color: var(--primary); }

/* ---- scrollbar (webkit) ---- */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--surface-hover); border-color: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ================================================================
   DARK MODE — Complete Component Coverage
   ================================================================ */

/* ---- transition smooth برای تم‌سوئیچ ---- */
*,
*::before,
*::after {
    transition:
        background-color 0.2s ease,
        border-color     0.2s ease,
        color            0.1s ease,
        box-shadow       0.2s ease;
}
/* جلوگیری از transition روی چیزهایی که نباید ---- */
.material-icons-round,
img,
svg,
.spinner,
.spinner-inline,
.acc-body,
.clinical-accordion,
input,
textarea {
    transition: none !important;
}
/* فقط border و bg برای input ها ---- */
input, textarea, select {
    transition: border-color 0.2s ease, background-color 0.2s ease !important;
}

/* ---- VIP lock overlay ---- */
[data-theme="dark"] .vip-lock-overlay {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}
[data-theme="dark"] .vip-lock-overlay p {
    color: var(--text-main) !important;
}

/* ---- VIP badge (header نسخه) ---- */
[data-theme="dark"] .vip-badge,
[data-theme="dark"] [style*="background:#FFFBEB"] {
    background: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    border-color: var(--warning-border) !important;
}

/* ---- rx-item-note (نکات دارویی) ---- */
[data-theme="dark"] .rx-item-note {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}
[data-theme="dark"] .rx-item-note .material-icons-round {
    color: var(--warning-icon) !important;
    transition: none !important;
}

/* ---- rx-item-instruction ---- */
[data-theme="dark"] .rx-item-instruction {
    color: var(--text-main);
}

/* ---- rx-counter ---- */
[data-theme="dark"] .rx-counter {
    background: var(--primary);
}

/* ---- rx-item-qty ---- */
[data-theme="dark"] .rx-item-qty {
    background: var(--info-bg);
    color: var(--info-text);
}

/* ---- rx-alt-qty ---- */
[data-theme="dark"] .rx-alt-qty {
    background: var(--surface-raised);
    color: var(--text-mid);
}

/* ---- rx-protocol-or ---- */
[data-theme="dark"] .rx-protocol-or {
    color: var(--accent);
}
[data-theme="dark"] .rx-protocol-or::before,
[data-theme="dark"] .rx-protocol-or::after {
    background: var(--border);
}

/* ---- rx-alt-label (OR جایگزین دارو) ---- */
[data-theme="dark"] .rx-alt-label {
    color: var(--accent);
}
[data-theme="dark"] .rx-alt-label::before,
[data-theme="dark"] .rx-alt-label::after {
    background: rgba(248, 113, 113, 0.2);
}

/* ---- acc-copy-btn ---- */
[data-theme="dark"] .acc-copy-btn {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-light);
}
[data-theme="dark"] .acc-copy-btn:hover {
    background: var(--info-bg);
    color: var(--primary);
    border-color: var(--primary);
}

/* ---- کلینیکال متاباکس (ادمین) ---- */
[data-theme="dark"] .memoral-field-wrap {
    border-color: var(--border);
}
[data-theme="dark"] .memoral-field-header {
    background: var(--surface-hover);
    border-bottom-color: var(--border);
}

/* ---- profile cards ---- */
[data-theme="dark"] .profile-stat-card {
    background: var(--surface-hover);
    border-color: var(--border);
}
[data-theme="dark"] .profile-stat-card:hover {
    border-color: var(--primary);
}

/* ---- auth-btn ---- */
[data-theme="dark"] .auth-btn {
    background: var(--primary);
    color: #fff;
}
[data-theme="dark"] .auth-btn:hover {
    background: var(--primary-dark);
}

/* ---- icon-btn ---- */
[data-theme="dark"] .icon-btn {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-main);
}
[data-theme="dark"] .icon-btn:hover {
    background: var(--surface-raised);
}

/* ---- sb-msg در dark ---- */
[data-theme="dark"] .sb-msg.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}
[data-theme="dark"] .sb-msg.success {
    background: rgba(var(--success-rgb), 0.12);
    color: var(--success);
    border-color: rgba(var(--success-rgb), 0.3);
}

/* ---- status badge ---- */
[data-theme="dark"] .status-badge {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-mid);
}
[data-theme="dark"] .status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.25);
}

/* ---- pagination ---- */
[data-theme="dark"] .memoral-pagination .page-numbers {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-main);
}
[data-theme="dark"] .memoral-pagination .page-numbers.current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---- clinical accordion — content typography ---- */
[data-theme="dark"] .acc-body h1,
[data-theme="dark"] .acc-body h2,
[data-theme="dark"] .acc-body h3,
[data-theme="dark"] .acc-body h4,
[data-theme="dark"] .acc-body strong,
[data-theme="dark"] .acc-body b {
    color: var(--text-main);
}
[data-theme="dark"] .acc-body a {
    color: var(--primary);
}
[data-theme="dark"] .acc-body a:hover {
    color: var(--primary-dark);
}
[data-theme="dark"] .acc-body ol li::before {
    background: var(--info-bg);
    color: var(--primary);
}
[data-theme="dark"] .acc-body ul li::before {
    background: var(--primary);
}

/* ---- section-title icons ---- */
[data-theme="dark"] .section-title .material-icons-round {
    transition: none !important;
}

/* ---- search نتایج در 404 ---- */
[data-theme="dark"] #err-search-results {
    background: var(--surface);
    border-color: var(--border);
}
/* ================================================================
   BOTTOM NAV — 5 items v9.0
   ================================================================ */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--surface, #fff);
        border-top: 1px solid var(--border, #e5e7eb);
        height: 60px;
        align-items: stretch;
        /* RTL: اول سمت راست */
        direction: rtl;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted, #6b7280);
        text-decoration: none;
        font-size: 0;
        position: relative;
        transition: color .15s;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-bottom-nav .nav-item.active,
    .mobile-bottom-nav .nav-item:active {
        color: var(--primary, #2563eb);
    }

    .mobile-bottom-nav .nav-icon {
        font-size: 1.35rem;
        line-height: 1;
    }

    .mobile-bottom-nav .nav-text {
        font-size: 0.6rem;
        line-height: 1;
        white-space: nowrap;
    }

    .mobile-bottom-nav .nav-badge {
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(10px);
        background: var(--primary, #2563eb);
        color: #fff;
        font-size: 0.55rem;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
    }

    /* فاصله پایین صفحه برای bottom nav */
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }
}

/* ================================================================
   LAST UPDATED BAR — نمایش کامل
   ================================================================ */
.last-updated-bar {
    background: var(--surface-2, #f8fafc);
    border-top: 1px solid var(--border, #e5e7eb);
    text-align: center;
    padding: 10px 16px;
    font-size: 0.82rem;
    color: var(--text-muted, #6b7280);
    /* اطمینان از نمایش کامل بالای bottom nav در موبایل */
}

@media (max-width: 768px) {
    .last-updated-bar {
        margin-bottom: 0;
        /* bottom nav با padding-bottom روی body حل میشه */
    }
}
/* ================================================================
   FOOTER — کاملاً مخفی، فقط bottom nav موبایل نمایش داده میشه
   ================================================================ */
.site-footer {
    display: none !important;
}

/* bottom nav فقط موبایل */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 1023px) {
    .mobile-bottom-nav {
        display: flex;
    }
}

/* دسکتاپ — بدون padding پایین اضافه */
@media (min-width: 1024px) {
    body {
        padding-bottom: 0 !important;
    }
}
/* ================================================================
   صفحه اصلی — دسته‌بندی‌ها
   ================================================================ */
.fp-wrap { padding-bottom: 80px; }

.fp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 14px;
}
.fp-section-title .material-icons-round { font-size: 22px; }

/* بلوک هر دسته مادر */
.fp-cat-block { margin-bottom: 22px; }

/* هدر دسته مادر */
.fp-cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1.5px solid var(--primary-light);
    border-radius: 14px;
    text-decoration: none;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: background .2s, border-color .2s;
}
.fp-cat-row:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.fp-cat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fp-cat-icon img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    display: block;
}
.fp-cat-icon .material-icons-round { font-size: 20px; color: var(--primary); }

.fp-cat-name {
    flex: 1;
    font-size: .95rem;
    font-weight: 900;
    color: var(--text-main);
    min-width: 0;
}
.fp-cat-badge {
    font-size: .72rem;
    font-weight: 900;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 9px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.fp-cat-arrow {
    font-size: 16px !important;
    color: var(--text-light);
    flex-shrink: 0;
}

/* گرید زیردسته‌ها */
.fp-kids-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (min-width: 400px) { .fp-kids-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 580px) { .fp-kids-grid { grid-template-columns: repeat(5, 1fr); } }

.fp-kid {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 12px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    overflow: hidden;
    transition: transform .15s, border-color .2s;
    min-width: 0;
}
.fp-kid:active { transform: scale(.95); }
.fp-kid:hover  { border-color: var(--primary); }

.fp-kid-img {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fp-kid-img img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    display: block;
}
.fp-kid-img .material-icons-round { font-size: 22px; color: var(--primary); opacity: .5; }

.fp-kid-name {
    font-size: .73rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    line-height: 1.35;
    word-break: break-word;
}
.fp-kid-count {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--primary);
    color: #fff;
    font-size: .6rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 7px;
    line-height: 1.6;
}

/* ================================================================
   صفحه اصلی — دسته‌بندی‌ها
   ================================================================ */
.fp-wrap { padding-bottom: 80px; }

.fp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 14px;
}
.fp-section-title .material-icons-round { font-size: 22px; }

/* بلوک هر دسته مادر */
.fp-cat-block { margin-bottom: 22px; }

/* هدر دسته مادر */
.fp-cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1.5px solid var(--primary-light);
    border-radius: 14px;
    text-decoration: none;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: background .2s, border-color .2s;
}
.fp-cat-row:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.fp-cat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.fp-cat-icon img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    display: block;
}
.fp-cat-icon .material-icons-round { font-size: 20px; color: var(--primary); }

.fp-cat-name {
    flex: 1;
    font-size: .95rem;
    font-weight: 900;
    color: var(--text-main);
    min-width: 0;
}
.fp-cat-badge {
    font-size: .72rem;
    font-weight: 900;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 9px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.fp-cat-arrow {
    font-size: 16px !important;
    color: var(--text-light);
    flex-shrink: 0;
}

/* گرید زیردسته‌ها */
.fp-kids-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (min-width: 400px) { .fp-kids-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 580px) { .fp-kids-grid { grid-template-columns: repeat(5, 1fr); } }

.fp-kid {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 12px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    overflow: hidden;
    transition: transform .15s, border-color .2s;
    min-width: 0;
}
.fp-kid:active { transform: scale(.95); }
.fp-kid:hover  { border-color: var(--primary); }

.fp-kid-img {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fp-kid-img img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    display: block;
}
.fp-kid-img .material-icons-round { font-size: 22px; color: var(--primary); opacity: .5; }

.fp-kid-name {
    font-size: .73rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    line-height: 1.35;
    word-break: break-word;
}
.fp-kid-count {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--primary);
    color: #fff;
    font-size: .6rem;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 7px;
    line-height: 1.6;
}

/* ================================================================
   هیرو DDx
   ================================================================ */
.ddx-hero {
    position: relative;
    border-radius: 20px;
    overflow: visible;
    margin-bottom: 24px;
    padding: 28px 20px 24px;
    background: linear-gradient(135deg, #0a7a70 0%, #0d9488 50%, #14b8a6 100%);
}
.ddx-hero-bg {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
    pointer-events: none;
}
.ddx-hero-content { position: relative; z-index: 1; }

.ddx-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: .75rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
}
.ddx-hero-badge .material-icons-round { font-size: 15px; }

.ddx-hero-title {
    font-size: 1.35rem;
    font-weight: 950;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}
.ddx-hero-sub {
    font-size: .82rem;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
    margin: 0 0 18px;
    line-height: 1.6;
}

/* ---- input ---- */
.ddx-hero-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 14px;
    padding: 0 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 14px;
    z-index: 10;
}
.ddx-hero-input-wrap .material-icons-round { color: var(--primary); font-size: 20px; flex-shrink: 0; }
.ddx-hero-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 10px;
    font-family: inherit;
    font-size: .92rem;
    color: #1E293B;
    outline: none;
    min-width: 0;
}
.ddx-hero-input::placeholder { color: #94A3B8; }

/* ---- dropdown پیشنهادها ---- */
.ddx-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: none;
}
.ddx-suggestions.show { display: block; }

.ddx-sug-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 700;
    color: #1E293B;
    border-bottom: 1px solid #F1F5F9;
    background: #fff;
    transition: background .15s;
}
.ddx-sug-item:last-child { border-bottom: none; }
.ddx-sug-item:hover { background: #F0FDFA; color: var(--primary); }
.ddx-sug-item .material-icons-round { font-size: 17px; color: var(--primary); flex-shrink: 0; }
.ddx-sug-count {
    margin-right: auto;
    font-size: .72rem;
    color: #94A3B8;
    font-weight: 600;
    background: #F1F5F9;
    padding: 1px 8px;
    border-radius: 8px;
}

/* ---- chips علائم انتخاب‌شده — روی پس‌زمینه سبز ---- */
.ddx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.ddx-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.25);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    padding: 6px 14px 6px 8px;
    font-size: .85rem;
    font-weight: 800;
    backdrop-filter: blur(4px);
}
.ddx-chip-del {
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 50%;
    transition: background .15s;
}
.ddx-chip-del:hover { background: rgba(255,255,255,0.4); }
.ddx-chip-del .material-icons-round { font-size: 15px; }

/* ---- دکمه جستجو ---- */
.ddx-hero-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transition: transform .15s, box-shadow .15s;
}
.ddx-hero-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.ddx-hero-btn .material-icons-round { font-size: 20px; }

/* ---- نتایج DDx ---- */
.ddx-result-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-main);
    display: block;
    transition: border-color .2s;
}
.ddx-result-item:hover { border-color: var(--primary); }
.ddx-result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ddx-result-title { font-size: .95rem; font-weight: 900; flex: 1; }
.ddx-score-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}
.ddx-matched-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ddx-tag {
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    padding: 2px 10px;
    font-size: .72rem;
    font-weight: 800;
}
.ddx-no-result {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-light);
    font-size: .88rem;
    font-weight: 700;
}

/* ---- دارک مود ---- */
[data-theme="dark"] .ddx-hero-input-wrap { background: var(--surface); }
[data-theme="dark"] .ddx-hero-input { color: var(--text-main); }
[data-theme="dark"] .ddx-hero-input::placeholder { color: var(--text-light); }
[data-theme="dark"] .ddx-hero-btn { background: var(--surface-raised); color: var(--primary); }
[data-theme="dark"] .ddx-suggestions { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .ddx-sug-item { background: var(--surface); color: var(--text-main); border-bottom-color: var(--border); }
[data-theme="dark"] .ddx-sug-item:hover { background: var(--surface-hover); color: var(--primary); }
[data-theme="dark"] .ddx-sug-count { background: var(--surface-hover); color: var(--text-light); }