:root {
    /* پالت رنگی اصلی */
    --primary: #2e86c1;
    --primary-light: #84caf9;
    --secondary: #1deb3c;
    --secondary-hover: #15802a;
    --background-light: #f0f8ff;
    --background-footer: #d4ecfd;
    --background-card: #ffffff;
    --text-primary: #000000;
    --text-secondary: #707070;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-discount: #008000;
    --text-original: #ff0000;
    --border-neutral: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.35);
    --button-mobile: #4f9acd;
    --button-mobile-light: #a2cdeb;
    --support-section: #2e86c1;
    --support-text: #084d7c;
    --primary-hover: #2874b0;
    --primary-light-hover: #84caf9;

    --gradient-primary: linear-gradient(
        90deg,
        var(--primary-light) 0%,
        var(--primary) 100%
    ) !important;

    /* radius */
    --radius-button: 0.5rem;
    /* 8px */
    --radius-button-large: 1rem;
    /* 16px */
    --radius-button-xl: 1.25rem;
    /* 20px */
    --radius-card: 1.125rem;
    /* 18px */
    --radius-circle: 9999px;

    /* layout tokens */
    --panel-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);

    /* misc */
    --ring: 0 0 0 4px rgba(46, 134, 193, 0.12);
}

* {
    box-sizing: border-box;
}

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

img {
    max-width: 100%;
    display: block;
}

.rahnama-wrap {
    direction: rtl;
    font-family: Vazirmatn, Vazir, IRANSans, Tahoma, Arial, sans-serif;
    background: var(--background-light);
    padding: 18px;
    height: 100vh !important;
}

/* ====== LAYOUT: sidebar | main | sidebar ====== */
.rahnama-main-container {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 240px;
    gap: 16px;
    max-width: 1800px;
    margin: 0 auto;
    align-items: stretch;
    /* ✅ ارتفاع سایدبارها برابر با محتوای اصلی */
}

/* main card */
.rahnama-card {
    width: 100%;
    background: var(--background-card);
    border: 1px solid var(--border-neutral);
    border-radius: var(--radius-card);
    box-shadow: var(--panel-shadow);
    overflow: hidden;
    height: 100%;
    /* کمک به هم‌ارتفاعی */
}

.rahnama-header {
    padding: 26px 22px 18px;
    text-align: center;
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        rgba(132, 202, 249, 0.12) 100%
    );
    border-bottom: 1px solid var(--border-neutral);
}

.rahnama-title {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 900;
}

.rahnama-subtitle {
    margin: 0 0 18px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.9;
}

/* alert */
.rahnama-alert {
    margin: 0 auto;
    max-width: 980px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: right;
    background: #fffbeb;
    border: 1px solid rgba(245, 158, 11, 0.22);
    color: #92400e;
    padding: 14px;
    border-radius: 12px;
    line-height: 1.9;
    font-size: 14px;
}

.rahnama-alert .icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
    margin-top: 2px;
}

.rahnama-alert .icon svg {
    width: 18px;
    height: 18px;
}

.rahnama-alert strong {
    font-weight: 900;
    margin-left: 6px;
}

/* =========================
   بنر/پروموی به‌نوبه
   ========================= */
.rahnama-benobe-section {
    max-width: 980px;
    margin: 18px auto 0;
}

.rahnama-benobe-box {
    display: grid;
    grid-template-columns: auto 2px 1fr;
    gap: 24px;
    align-items: start;
    text-align: right;
    padding: 14px 18px;
}

.rahnama-benobe-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.rahnama-benobe-logo {
    display: inline-block;
    text-decoration: none;
    animation: floatLogo 3s ease-in-out infinite;
    margin-top: 15px;
}

.rahnama-benobe-logo img {
    width: 115px;
    height: auto;
    filter: drop-shadow(0 10px 16px rgba(46, 134, 193, 0.18));
}

.rahnama-benobe-home-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    padding: 7px 14px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-button);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
        color 0.2s ease;
}

.rahnama-benobe-home-link:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 134, 193, 0.25);
}

.rahnama-divider {
    width: 2px;
    height: 100%;
    min-height: 120px;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(46, 134, 193, 0.85),
        transparent
    );
    opacity: 0.35;
    border-radius: 8px;
}

.rahnama-benobe-right {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
}

.rahnama-benobe-text {
    margin: -2px 0 6px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.9;
    letter-spacing: 0.3px;
    text-align: center;
}

.rahnama-benobe-subtext {
    margin: 0 0 12px;
    width: 100%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.9;
    font-weight: 900;
    letter-spacing: 0.2px;
}

.rahnama-benobe-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: var(--gradient-primary);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 900;
    border-radius: var(--radius-button-large);
    box-shadow: 0 12px 26px rgba(46, 134, 193, 0.28);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    white-space: nowrap;
}

.rahnama-benobe-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(46, 134, 193, 0.38);
    filter: saturate(1.05);
}

.rahnama-benobe-button:active {
    transform: translateY(-1px);
}

.rahnama-benobe-button-hand {
    display: inline-block;
    animation: pointDown 1s ease-in-out infinite;
    font-size: 18px;
}

@keyframes floatLogo {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes pointDown {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(4px);
    }
}

/* =========================
   سایدبار پزشکان (هم‌ارتفاع با main)
   ========================= */
.rahnama-doctors-section {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(46, 134, 193, 0.14);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.rahnama-doctors-title {
    text-align: center;
    font-size: 13px;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
    padding: 12px 10px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(46, 134, 193, 0.12);
}

/* مهم: اسکرول داخلی تا ارتفاع سایدبار با main یکی بماند */
.rahnama-doctors-grid {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    height: 100vh;
    /* تغییر به hidden برای جلوگیری از اسکرول دستی و استفاده از انیمیشن */
}

/* اسکرول‌بار ظریف (اختیاری، سازگار) */
.rahnama-doctors-grid::-webkit-scrollbar {
    width: 8px;
}

.rahnama-doctors-grid::-webkit-scrollbar-thumb {
    background: rgba(46, 134, 193, 0.25);
    border-radius: 999px;
}

.rahnama-doctors-grid::-webkit-scrollbar-track {
    background: transparent;
}

.rahnama-doctors-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: infinite-scroll-vertical 20s linear infinite;
    /* انیمیشن اسکرول بی‌نهایت عمودی */
}

/* توقف انیمیشن هنگام hover روی سایدبار */
.rahnama-doctors-section:hover .rahnama-doctors-list {
    animation-play-state: paused;
}

@keyframes infinite-scroll-vertical {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }
}

.rahnama-doctor-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: var(--background-card);
    border: 1px solid rgba(46, 134, 193, 0.14);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease,
        border-color 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.rahnama-doctor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(46, 134, 193, 0.14);
    border-color: rgba(46, 134, 193, 0.35);
}

.rahnama-doctor-image-wrapper {
    width: 100%;
    height: 170px;
    /* افزایش ارتفاع کارت‌ها (تصویر بزرگ‌تر) */
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        rgba(132, 202, 249, 0.28) 0%,
        rgba(46, 134, 193, 0.1) 100%
    );
    display: grid;
    place-items: center;
    position: relative;
    border: none;
    border-radius: 14px 14px 0 0;
}

.rahnama-doctor-image-wrapper::before {
    content: "👨‍⚕️";
    position: absolute;
    font-size: 18px;
    opacity: 0.25;
    z-index: 0;
}

.rahnama-doctor-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.rahnama-doctor-card:hover .rahnama-doctor-image {
    transform: scale(1.08);
}

.rahnama-doctor-text {
    min-width: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rahnama-doctor-name {
    font-size: 14px;
    /* افزایش فونت برای بزرگ‌تر شدن کارت */
    font-weight: 900;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rahnama-doctor-specialty {
    font-size: 11px;
    /* افزایش جزئی فونت */
    color: var(--text-secondary);
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================
   گرید دکمه‌های مراکز
   ========================= */
.rahnama-body {
    padding: 22px;
}

.rahnama-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rahnama-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-decoration: none;
    background: rgba(132, 202, 249, 0.22);
    border: 1px solid rgba(46, 134, 193, 0.28);
    border-radius: var(--radius-button-large);
    padding: 16px 14px;
    color: var(--text-primary);
    transition: transform 0.12s ease, box-shadow 0.12s ease,
        border-color 0.12s ease, background 0.12s ease;
}

.rahnama-item a:hover {
    transform: translateY(-2px);
    background: rgba(132, 202, 249, 0.35);
    border-color: rgba(46, 134, 193, 0.55);
    box-shadow: 0 12px 24px rgba(46, 134, 193, 0.12);
}

.rahnama-item .name {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.6;
}

.rahnama-item .tag {
    font-size: 12px;
    color: var(--support-text);
    border: 1px solid rgba(46, 134, 193, 0.22);
    background: rgba(255, 255, 255, 0.78);
    padding: 6px 10px;
    border-radius: var(--radius-circle);
    white-space: nowrap;
}

/* =========================
   فوتر
   ========================= */
.rahnama-footer {
    padding: 24px 22px;
    color: var(--support-text);
    font-size: 13px;
    line-height: 1.9;
    border-top: 1px solid var(--border-neutral);
    background: var(--background-footer);
}

.rahnama-footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
}

.rahnama-footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.rahnama-footer-links a {
    color: var(--support-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: color 0.2s ease;
}

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

.rahnama-footer-center {
    text-align: center;
}

.rahnama-footer-copyright {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 900;
}

.rahnama-footer-social {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
}

.rahnama-footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-circle);
    background: var(--background-card);
    color: var(--primary);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
        color 0.2s ease;
    border: 1px solid var(--border-neutral);
}

.rahnama-footer-social a:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(46, 134, 193, 0.22);
}

.rahnama-footer-social a svg {
    width: 18px;
    height: 18px;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1400px) {
    .rahnama-main-container {
        grid-template-columns: 210px minmax(0, 1fr) 210px;
        gap: 12px;
    }
}

@media (max-width: 1100px) {
    .rahnama-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .rahnama-main-container {
        grid-template-columns: 1fr;
        gap: 18px;
        align-items: start;
    }

    /* تغییر ترتیب: سایدبار راست قبل از محتوای اصلی */
    .rahnama-main-container > .rahnama-doctors-section:first-child {
        order: -1;
    }

    /* در حالت تک‌ستونه: سایدبارها تبدیل به گرید افقی می‌شوند */
    .rahnama-doctors-section {
        height: auto;
    }

    .rahnama-doctors-grid {
        display: flex;
        flex-direction: row;
        overflow: hidden;
        height: 240px;
    }

    /* فعال کردن انیمیشن اسکرول خودکار در موبایل */
    .rahnama-doctors-list {
        flex-direction: row;
        animation: infinite-scroll-horizontal-reverse 20s linear infinite;
        display: flex;
        gap: 10px;
    }

    /* در موبایل: سایدبار چپ را مخفی می‌کنیم (کارت‌هایش با JS به راست اضافه می‌شوند) */
    .rahnama-main-container > .rahnama-doctors-section:last-child {
        display: none;
    }

    @keyframes infinite-scroll-horizontal {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(-50%);
        }
    }

    @keyframes infinite-scroll-horizontal-reverse {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(50%);
        }
    }

    .rahnama-doctor-card {
        width: 200px;
        /* سایز ثابت کارت‌ها برای موبایل و تبلت */
        flex-shrink: 0;
        height: 240px;
    }

    .rahnama-footer-content {
        grid-template-columns: 1fr;
        gap: 18px;
        text-align: center;
    }

    .rahnama-footer-links {
        text-align: center;
    }

    .rahnama-footer-social {
        justify-content: center;
    }
}

@media (max-width: 820px) {
    .rahnama-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rahnama-title {
        font-size: 20px;
    }

    .rahnama-doctors-grid {
        display: flex;
        flex-direction: row;
        overflow: hidden;
    }

    .rahnama-doctors-list {
        flex-direction: row;
        animation: infinite-scroll-horizontal-reverse 20s linear infinite;
        display: flex;
        gap: 10px;
    }

    .rahnama-doctor-card {
        width: 200px;
        /* سایز ثابت */
        flex-shrink: 0;
    }
}

@media (max-width: 720px) {
    .rahnama-benobe-box {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
        gap: 12px;
    }

    .rahnama-divider {
        display: none;
    }

    .rahnama-benobe-right {
        align-items: center;
        width: 100%;
    }

    .rahnama-benobe-text,
    .rahnama-benobe-subtext {
        text-align: center;
    }

    .rahnama-benobe-button {
        width: 100%;
        max-width: 420px;
    }

    .rahnama-doctors-grid {
        display: flex;
        flex-direction: row;
        overflow: hidden;
    }

    .rahnama-doctors-list {
        flex-direction: row;
        animation: infinite-scroll-horizontal-reverse 20s linear infinite;
        display: flex;
        gap: 10px;
    }

    .rahnama-doctor-card {
        width: 200px;
        /* سایز ثابت */
        flex-shrink: 0;
    }
}

@media (max-width: 520px) {
    .rahnama-wrap {
        padding: 12px;
    }

    .rahnama-header {
        padding: 20px 14px 14px;
    }

    .rahnama-body {
        padding: 14px;
    }

    .rahnama-grid {
        grid-template-columns: 1fr;
    }

    .rahnama-item a {
        padding: 14px 12px;
    }

    .rahnama-doctors-grid {
        display: flex;
        flex-direction: row;
        overflow: hidden;
    }

    .rahnama-doctors-list {
        flex-direction: row;
        animation: infinite-scroll-horizontal-reverse 20s linear infinite;
        display: flex;
        gap: 10px;
    }

    .rahnama-doctor-card {
        width: 200px;
        /* سایز ثابت */
        flex-shrink: 0;
    }

    .rahnama-doctors-title {
        font-size: 14px;
        padding: 10px;
    }
}

/* احترام به تنظیمات دسترسی */
@media (prefers-reduced-motion: reduce) {
    .rahnama-benobe-logo {
        animation: none;
    }

    .rahnama-benobe-button-hand {
        animation: none;
    }

    .rahnama-doctors-list {
        animation: none;
    }
}
