:root {
    --primary-color: #2563eb; 
    --primary-dark: #1e40af;
    --accent-color: #3b82f6;
    --bg-light: #eff6ff;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --success-green: #10b981;
    --error-red: #ef4444;
}

/* =======================================================
   1. تنظیمات کانتینر اصلی
   ======================================================= */
#rastak-app {
    width: 95% !important; 
    max-width: 100% !important;
    margin: 30px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    font-family: inherit !important; 
    direction: rtl;
    text-align: right;
    overflow: hidden;
    border-top: 6px solid var(--primary-color);
    position: relative;
    box-sizing: border-box; 
    color: var(--text-color);
    line-height: 1.6;
}

#rastak-app *, #rastak-app button, #rastak-app input, #rastak-app select, #rastak-app textarea, .r-loader span {
    font-family: inherit !important;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* =======================================================
   2. سیستم گرید (Grid)
   ======================================================= */
.r-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px; 
    align-items: start;
}

.r-grid > div[style*="span 3"], 
.r-grid > div[style*="span 2"] { 
    grid-column: span 3 !important; 
}

/* =======================================================
   3. ریسپانسیو (تبلت و موبایل)
   ======================================================= */
@media screen and (max-width: 1200px) {
    #rastak-app { width: 98% !important; }
    .r-grid { grid-template-columns: 1fr 1fr !important; gap: 20px; }
    .r-grid > div[style*="span 3"] { grid-column: span 2 !important; }
}

@media screen and (max-width: 768px) {
    /* تنظیمات موبایل */
    #rastak-app {
        width: 100% !important;
        margin: 0 !important;       
        padding: 0 !important;
        border-radius: 0 !important; 
        border-left: none !important;
        border-right: none !important;
        box-shadow: none !important; 
    }

    .r-step { padding: 15px 10px !important; }
    .r-grid { display: flex !important; flex-direction: column; gap: 15px !important; }
    .r-grid > div { width: 100% !important; grid-column: auto !important; }
    
    .pricing-grid { grid-template-columns: 1fr !important; }
    .buttons-row { flex-direction: column-reverse; } 
    
    .sla-content-box { padding: 10px 5px !important; }
    .sla-content-box table { font-size: 11px !important; }
    .sla-content-box th, .sla-content-box td { padding: 5px 2px !important; }
    
    .sla-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    #sla-buttons { width: 100%; flex-direction: column; }
    #sla-buttons button { width: 100% !important; margin: 0 !important; }

    /* --- استایل باکس‌های توضیحات اضافی در موبایل --- */
    #rastak-box-1, #rastak-box-2 {
        padding: 10px !important;
        margin: 0 !important;
        width: 100% !important;
        font-size: 13px !important;
        line-height: 1.7 !important;
        border-bottom: 1px solid #eee !important;
        text-align: justify !important;
        transition: all 0.3s ease;
    }

    /* حالت بسته */
    .r-mobile-collapsed {
        max-height: 120px; /* ارتفاع اولیه کمی بیشتر */
        overflow: hidden;
        position: relative;
        -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
        mask-image: linear-gradient(180deg, #000 60%, transparent);
    }

    /* حالت باز (اصلاح شده) */
    .r-mobile-expanded {
        max-height: none !important; /* حذف محدودیت ارتفاع */
        height: auto !important;
        overflow: visible !important;
        -webkit-mask-image: none !important;
        mask-image: none !important;
        padding-bottom: 20px !important;
    }

    .r-read-more-btn {
        display: block !important;
        text-align: center;
        color: var(--primary-color);
        font-size: 13px;
        font-weight: bold;
        cursor: pointer;
        padding: 12px;
        background: #f8fafc;
        border-bottom: 4px solid #eee;
        margin-bottom: 15px;
    }
    .r-read-more-btn:hover { background: #eff6ff; }
}

.r-read-more-btn { display: none; }

/* =======================================================
   4. استایل مراحل
   ======================================================= */
.r-step { padding: 40px 50px; animation: slideUp 0.5s ease-out; }
.r-step h3 { margin: 0 0 30px 0; font-size: 22px; font-weight: 800; color: var(--primary-dark); border-bottom: 2px solid var(--bg-light); padding-bottom: 15px; display: flex; align-items: center; }
.r-step h3::before { content: ''; display: inline-block; width: 10px; height: 10px; background: var(--accent-color); border-radius: 50%; margin-left: 12px; }
.r-step p { color: #6b7280; margin-bottom: 30px; font-size: 15px; }

/* =======================================================
   5. استایل توافق‌نامه (SLA)
   ======================================================= */
.sla-wrapper { border: 1px solid var(--border-color); border-radius: 12px; background: #fff; overflow: hidden; margin-bottom: 25px; }
@media screen and (max-width: 768px) { .sla-wrapper { border-radius: 8px !important; } }

.sla-header { background: #f1f5f9; padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.sla-title { font-weight: bold; color: var(--text-color); font-size: 14px; }
#sla-buttons { display: flex; gap: 10px; align-items: center; }

.btn-download-sla { 
    background: #fff !important; border: 1px solid var(--primary-color) !important; color: var(--primary-color) !important; padding: 6px 15px !important; border-radius: 6px !important; font-size: 12px !important; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 5px; height: auto !important; margin: 0 !important; width: auto !important; text-decoration: none !important; 
}
.btn-download-sla:hover { background: #e0f2fe !important; }

/* استایل باکس‌های توضیحات اضافی رستاک (دسکتاپ) */
#rastak-box-1, #rastak-box-2 { padding: 20px; background: #fefefe; border-bottom: 1px dashed #e5e7eb; font-size: 13px; line-height: 1.8; color: #444; }

/* باکس محتوا */
.sla-content-box { height: 500px; overflow-y: auto; overflow-x: auto; padding: 20px; background: #fff; font-size: 13px; line-height: 2; color: #333; text-align: justify; }
.sla-content-box table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 12px; table-layout: auto; }
.sla-content-box th { background-color: #e2e8f0; font-weight: bold; color: #1e293b; text-align: center; white-space: nowrap; padding: 8px 5px; }
.sla-content-box td { border: 1px solid #cbd5e1; padding: 6px 5px; vertical-align: middle; text-align: center; }
.sla-content-box tr:nth-child(even) { background-color: #f8fafc; }
.sla-content-box tr:hover { background-color: #f1f5f9; }
.sla-content-box::-webkit-scrollbar { width: 10px; height: 10px; }
.sla-content-box::-webkit-scrollbar-track { background: #f1f1f1; }
.sla-content-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; border: 2px solid #f1f1f1; }

.sla-accept-box { background: #f0fdf4; border: 1px solid #bbf7d0; padding: 15px; border-radius: 8px; display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }

/* =======================================================
   6. استایل صفحه پرداخت
   ======================================================= */
.pricing-section-title { font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 15px; display: block; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 40px; }
.pricing-card { border: 2px solid #e2e8f0; border-radius: 12px; padding: 25px 20px; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); background: #fff; position: relative; display: flex; flex-direction: column; justify-content: center; }
.pricing-card:hover { border-color: #93c5fd; transform: translateY(-3px); box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); }
.pricing-card.active { border-color: var(--primary-color); background: #eff6ff; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }
.pricing-card.active::after { content: '✔'; position: absolute; top: 15px; left: 15px; background: var(--primary-color); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.pc-title { font-weight: 800; font-size: 16px; color: #334155; margin-bottom: 8px; }
.pc-desc { font-size: 13px; color: #64748b; line-height: 1.5; }
.pc-price { font-weight: 700; color: var(--primary-color); font-size: 15px; margin-top: 10px; }

.invoice-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 25px; margin-top: 10px; }
.invoice-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 14px; color: #475569; }
.invoice-row.discount { color: var(--success-green); font-weight: bold; }
.invoice-row.tax { color: #d97706; }
.invoice-total { border-top: 2px solid #e2e8f0; margin-top: 15px; padding-top: 15px; display: flex; justify-content: space-between; font-weight: 900; font-size: 20px; color: var(--primary-dark); }

/* =======================================================
   7. دکمه‌ها و اینپوت‌ها
   ======================================================= */
.buttons-row { display: flex; gap: 15px; margin-top: 30px; }
.btn-primary { background: var(--primary-color); color: white; border: none; padding: 0; height: 55px; line-height: 55px; border-radius: 10px; font-size: 16px; font-weight: bold; cursor: pointer; width: 100% !important; transition: all 0.3s; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); display: block; }
.buttons-row .btn-primary { flex: 2; width: auto !important; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3); }
.btn-outline { background: transparent; border: 2px solid #cbd5e1; color: #64748b; padding: 0; height: 55px; line-height: 51px; border-radius: 10px; font-size: 16px; font-weight: bold; cursor: pointer; flex: 1; transition: all 0.3s; width: 100%; }
.buttons-row .btn-outline { width: auto; }
.btn-outline:hover { border-color: #94a3b8; background: #f1f5f9; color: #334155; }

#rastak-app input:not([type="radio"]), #rastak-app select, #rastak-app textarea { width: 100%; padding: 0 15px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; transition: all 0.3s; background: #f8fafc; color: #333; height: 50px; line-height: 50px; outline: none; }
#rastak-app textarea { height: auto; min-height: 120px; padding: 15px; line-height: 1.6; }
#rastak-app input:focus, #rastak-app select:focus, #rastak-app textarea:focus { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }
#rastak-app label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: #475569; }

.r-loader { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.95); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 999; backdrop-filter: blur(2px); border-radius: 16px; }
.r-loader span { margin-top: 20px; font-weight: 700; color: var(--primary-color); font-size: 16px; font-family: inherit !important; }
.spinner { width: 50px; height: 50px; border: 4px solid #e2e8f0; border-top: 4px solid var(--primary-color); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }