/* =============================================
   SMS Calculator Widget - Styles
   ============================================= */

/* --- فرم اصلی --- */
.sms-calculator-wrap {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    direction: rtl;
}

.sms-calc-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sms-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sms-field-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* رادیو باتن */
.sms-radio-group {
    display: flex;
    gap: 20px;
}

.sms-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    position: relative;
    padding-right: 4px;
}

.sms-radio-label input[type="radio"] {
    display: none;
}

.sms-radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sms-radio-label input[type="radio"]:checked ~ .sms-radio-custom {
    border-color: var(--accent, #25a244);
    background: var(--accent, #25a244);
    box-shadow: inset 0 0 0 3px #fff;
}

.sms-radio-label:has(input:checked) {
    color: #111;
    font-weight: 600;
}

/* اینپوت‌ها */
.sms-input,
.sms-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    direction: rtl;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

.sms-input:focus,
.sms-textarea:focus {
    border-color: var(--accent, #25a244);
    box-shadow: 0 0 0 3px rgba(37, 162, 68, 0.1);
    background: #fff;
}

.sms-textarea {
    resize: vertical;
    min-height: 100px;
}

/* شمارنده کاراکتر */
.sms-char-counter {
    font-size: 12px;
    color: #888;
    text-align: left;
    direction: ltr;
    margin-top: 4px;
}

/* دکمه محاسبه */
.sms-calc-btn {
    width: 100%;
    padding: 14px 20px;
    background-color: #25a244;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
    box-shadow: 0 4px 15px rgba(37, 162, 68, 0.3);
    letter-spacing: 0.5px;
}

.sms-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 162, 68, 0.4);
}

.sms-calc-btn:active {
    transform: translateY(0);
}


/* =============================================
   پاپ‌آپ
   ============================================= */

.sms-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.sms-popup-overlay.is-open {
    display: flex;
    animation: smsOverlayIn 0.25s ease forwards;
}

@keyframes smsOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sms-popup-overlay.is-open.hiding {
    animation: smsOverlayOut 0.2s ease forwards;
}

.sms-popup-overlay.is-open.hiding .sms-popup-box {
    animation: smsPopupOut 0.2s ease forwards;
}

@keyframes smsOverlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes smsPopupOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.9); }
}

.sms-popup-box {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    direction: rtl;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    animation: smsPopupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes smsPopupIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* دکمه بستن */
.sms-popup-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
    padding: 0;
}

.sms-popup-close:hover {
    background: #e0e0e0;
}

.sms-close-icon {
    display: block;
    width: 14px;
    height: 14px;
    position: relative;
}

.sms-close-icon::before,
.sms-close-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 2px;
    background: #555;
    border-radius: 2px;
    transition: background 0.2s;
}

.sms-close-icon::before { transform: translateY(-50%) rotate(45deg); }
.sms-close-icon::after  { transform: translateY(-50%) rotate(-45deg); }

.sms-popup-close:hover .sms-close-icon::before,
.sms-popup-close:hover .sms-close-icon::after {
    background: #222;
}

.sms-popup-inner {
    padding: 30px;
}

/* عنوان پاپ‌آپ */
.sms-popup-title {
    font-size: 18px;
    font-weight: 800;
    color: #111;
    margin: 0 0 20px 0;
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

/* گرید نتایج */
.sms-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.sms-result-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    border: 1.5px solid transparent;
    transition: border-color 0.2s;
}

.sms-result-item:hover {
    border-color: var(--accent, #25a244);
}

.sms-result-icon {
    font-size: 22px;
    line-height: 1;
}

.sms-result-label {
    font-size: 12px;
    color: #888;
}

.sms-result-value {
    font-size: 16px;
    font-weight: 800;
    color: #111;
}

/* هزینه کل */
.sms-total-cost {
    background: linear-gradient(135deg, var(--accent, #25a244), color-mix(in srgb, var(--accent, #25a244) 70%, #000));
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 24px;
    flex-wrap: wrap;
    text-align: center;
}

.sms-total-label {
    font-size: 14px;
    opacity: 0.85;
    width: 100%;
    text-align: center;
}

.sms-total-value {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.sms-total-currency {
    font-size: 14px;
    opacity: 0.85;
}

/* جداکننده فرم */
.sms-form-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: #999;
    font-size: 12px;
    text-align: center;
}

.sms-form-divider::before,
.sms-form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

/* استایل فرم ثبت‌نام داخل پاپ‌آپ */
.sms-shortcode-wrap input,
.sms-shortcode-wrap textarea,
.sms-shortcode-wrap select {
    width: 100% !important;
    padding: 11px 14px !important;
    border: 1.5px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    margin-bottom: 10px !important;
    direction: rtl !important;
    box-sizing: border-box !important;
}

.sms-shortcode-wrap input[type="submit"],
.sms-shortcode-wrap button[type="submit"] {
    background: var(--accent, #25a244) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: opacity 0.2s !important;
}

.sms-shortcode-wrap input[type="submit"]:hover,
.sms-shortcode-wrap button[type="submit"]:hover {
    opacity: 0.85 !important;
}

/* اسکرول‌بار پاپ‌آپ */
.sms-popup-box::-webkit-scrollbar {
    width: 5px;
}
.sms-popup-box::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}
.sms-popup-box::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* موبایل */
@media (max-width: 480px) {
    .sms-popup-inner {
        padding: 20px 16px;
    }
    .sms-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .sms-total-value {
        font-size: 22px;
    }
    .sms-popup-box {
        border-radius: 16px;
    }
}
