/**
 * ArzPaya Crypto Calculator - Full styles (standalone, no theme dependency)
 */

/* === Section & layout === */
.arzpaya-crypto-calculator.calculator-section {
    padding: 48px 15px;
    background: transparent;
    direction: rtl;
    font-family: "IRANSansWeb", sans-serif;
}

.arzpaya-crypto-calculator .calculator-title {
    margin-bottom: 45px;
    text-align: right;
}

.arzpaya-crypto-calculator .calculator-title h2 {
    margin: 0 0 12px 0;
    font-size: 1.6rem;
    color: #3D72FE;
    line-height: 1.2;
    font-weight: 700;
}

.arzpaya-crypto-calculator .calculator-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    background: transparent;
    border-radius: 12px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.arzpaya-crypto-calculator .calc-left {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 260px;
}

.arzpaya-crypto-calculator .calc-left img {
    max-width: 100%;
    height: auto;
    display: block;
}

.arzpaya-crypto-calculator .calc-right {
    flex: 1;
    padding: 10px 20px;
    min-width: 260px;
    text-align: right;
}

.arzpaya-crypto-calculator .calc-right h2 {
    margin: 0 0 12px 0;
    font-size: 1.6rem;
    color: #3D72FE;
    line-height: 1.2;
    font-weight: 700;
}

.arzpaya-crypto-calculator .calc-desc {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
    font-weight: 500;
    font-family: IRANSansWeb;
}

/* === Tabs === */
.arzpaya-crypto-calculator .calc-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.arzpaya-crypto-calculator .calc-tab {
    border: none;
    border-radius: 8px;
    padding: 8px 30px;
    font-size: 1rem;
    font-family: "IRANSansWeb", sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    width: 50%;
}

.arzpaya-crypto-calculator .calc-tab.buy-tab {
    background-color: #E0E8FF;
    color: #1E3A8A;
}

.arzpaya-crypto-calculator .calc-tab.buy-tab.active {
    background-color: #3B82F6;
    color: white;
}

.arzpaya-crypto-calculator .calc-tab.sell-tab {
    background-color: #FEE2E2;
    color: #991B1B;
}

.arzpaya-crypto-calculator .calc-tab.sell-tab.active {
    background-color: #EF4444;
    color: white;
}

.arzpaya-crypto-calculator .calc-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* === Form === */
.arzpaya-crypto-calculator .calc-form {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
}

.arzpaya-crypto-calculator .form-item {
    margin-bottom: 30px;
    position: relative;
    width: 100%;
}

.arzpaya-crypto-calculator .form-item:last-child {
    margin-bottom: 0;
}

.arzpaya-crypto-calculator .form-item label {
    position: absolute;
    top: -10px;
    right: 12px;
    font-size: 14px;
    background: var(--body-bg, #fff);
    padding: 0 6px;
    color: #6b7280;
    pointer-events: none;
    line-height: 1;
    z-index: 1;
    font-weight: 500;
}

.arzpaya-crypto-calculator .form-control:focus + label,
.arzpaya-crypto-calculator .custom-select-wrapper.open + label {
    font-weight: 500 !important;
}

/* Base input */
.arzpaya-crypto-calculator .form-control {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    height: 48px;
    padding: 0 12px;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: "IRANSansWeb", sans-serif;
    text-align: center;
}

.arzpaya-crypto-calculator .form-control[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.arzpaya-crypto-calculator .form-control[type="number"]::-webkit-outer-spin-button,
.arzpaya-crypto-calculator .form-control[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.arzpaya-crypto-calculator .form-control:focus {
    box-shadow: 0 0 0 4px rgba(59,130,246,0.08);
}

.arzpaya-crypto-calculator .form-control:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Sell mode: form controls border */
.arzpaya-crypto-calculator.sell-mode .form-control,
.arzpaya-crypto-calculator.sell-mode .custom-select-selected {
    border-color: #ef4444;
}

.arzpaya-crypto-calculator.sell-mode .form-control:focus,
.arzpaya-crypto-calculator.sell-mode .custom-select-wrapper.open .custom-select-selected {
    box-shadow: 0 0 0 4px rgba(239,68,68,0.08);
}

.arzpaya-crypto-calculator.sell-mode .form-control:focus + label,
.arzpaya-crypto-calculator.sell-mode .custom-select-wrapper.open + label {
    color: #ef4444;
}

/* Output field (مبلغ به تومان) */
.arzpaya-crypto-calculator #arzpaya-calc-toToman.calculated {
    background-color: #f9fafb;
    color: #111827;
    text-align: center;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Submit button */
.arzpaya-crypto-calculator .submit-btn {
    width: 100%;
    padding: 14px 0;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    background-color: #3b82f6;
    transition: background-color 0.3s ease;
    font-family: "IRANSansWeb", sans-serif;
    display: block;
    text-align: center;
    text-decoration: none;
}

.arzpaya-crypto-calculator .submit-btn:hover,
.arzpaya-crypto-calculator .submit-btn:focus {
    text-decoration: none;
    color: white;
}

.arzpaya-crypto-calculator.sell-mode .form-control {
    border-color: #ef4444 !important;
}

.arzpaya-crypto-calculator.sell-mode .submit-btn {
    background-color: #ef4444 !important;
    color: white;
}

/* === Custom select === */
.arzpaya-crypto-calculator .custom-select-wrapper {
    width: 100%;
    height: 48px;
    position: relative;
}

.arzpaya-crypto-calculator .native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.arzpaya-crypto-calculator .custom-select-selected {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    height: 48px;
    padding: 0 12px;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.arzpaya-crypto-calculator .custom-select-selected > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
}

.arzpaya-crypto-calculator .custom-select-selected img.coin-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: block;
    position: absolute;
    right: 0;
}

.arzpaya-crypto-calculator .custom-select-selected span {
    width: 100%;
    text-align: center;
}

.arzpaya-crypto-calculator .custom-select-selected .dropdown-arrow {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.arzpaya-crypto-calculator .custom-select-selected:focus,
.arzpaya-crypto-calculator .custom-select-wrapper.open .custom-select-selected {
    box-shadow: 0 0 0 4px rgba(59,130,246,0.08);
}

.arzpaya-crypto-calculator .custom-select-selected .select-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.arzpaya-crypto-calculator .custom-select-options {
    position: absolute;
    top: 90%;
    right: 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 999;
    list-style: none;
    padding: 0;
    margin: 0;
}

.arzpaya-crypto-calculator .custom-select-options.show {
    display: block;
}

.arzpaya-crypto-calculator .custom-select-options li {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    transition: background-color 0.2s;
}

.arzpaya-crypto-calculator .custom-select-options li:hover {
    background-color: #f3f4f6;
}

.arzpaya-crypto-calculator .custom-select-options img {
    width: 20px;
    height: 20px;
    margin-left: 8px;
    border-radius: 50%;
}

.arzpaya-crypto-calculator .custom-select-wrapper.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* === Dark theme === */
[data-theme="dark"] .arzpaya-crypto-calculator.calculator-section {
    background: transparent;
    color: var(--text-body);
}

[data-theme="dark"] .arzpaya-crypto-calculator .calculator-title h2,
[data-theme="dark"] .arzpaya-crypto-calculator .calc-right h2 {
    color: var(--accent-primary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .calc-desc {
    color: var(--text-secondary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .form-item label {
    background: var(--body-bg);
    color: var(--text-secondary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .form-control {
    background: var(--card-bg);
    color: var(--text-body);
    border: 1px solid var(--accent-primary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .form-control:focus {
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(61,130,246,0.15);
}

[data-theme="dark"] .arzpaya-crypto-calculator .form-control:disabled {
    background-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .custom-select-selected {
    background: var(--card-bg);
    color: var(--text-body);
    border: 1px solid var(--accent-primary);
}

[data-theme="dark"] .arzpaya-crypto-calculator .custom-select-selected:focus,
[data-theme="dark"] .arzpaya-crypto-calculator .custom-select-wrapper.open .custom-select-selected {
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(61,130,246,0.15);
}

[data-theme="dark"] .arzpaya-crypto-calculator .custom-select-options {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

[data-theme="dark"] .arzpaya-crypto-calculator .custom-select-options li:hover {
    background-color: rgba(61, 114, 254, 0.1);
}

[data-theme="dark"] .arzpaya-crypto-calculator #arzpaya-calc-toToman.calculated {
    background-color: var(--border-color);
    color: var(--text-body);
}

/* === Responsive === */
@media (max-width: 768px) {
    .arzpaya-crypto-calculator.calculator-section {
        padding: 48px 0;
    }

    .arzpaya-crypto-calculator .calculator-title {
        text-align: center;
        margin-bottom: 32px;
    }

    .arzpaya-crypto-calculator .calculator-title h2 {
        text-align: center;
    }

    .arzpaya-crypto-calculator .calc-desc {
        text-align: center;
    }

    .arzpaya-crypto-calculator .calculator-inner {
        flex-direction: column-reverse;
        text-align: center;
        padding: 16px 0;
    }

    .arzpaya-crypto-calculator .calc-right {
        text-align: center;
        padding: 10px 0 16px 0;
    }

    .arzpaya-crypto-calculator .calc-right h2 {
        font-size: 1.25rem;
    }

    .arzpaya-crypto-calculator .calc-tabs {
        width: 100%;
        justify-content: center;
    }

    .arzpaya-crypto-calculator .form-control {
        font-size: 0.95rem;
    }

    .arzpaya-crypto-calculator .submit-btn {
        font-size: 1rem;
    }

    .arzpaya-crypto-calculator .calc-left {
        display: none;
    }
}
