/**
 * هوش مصنوعی نوتریپل بالینی - استایل‌ها
 * نسخه: 2.4.0
 * نویسنده: نادین سلامت سورین
 */

/* متغیرهای رنگ */
:root {
    --nutripal-primary: #00C9A7;
    --nutripal-primary-dark: #00A89A;
    --nutripal-secondary: #00B4D8;
    --nutripal-gradient: linear-gradient(135deg, #00C9A7 0%, #00B4D8 50%, #0077B6 100%);
    --nutripal-text: #1a1a2e;
    --nutripal-text-light: #4a4a6a;
    --nutripal-bg: #f8fafc;
    --nutripal-card-bg: #ffffff;
    --nutripal-border: #e2e8f0;
    --nutripal-shadow: 0 10px 40px rgba(0, 201, 167, 0.15);
    --nutripal-shadow-hover: 0 20px 60px rgba(0, 201, 167, 0.25);
    --nutripal-radius: 20px;
    --nutripal-radius-sm: 12px;
    --nutripal-font: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

/* فونت گوگل */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

/* کانتینر اصلی */
.nutripal-container {
    direction: rtl;
    font-family: var(--nutripal-font);
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: var(--nutripal-bg);
    border-radius: var(--nutripal-radius);
    box-shadow: var(--nutripal-shadow);
    position: relative;
    overflow: hidden;
}

/* پس‌زمینه تزئینی */
.nutripal-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(0, 201, 167, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(0, 180, 216, 0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* هدر */
.nutripal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 35px;
    position: relative;
    z-index: 1;
    text-align: center;
    flex-direction: column;
}

.nutripal-logo {
    width: 90px;
    height: 90px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.nutripal-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 20px rgba(0, 201, 167, 0.3));
}

.nutripal-title h1 {
    font-size: 28px;
    font-weight: 800;
    background: var(--nutripal-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.nutripal-subtitle {
    color: var(--nutripal-text-light);
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

/* فرم */
.nutripal-form-wrapper {
    position: relative;
    z-index: 1;
    margin-bottom: 30px;
}

.nutripal-form-card {
    background: var(--nutripal-card-bg);
    padding: 35px;
    border-radius: var(--nutripal-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--nutripal-border);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.nutripal-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--nutripal-gradient);
}

/* آیکون فرم - وسط‌چین */
.form-icon {
    width: 50px;
    height: 50px;
    background: var(--nutripal-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    box-shadow: 0 8px 20px rgba(0, 201, 167, 0.3);
}

.form-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

/* برچسب - وسط‌چین */
.nutripal-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--nutripal-text);
    margin-bottom: 15px;
    line-height: 1.6;
    text-align: center;
}

.nutripal-textarea {
    width: 100%;
    min-height: 140px;
    padding: 20px;
    font-family: var(--nutripal-font);
    font-size: 15px;
    line-height: 1.8;
    border: 2px solid var(--nutripal-border);
    border-radius: var(--nutripal-radius-sm);
    resize: vertical;
    transition: all 0.3s ease;
    background: #fafbfc;
    color: var(--nutripal-text);
    box-sizing: border-box;
    text-align: right;
    direction: rtl;
}

.nutripal-textarea:focus {
    outline: none;
    border-color: var(--nutripal-primary);
    box-shadow: 0 0 0 4px rgba(0, 201, 167, 0.15);
    background: white;
}

.nutripal-textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* === v2.4.0: دکمه‌های جستجوی سریع بیماری‌های پرکاربرد === */
.nutripal-quick-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    direction: rtl;
}

.nutripal-quick-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--nutripal-text-light);
}

.nutripal-quick-label svg {
    width: 15px;
    height: 15px;
    color: var(--nutripal-primary-dark);
}

.nutripal-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-family: var(--nutripal-font);
    font-size: 13px;
    font-weight: 600;
    color: #0f766e;
    background: #f0fdfa;
    border: 1.5px solid #99f6e4;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.nutripal-chip:hover {
    background: var(--nutripal-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 201, 167, 0.35);
}

.nutripal-chip:active {
    transform: translateY(0);
}

/* === v2.4.0: رابط «آیا منظور شما این بود؟» (اصلاح غلط املایی) === */
.nutripal-clarify-box {
    padding: 28px 24px;
    text-align: center;
    direction: rtl;
}

.nutripal-clarify-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #92400e;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1.5px solid #fde68a;
    border-radius: var(--nutripal-radius-sm);
    padding: 12px 18px;
    margin-bottom: 14px;
}

.nutripal-clarify-title svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #d97706;
}

.nutripal-clarify-text {
    font-size: 14px;
    color: var(--nutripal-text-light);
    line-height: 1.8;
    margin-bottom: 18px;
}

.nutripal-clarify-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.nutripal-clarify-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    font-family: var(--nutripal-font);
    font-size: 14px;
    font-weight: 700;
    color: #0f766e;
    background: #f0fdfa;
    border: 2px solid #5eead4;
    border-radius: var(--nutripal-radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
}

.nutripal-clarify-chip:hover {
    background: var(--nutripal-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 201, 167, 0.4);
}

.nutripal-clarify-skip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: var(--nutripal-font);
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    background: #f9fafb;
    border: 1.5px dashed #d1d5db;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.nutripal-clarify-skip:hover {
    color: #374151;
    border-color: #9ca3af;
    background: #f3f4f6;
}

/* موبایل: چیپ‌ها فشرده‌تر */
@media (max-width: 480px) {
    .nutripal-quick-chips {
        gap: 6px;
    }
    .nutripal-chip {
        padding: 5px 11px;
        font-size: 12px;
    }
    .nutripal-clarify-chip {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* دکمه ارسال - وسط‌چین */
.nutripal-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 25px auto 0 auto;
    padding: 16px 40px;
    font-family: var(--nutripal-font);
    font-size: 17px;
    font-weight: 700;
    color: white;
    background: var(--nutripal-gradient);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 201, 167, 0.35);
    position: relative;
    overflow: hidden;
}

.nutripal-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.nutripal-submit-btn:hover::before {
    left: 100%;
}

.nutripal-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 201, 167, 0.45);
}

.nutripal-submit-btn:active {
    transform: translateY(-1px);
}

.nutripal-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s ease;
}

.nutripal-submit-btn:hover .btn-icon svg {
    transform: translateX(-5px);
}

/* بخش نتیجه */
.nutripal-result-container {
    position: relative;
    z-index: 1;
    background: var(--nutripal-card-bg);
    border-radius: var(--nutripal-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--nutripal-border);
    overflow: hidden;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nutripal-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--nutripal-gradient);
    color: white;
    flex-wrap: wrap;
    gap: 15px;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.result-icon {
    width: 28px;
    height: 28px;
}

.nutripal-actions {
    display: flex;
    gap: 12px;
}

.nutripal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--nutripal-font);
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.nutripal-action-btn svg {
    width: 18px;
    height: 18px;
}

/* محتوای نتیجه */
.nutripal-result-content {
    padding: 30px;
    font-size: 15px;
    line-height: 2;
    color: var(--nutripal-text);
    direction: rtl;
    text-align: right;
}

.nutripal-result-content p {
    margin: 0 0 20px 0;
    text-align: right;
    direction: rtl;
}

.nutripal-result-content strong {
    /* v2.3.2: کم‌رنگ‌تر شد تا شبیه تیتر نشود — بولد عادی داخل متن */
    color: #1f2937;
    font-weight: 600;
}

/* v2.3.2: داخل سلول جدول <strong> اگر ناگهان پدیدار شد، کاملاً ساده باشد */
.nutripal-result-content table.nutripal-md-table strong,
.nutripal-result-content table strong {
    color: inherit;
    font-weight: 600;
}

.nutripal-result-content ol,
.nutripal-result-content ul {
    margin: 15px 0;
    padding-right: 25px;
    direction: rtl;
    text-align: right;
}

.nutripal-result-content li {
    margin-bottom: 12px;
    padding-right: 10px;
    position: relative;
    text-align: right;
    direction: rtl;
}

.nutripal-result-content li::marker {
    color: var(--nutripal-primary);
    font-weight: 700;
}

/* عنوان بخش‌ها */
.nutripal-result-content h2,
.nutripal-result-content h3 {
    background: var(--nutripal-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 18px;
    font-weight: 800;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--nutripal-border);
    text-align: right;
    direction: rtl;
}

/* v2.3.4: تیترهای بخش اصلی (p > strong.section-title) — بنر رنگی هم‌راستا با چاپ */
.nutripal-result-content > p > strong.section-title,
.nutripal-result-content > strong.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    margin: 18px 0 10px 0;
    padding: 8px 14px 8px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-right: 4px solid #10b981;
}

/* v2.3.4: واریانت‌های رنگی بخش‌ها (تغذیه سبز / سبک زندگی آبی / پزشکی قرمز / ورزشی بنجفش) */
.nutripal-result-content > p > strong.section-title.section-lifestyle {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-right: 4px solid #3b82f6;
}

.nutripal-result-content > p > strong.section-title.section-medical {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-right: 4px solid #ef4444;
}

.nutripal-result-content > p > strong.section-title.section-exercise {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #5b21b6;
    border-right: 4px solid #8b5cf6;
}

/* v2.3.3: تیتر فرعی (sub-section) — سبک سبز پررنگ، کوچک‌تر از هدر اصلی */
.nutripal-result-content h3.subsection {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: #064e3b;
    font-size: 15px;
    font-weight: 700;
    margin: 18px 0 8px 0;
    padding: 4px 0 4px 10px;
    border-right: 3px solid #10b981;
    border-bottom: none;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(90deg, #ecfdf5 0%, transparent 100%);
    text-align: right;
    direction: rtl;
}

/* یادداشت فوتر */
.nutripal-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 25px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-top: 1px solid var(--nutripal-border);
    font-size: 13px;
    color: #92400e;
    line-height: 1.7;
    text-align: right;
    direction: rtl;
}

.nutripal-footer-note svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* لودینگ */
.nutripal-loading {
    text-align: center;
    padding: 60px 20px;
    position: relative;
    z-index: 1;
}

.loading-animation {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.loading-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--nutripal-gradient);
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-circle:nth-child(1) { animation-delay: 0s; }
.loading-circle:nth-child(2) { animation-delay: 0.2s; }
.loading-circle:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.loading-text {
    font-size: 16px;
    color: var(--nutripal-text-light);
    font-weight: 500;
    margin: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* فوتر برند */
.nutripal-brand-footer {
    text-align: center;
    padding-top: 30px;
    margin-top: 10px;
    border-top: 1px solid var(--nutripal-border);
    position: relative;
    z-index: 1;
}

.nutripal-brand-footer p {
    font-size: 14px;
    color: var(--nutripal-text-light);
    margin: 0;
}

.nutripal-brand-footer strong {
    color: var(--nutripal-primary-dark);
    font-weight: 700;
}

/* پیام کپی موفق */
.nutripal-copy-success {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nutripal-primary);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 201, 167, 0.4);
    z-index: 9999;
    animation: fadeInDown 0.3s ease;
    font-family: var(--nutripal-font);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* رسپانسیو */
@media screen and (max-width: 768px) {
    .nutripal-container {
        margin: 20px;
        padding: 20px;
        border-radius: var(--nutripal-radius-sm);
    }
    
    .nutripal-title h1 {
        font-size: 22px;
    }
    
    .nutripal-form-card {
        padding: 25px;
    }
    
    .nutripal-result-header {
        flex-direction: column;
        text-align: center;
    }
    
    .nutripal-actions {
        width: 100%;
        justify-content: center;
    }
    
    .nutripal-action-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .nutripal-result-content {
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .nutripal-logo {
        width: 70px;
        height: 70px;
    }
    
    .nutripal-title h1 {
        font-size: 20px;
    }
    
    .nutripal-subtitle {
        font-size: 13px;
    }
    
    .nutripal-submit-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 30px;
    }
}

/* پیام نیاز به ورود */
.nutripal-login-required {
    direction: rtl;
    text-align: center;
    font-family: var(--nutripal-font);
    max-width: 600px;
    margin: 40px auto;
    padding: 40px 30px;
    background: var(--nutripal-card-bg);
    border-radius: var(--nutripal-radius);
    box-shadow: var(--nutripal-shadow);
    border: 1px solid var(--nutripal-border);
}

.nutripal-login-required p {
    font-size: 17px;
    color: var(--nutripal-text);
    line-height: 1.8;
    margin: 0;
}

.nutripal-login-required p::before {
    content: '🔒';
    display: block;
    font-size: 48px;
    margin-bottom: 15px;
}

/* فرم پروفایل کاربر */
.nutripal-profile-form {
    text-align: right;
    direction: rtl;
}

.nutripal-form-row {
    margin-bottom: 22px;
    text-align: right;
}

.nutripal-input {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--nutripal-font);
    font-size: 15px;
    line-height: 1.8;
    border: 2px solid var(--nutripal-border);
    border-radius: var(--nutripal-radius-sm);
    background: #fafbfc;
    color: var(--nutripal-text);
    box-sizing: border-box;
    text-align: right;
    direction: rtl;
    transition: all 0.3s ease;
}

.nutripal-input:focus {
    outline: none;
    border-color: var(--nutripal-primary);
    box-shadow: 0 0 0 4px rgba(0, 201, 167, 0.15);
    background: white;
}

.nutripal-label {
    text-align: right !important;
}

.required {
    color: #ef4444;
    font-weight: 700;
}

.nutripal-input-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 6px 0 0 0;
}

.nutripal-profile-message {
    padding: 12px 16px;
    border-radius: var(--nutripal-radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    text-align: right;
    direction: rtl;
}

.nutripal-profile-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.nutripal-profile-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* مدال ادمین */
.nutripal-modal {
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    direction: rtl;
}

.nutripal-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.nutripal-modal-close {
    position: absolute;
    left: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.nutripal-modal-close:hover {
    color: #ef4444;
}

.nutripal-modal-content h3 {
    margin: 0 0 25px 0;
    color: #00A89A;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
    font-size: 20px;
    text-align: right;
}

.nutripal-modal-field {
    margin-bottom: 18px;
    text-align: right;
}

.nutripal-modal-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1a1a2e;
    text-align: right;
}

.nutripal-modal-actions {
    margin-top: 25px;
    text-align: left;
}

.nutripal-edit-message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 13px;
}

.nutripal-edit-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.nutripal-edit-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* مدال پرسش نام بیمار قبل از چاپ */
.nutripal-patient-modal {
    z-index: 100000;
}

.nutripal-patient-modal-content {
    max-width: 460px;
    padding: 30px 28px 25px 28px;
    text-align: center;
}

.nutripal-patient-modal-icon {
    font-size: 42px;
    margin-bottom: 10px;
    line-height: 1;
}

.nutripal-patient-modal-content h3 {
    margin: 0 0 12px 0;
    color: #00A89A;
    font-size: 19px;
    font-weight: 700;
    border: none;
    padding: 0;
    text-align: center;
}

.nutripal-patient-modal-desc {
    color: #4a4a6a;
    font-size: 13px;
    line-height: 1.7;
    margin: 0 0 20px 0;
    text-align: center;
}

.nutripal-patient-modal-field {
    margin-bottom: 22px;
    text-align: right;
}

.nutripal-patient-modal-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1a1a2e;
    font-size: 13px;
    text-align: right;
}

.nutripal-patient-modal-field input {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fafbfc;
    color: #1a1a2e;
    box-sizing: border-box;
    text-align: right;
    direction: rtl;
    transition: all 0.2s ease;
}

.nutripal-patient-modal-field input:focus {
    outline: none;
    border-color: #00C9A7;
    box-shadow: 0 0 0 3px rgba(0, 201, 167, 0.15);
    background: white;
}

.nutripal-patient-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.nutripal-patient-modal-actions .button {
    min-width: 110px;
    padding: 8px 16px;
    font-size: 13px;
}

.nutripal-patient-modal-actions .nutripal-btn-cancel {
    background: #f3f4f6;
    color: #4a4a6a;
    border: 1px solid #d1d5db;
}

.nutripal-patient-modal-actions .nutripal-btn-cancel:hover {
    background: #e5e7eb;
}

/* آمار و رهگیری در پنل ادمین */
.nutripal-stats-overview {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.nutripal-stat-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px 25px;
    min-width: 220px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nutripal-stat-label {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.nutripal-stat-value {
    color: #00A89A;
    font-size: 24px;
    font-weight: 700;
}

.nutripal-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.nutripal-badge-active {
    background: #d1fae5;
    color: #065f46;
}

.nutripal-badge-locked {
    background: #fee2e2;
    color: #991b1b;
}

/* پیام کاربر قفل‌شده */
.nutripal-locked-notice {
    direction: rtl;
    text-align: center;
    font-family: var(--nutripal-font);
    max-width: 600px;
    margin: 40px auto;
    padding: 50px 30px;
    background: #fff5f5;
    border: 2px solid #fca5a5;
    border-radius: var(--nutripal-radius);
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.15);
}

.nutripal-locked-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.nutripal-locked-notice h2 {
    color: #991b1b;
    font-size: 22px;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.nutripal-locked-notice p {
    font-size: 15px;
    color: #7f1d1d;
    line-height: 1.8;
    margin: 0 0 10px 0;
}

.nutripal-locked-notice .locked-time {
    font-size: 13px;
    color: #9ca3af;
}

/* استایل چاپ */
@media print {
    body * {
        visibility: hidden;
    }
    
    #nutripal-print-container,
    #nutripal-print-container * {
        visibility: visible;
    }
    
    #nutripal-print-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        direction: rtl;
        font-family: 'Vazirmatn', 'Tahoma', sans-serif;
        padding: 30px;
    }
    
    .print-header {
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 3px solid #00C9A7;
    }
    
    .print-header h1 {
        color: #00C9A7;
        font-size: 24px;
        margin: 0 0 10px 0;
    }
    
    .print-header p {
        color: #666;
        font-size: 14px;
        margin: 0;
    }
    
    .print-content {
        font-size: 14px;
        line-height: 2;
        direction: rtl;
        text-align: right;
    }
    
    .print-content p {
        margin: 0 0 15px 0;
        text-align: right;
        direction: rtl;
    }
    
    .print-content strong {
        color: #00A89A;
    }
    
    .print-content ol,
    .print-content ul {
        margin: 10px 0;
        padding-right: 25px;
        direction: rtl;
        text-align: right;
    }
    
    .print-content li {
        margin-bottom: 8px;
        text-align: right;
        direction: rtl;
    }
    
    .print-footer {
        margin-top: 40px;
        padding-top: 20px;
        border-top: 1px solid #ddd;
        text-align: center;
        font-size: 12px;
        color: #888;
    }
    
    .print-note {
        background: #fffbeb;
        padding: 15px;
        border-radius: 10px;
        margin-top: 30px;
        font-size: 12px;
        color: #92400e;
        border: 1px solid #fde68a;
        text-align: right;
        direction: rtl;
    }
}

/* === پنل اطلاعات تماس === */
.nutripal-contact-panel {
    background: var(--nutripal-card-bg);
    border: 1px solid var(--nutripal-border);
    border-radius: var(--nutripal-radius-sm);
    margin-top: 25px;
    overflow: hidden;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.nutripal-contact-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.nutripal-contact-panel-header:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.nutripal-contact-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0369a1;
    font-weight: 700;
    font-size: 15px;
}

.nutripal-contact-panel-title svg {
    width: 22px;
    height: 22px;
    color: #0284c7;
}

.nutripal-contact-panel-chevron {
    width: 20px;
    height: 20px;
    color: #0284c7;
    transition: transform 0.3s ease;
}

.nutripal-contact-panel.expanded .nutripal-contact-panel-chevron {
    transform: rotate(180deg);
}

.nutripal-contact-panel-body {
    padding: 20px;
    display: none;
}

.nutripal-contact-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.nutripal-summary-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
    text-align: right;
    direction: rtl;
    gap: 10px;
    align-items: flex-start;
}

.nutripal-summary-row:last-child {
    border-bottom: none;
}

.nutripal-summary-label {
    font-weight: 600;
    color: var(--nutripal-text-light);
    min-width: 130px;
    font-size: 14px;
    flex-shrink: 0;
}

.nutripal-summary-value {
    color: var(--nutripal-text);
    font-size: 14px;
    flex: 1;
    line-height: 1.7;
    white-space: pre-wrap;
}

.nutripal-contact-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--nutripal-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: var(--nutripal-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 201, 167, 0.25);
}

.nutripal-contact-edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 201, 167, 0.35);
}

.nutripal-contact-edit-btn svg {
    width: 18px;
    height: 18px;
}

.nutripal-contact-form-wrapper {
    background: #f8fafc;
    border-radius: 10px;
    padding: 18px 20px;
    border: 1px solid #e2e8f0;
    margin-top: 15px;
}

.nutripal-qr-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nutripal-qr-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border: 1.5px dashed #0ea5e9;
    border-radius: 8px;
    font-family: var(--nutripal-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nutripal-qr-upload-btn:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    transform: translateY(-1px);
}

.nutripal-qr-upload-btn svg {
    width: 16px;
    height: 16px;
}

.nutripal-qr-filename {
    font-size: 12px;
    color: var(--nutripal-text-light);
    flex: 1;
    min-width: 150px;
    word-break: break-all;
}

.nutripal-qr-remove-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-family: var(--nutripal-font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nutripal-qr-remove-btn:hover {
    background: #fee2e2;
}

.nutripal-qr-remove-btn svg {
    width: 14px;
    height: 14px;
}

.nutripal-qr-preview {
    margin-top: 12px;
    padding: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: inline-block;
}

.nutripal-qr-preview img {
    max-width: 100px;
    max-height: 100px;
    display: block;
}

.nutripal-contact-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.nutripal-contact-save-btn {
    padding: 10px 24px !important;
    font-size: 14px !important;
    margin: 0 !important;
}

.nutripal-btn-cancel {
    padding: 10px 20px;
    background: #f3f4f6;
    color: var(--nutripal-text-light);
    border: 1px solid #d1d5db;
    border-radius: 50px;
    font-family: var(--nutripal-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nutripal-btn-cancel:hover {
    background: #e5e7eb;
}

/* === استایل دکمه ویرایش فعال === */
.nutripal-action-btn.edit-btn.active {
    background: white;
    color: var(--nutripal-primary-dark);
}

/* === تول‌بار ویرایش === */
.nutripal-edit-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
    border-bottom: 1px solid #d1fae5;
    flex-wrap: wrap;
}

.nutripal-tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: white;
    color: var(--nutripal-primary-dark);
    border: 1px solid #d1fae5;
    border-radius: 6px;
    font-family: var(--nutripal-font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nutripal-tb-btn:hover {
    background: var(--nutripal-primary);
    color: white;
    border-color: var(--nutripal-primary);
}

.nutripal-tb-btn svg {
    width: 14px;
    height: 14px;
}

.nutripal-edit-hint {
    margin-right: auto;
    font-size: 11px;
    color: var(--nutripal-text-light);
    line-height: 1.5;
    max-width: 350px;
    text-align: left;
}

/* === حالت ویرایش محتوا === */
.nutripal-result-content.nutripal-editing {
    outline: 2px dashed var(--nutripal-primary);
    outline-offset: -2px;
    background: #fefffe;
}

.nutripal-result-content.nutripal-editing:focus {
    outline: 2px solid var(--nutripal-primary);
}

.nutripal-editing li {
    cursor: text;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.nutripal-editing li:hover {
    background: rgba(0, 201, 167, 0.06);
}

.nutripal-editing p {
    cursor: text;
}

/* === استایل فیلدهای قفل‌شده === */
.nutripal-input-locked {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: not-allowed;
    border-color: #d1d5db !important;
}

.nutripal-input-hint-locked {
    color: #92400e !important;
    background: #fffbeb;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #fde68a;
    margin-top: 8px !important;
    font-size: 11px !important;
    display: block;
}

/* === رسپانسیو برای پنل اطلاعات تماس === */
@media screen and (max-width: 768px) {
    .nutripal-contact-panel-header {
        padding: 12px 16px;
    }

    .nutripal-contact-panel-title {
        font-size: 14px;
    }

    .nutripal-contact-panel-body {
        padding: 15px;
    }

    .nutripal-summary-label {
        min-width: 100px;
        font-size: 13px;
    }

    .nutripal-summary-value {
        font-size: 13px;
    }

    .nutripal-qr-upload-area {
        flex-direction: column;
        align-items: stretch;
    }

    .nutripal-qr-filename {
        min-width: auto;
    }

    .nutripal-edit-toolbar {
        padding: 8px 12px;
        gap: 6px;
    }

    .nutripal-tb-btn span {
        display: none;
    }

    .nutripal-tb-btn {
        padding: 8px 10px;
    }

    .nutripal-edit-hint {
        max-width: 100%;
        margin-right: 0;
        margin-top: 5px;
    }
}

/* === جداول Markdown (v2.3.1 — فشرده v2.3.4) — نمایش در صفحه === */
.nutripal-result-content table.nutripal-md-table,
.nutripal-result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 10px 0;
    direction: rtl;
    font-size: 12px;
    line-height: 1.4;
    overflow-x: auto;
    display: block;
}

.nutripal-result-content table.nutripal-md-table thead tr,
.nutripal-result-content table thead tr {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.nutripal-result-content table.nutripal-md-table th,
.nutripal-result-content table th {
    border: 1px solid #6ee7b7;
    padding: 4px 8px;
    text-align: right;
    font-weight: 700;
    color: #064e3b;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
}

.nutripal-result-content table.nutripal-md-table td,
.nutripal-result-content table td {
    border: 1px solid #e5e7eb;
    padding: 4px 8px;
    text-align: right;
    vertical-align: top;
    color: #1f2937;
    white-space: normal;
    word-wrap: break-word;
    min-width: 60px;
}

.nutripal-result-content table.nutripal-md-table tbody tr:nth-child(even),
.nutripal-result-content table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.nutripal-result-content table.nutripal-md-table tbody tr:nth-child(odd),
.nutripal-result-content table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.nutripal-result-content table.nutripal-md-table ul,
.nutripal-result-content table ul,
.nutripal-result-content table.nutripal-md-table ol,
.nutripal-result-content table ol {
    margin: 4px 0;
    padding-right: 20px;
}

.nutripal-result-content table.nutripal-md-table li,
.nutripal-result-content table li {
    margin-bottom: 2px;
}

/* واکنش‌گرا برای موبایل */
@media screen and (max-width: 768px) {
    .nutripal-result-content table.nutripal-md-table,
    .nutripal-result-content table {
        font-size: 12px;
    }
    .nutripal-result-content table.nutripal-md-table th,
    .nutripal-result-content table th,
    .nutripal-result-content table.nutripal-md-table td,
    .nutripal-result-content table td {
        padding: 6px 8px;
    }
}
