/* ریست و متغیرها */
:root {
    --primary: #01b5cd; /* رنگ اصلی پروژه */
    --primary-light: #2bcfe5;
    --primary-dark: #019bad;
    --secondary: #FF6B2C;
    --wheat-bg: #d8c4a7; /* رنگ پس‌زمینه برای گندم */
    --rice-bg: #89dff1; /* رنگ پس‌زمینه برای برنج - سفید متمایل به زرد */
    --text-dark: #1A1A1A;
    --text-medium: #666666;
    --text-light: #999999;
    --bg-light: #F8F9FC;
    --bg-white: #FFFFFF;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s ease;
    --header-height: 70px; /* ارتفاع هدر */
    --visualization-height: 240px; /* ارتفاع ثابت برای بخش بصری */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    position: relative;
}

.app-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 100vh;
    background-color: var(--bg-white);
    position: relative;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
}

/* هدر */
.app-header {
    width: 100%;
    height: var(--header-height);
    background-color: var(--bg-white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* اضافه شده برای اطمینان از عدم سرریز تصویر */
}

.header-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    object-position: center;
    background-color: #29277d;

}

/* فاصله برای محتوا تا زیر هدر ثابت */
.content-wrapper {
    padding-top: var(--header-height);
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - var(--header-height));
    overflow-y: visible;
    position: relative;
}

/* بخش بصری */
.visualization-area {
    height: var(--visualization-height);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    padding-top: 20px;
    background-color: var(--bg-white);
}

/* لایه‌های رنگ پس‌زمینه */
.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.8s ease;
}

.wheat-bg {
    background-color: var(--wheat-bg);
    opacity: 1;
    z-index: 1;
}

.rice-bg {
    background-color: var(--rice-bg);
    opacity: 0;
    z-index: 2;
}

.price-tag {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 30px;
    padding: 8px 20px;
    color: white;
    font-weight: 700;
    font-size: 18px;
    z-index: 10;
    position: relative;
}

/* دایره‌های پس‌زمینه */
.ripple-container {
    position: absolute;
    bottom: -95px; /* موقعیت دقیق روی بشقاب */
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 220px;
    z-index: 3;
}

.ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    opacity: 0;
}

/* بشقاب */
.plate-container {
    width: 220px;
    height: 110px; /* نصف ارتفاع بشقاب */
    position: relative;
    overflow: hidden;
    margin-top: auto; /* به پایین کادر می‌چسبد */
    z-index: 5; /* بالاتر از دایره‌های پس‌زمینه */
}

.plate {
    width: 220px;
    height: 220px; /* ارتفاع کامل بشقاب */
    position: absolute;
    bottom: -110px; /* نیمه پایینی بشقاب پنهان می‌شود و قسمت صاف به پایین می‌چسبد */
    left: 0;
    transform-origin: center center; /* نقطه چرخش در مرکز بشقاب */
    transition: transform 0.8s ease;
}

.plate img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* آیکون‌های کاربران */
.users-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    pointer-events: none;
}

.user-icon {
    position: absolute;
    width: 32px;
    height: 32px;
    background-color: #02b5cd; /* رنگ درخواستی */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.5);
    overflow: hidden;
}

.user-svg-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1); /* تبدیل آیکون به رنگ سفید */
}

/* مراحل */
.steps-container {
    padding: 15px 20px;
    background-color: var(--bg-white);
    position: relative;
    z-index: 10;
    margin-top: -20px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
}

.steps-progress {
    height: 4px;
    background-color: #E8EBFF;
    border-radius: 2px;
    position: relative;
    margin-bottom: 15px;
}

.progress-bar {
    position: absolute;
    top: 0;
    right: 0; /* تغییر به right برای شروع از سمت راست */
    height: 100%;
    background-color: var(--primary);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.step-indicators {
    display: flex;
    flex-direction: row; /* نرمال، از راست به چپ (با توجه به dir="rtl") */
    justify-content: space-between;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.indicator-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #E8EBFF;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.step-indicator.active .indicator-circle {
    background-color: var(--primary);
    color: white;
}

.indicator-label {
    font-size: 12px;
    color: var(--text-medium);
    transition: color 0.3s ease, font-weight 0.3s ease;
}

.step-indicator.active .indicator-label {
    color: var(--primary);
    font-weight: 500;
}

/* محتوای محاسبه */
.calculator-content {
    padding: 20px;
    background-color: var(--bg-white);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    min-height: calc(100vh - var(--header-height) - var(--visualization-height) - 60px);
    /* اضافه کردن نشانگر اسکرول واضح‌تر */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #E8EBFF;
}

/* استایل اسکرول‌بار برای وب‌کیت (کروم، سافاری) */
.calculator-content::-webkit-scrollbar {
    width: 8px;
}

.calculator-content::-webkit-scrollbar-track {
    background: #E8EBFF;
    border-radius: 4px;
}

.calculator-content::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
}

/* نشانگر اسکرول برای موبایل */
.scroll-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 20;
    animation: bounce 2s infinite;
    opacity: 0.8;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.step-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-dark);
    text-align: center;
}

/* مرحله 1: انتخاب نوع فطریه */
.food-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.food-option {
    background-color: #F8F9FC;
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.food-option.active {
    background-color: rgba(1, 181, 205, 0.1);
    border: 1px solid var(--primary);
}

.food-option-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.food-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background-color: white;
}

.food-option.active .food-check {
    background-color: var(--primary);
}

.food-info h3 {
    font-size: 16px;
    margin-bottom: 3px;
}

.food-info p {
    color: var(--text-medium);
    font-size: 13px;
}

.food-icon {
    width: 50px;
    height: 50px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.food-icon i {
    font-size: 24px;
    color: var(--primary);
}

/* مرحله 2: انتخاب تعداد افراد */
.people-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.counter-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 220px;
    margin: 20px 0;
}

.counter-value {
    font-size: 56px;
    font-weight: 700;
    color: var(--primary);
    width: 100px;
    text-align: center;
    margin: 0 10px;
}

.counter-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.counter-btn:hover {
    background-color: var(--primary-dark);
}

.counter-btn:disabled {
    background-color: #E8EBFF;
    color: var(--text-light);
    cursor: not-allowed;
}

/* مرحله 3: پرداخت */
.payment-summary {
    background-color: #F8F9FC;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.summary-label {
    color: var(--text-medium);
}

.summary-value {
    font-weight: 500;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #E8EBFF;
}

.total-label {
    font-weight: 700;
    font-size: 16px;
}

.total-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}

/* مبلغ به حروف در خلاصه */
.amount-in-words-summary {
    margin-top: 10px;
    color: var(--text-medium);
    font-size: 13px;
    text-align: left;
}

/* تاگل باتن فطریه عام/سادات */
.toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    width: 280px;
    height: 40px;
    background-color: rgba(1, 181, 205, 0.1);
    border-radius: 20px;
    overflow: hidden;
}

.toggle-option {
    position: absolute;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.toggle-option:first-child {
    right: 0; /* تغییر به right برای فطریه عام */
}

.toggle-option:last-child {
    left: 0; /* تغییر به left برای فطریه سادات */
}

.toggle-slider {
    position: absolute;
    width: 50%;
    height: 100%;
    background-color: var(--primary);
    border-radius: 20px;
    transition: var(--transition);
    z-index: 1;
}

.toggle-slider.sadat {
    left: 0;
    right: auto;
}

.toggle-slider.regular {
    right: 0;
    left: auto;
}

.toggle-option.active {
    color: white;
    z-index: 3;
}

/* فیلدهای فرم */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-medium);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #E8EBFF;
    border-radius: var(--radius-sm);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(1, 181, 205, 0.1);
}

/* رادیو باتن‌ها */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background-color: #F8F9FC;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.radio-option.active {
    background-color: rgba(1, 181, 205, 0.1);
    border: 1px solid var(--primary);
}

.radio-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radio-option.active .radio-circle::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
}

.radio-label {
    font-weight: 500;
}

/* فیلد مبلغ دلخواه */
.custom-amount-container {
    margin-top: 15px;
    display: none;
}

.custom-amount-container.active {
    display: block;
}

.amount-input-group {
    position: relative;
}

.amount-input-group .form-control {
    padding-left: 70px;
    text-align: left;
    direction: ltr;
}

.amount-input-group .currency {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-medium);
}

/* مبلغ به حروف */
.amount-in-words {
    margin-top: 10px;
    color: var(--text-medium);
    font-size: 13px;
}

/* روش پرداخت */
.payment-method {
    background-color: #F8F9FC;
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.payment-method-info {
    flex-grow: 1;
}

.payment-method-title {
    font-weight: 500;
    margin-bottom: 3px;
}

.payment-method-description {
    font-size: 12px;
    color: var(--text-medium);
}

.payment-method-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 20px;
}

/* دکمه‌های ناوبری */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-bottom: 30px; /* افزایش پدینگ پایین برای فضای بیشتر */
}

.nav-button {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    outline: none;
    font-family: 'Vazirmatn', sans-serif;
}

.prev-button {
    background-color: rgba(1, 181, 205, 0.1);
    color: var(--primary);
}

.prev-button:hover {
    background-color: rgba(1, 181, 205, 0.2);
}

.next-button {
    background-color: var(--primary);
    color: white;
}

.next-button:hover {
    background-color: var(--primary-dark);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* مرحله‌های محاسبه */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
}

/* زرین‌پال */
.zarinpal-logo {
    height: 24px;
    margin-right: 5px;
    vertical-align: middle;
}

/* پاپ‌آپ اعتبارسنجی */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup {
    background-color: white;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 400px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.popup-overlay.active .popup {
    transform: translateY(0);
}

.popup-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(1, 181, 205, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: var(--primary);
    font-size: 28px;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.popup-message {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 20px;
    line-height: 1.5;
}

.popup-button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    transition: var(--transition);
}

.popup-button:hover {
    background-color: var(--primary-dark);
}

/* تنظیمات برای دسکتاپ */
@media (min-width: 768px) {
    body {
        padding: 30px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        overflow: auto;
    }
    
    .app-container {
        max-width: 480px;
        min-height: auto;
        max-height: 90vh;
        margin: 0 auto;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
        height: auto;
        overflow: hidden;
    }

    .app-header {
        position: relative;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: none;
        overflow: hidden; /* اطمینان از عدم سرریز در گوشه‌های گرد */
    }

    .header-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0; /* گرد کردن گوشه‌های تصویر در دسکتاپ */
    }

    .content-wrapper {
        padding-top: 0;
        min-height: auto;
        max-height: calc(90vh - var(--header-height));
        overflow-y: auto;
    }
    
    .calculator-content {
        min-height: auto;
    }
    
    .scroll-indicator {
        display: none; /* پنهان کردن نشانگر اسکرول در دسکتاپ */
    }
}