/**
 * استایل‌های افزونه اتاق پرو - طراحی کارت‌محور
 */

/* ===== ریست و کانتینر اصلی ===== */
.otagh-prof-section {
    width: 100%;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.otagh-prof-section *,
.otagh-prof-section *::before,
.otagh-prof-section *::after {
    box-sizing: border-box;
}

/* ===== کارت اصلی ===== */
.otagh-prof-main-card {
    max-width: 64rem;
    margin-left: auto;
    margin-right: auto;
    border-radius: 1.5rem;
    border: 2px solid;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* ===== هدر ===== */
.otagh-prof-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid;
}

.otagh-prof-header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.otagh-prof-header-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.otagh-prof-header-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.otagh-prof-custom-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.otagh-prof-custom-icon svg {
    width: 100%;
    height: 100%;
}

.otagh-prof-header-title {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.otagh-prof-header-subtitle {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #6b7280;
    margin: 0;
}

/* ===== محتوای اصلی ===== */
.otagh-prof-content {
    padding: 1.5rem;
}

.otagh-prof-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .otagh-prof-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ===== کارت محصول ===== */
.otagh-prof-product-card {
    background-color: #ffffff;
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid;
}

.otagh-prof-label {
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin: 0 0 0.75rem 0;
}

.otagh-prof-label-mb4 {
    margin-bottom: 1rem;
}

.otagh-prof-product-image-wrapper {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background-color: #f9fafb;
    max-height: 16rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.otagh-prof-product-img {
    max-height: 11rem;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    margin-left: auto;
    margin-right: auto;
    mix-blend-mode: multiply;
    border-radius: 0.75rem;
}

.otagh-prof-product-name {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #374151;
    margin: 0.75rem 0 0 0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== مراحل (Steps) ===== */
.otagh-prof-step {
    display: none !important;
}

.otagh-prof-step.otagh-prof-active {
    display: block !important;
}

/* ===== کارت آپلود ===== */
.otagh-prof-upload-card {
    background-color: #ffffff;
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid;
    height: 100%;
}

/* ===== کادر آپلود ===== */
.otagh-prof-upload-box {}

.otagh-prof-hidden {
    display: none;
}

.otagh-prof-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #e5e7eb;
    border-radius: 1rem;
    background-color: rgba(249, 250, 251, 0.5);
    cursor: pointer;
    transition: all 300ms ease;
}

.otagh-prof-upload-area:hover {
    border-color: var(--hover-color) !important;
    background-color: color-mix(in srgb, var(--hover-color) 8%, transparent) !important;
}

.otagh-prof-upload-area.drag-over {
    border-color: var(--hover-color) !important;
    background-color: color-mix(in srgb, var(--hover-color) 12%, transparent) !important;
    transform: scale(1.02);
}

.otagh-prof-upload-icon-circle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.otagh-prof-upload-icon-circle svg {
    width: 1.75rem;
    height: 1.75rem;
}

.otagh-prof-upload-main-text {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.25rem 0;
}

.otagh-prof-upload-hint {
    font-size: 0.75rem;
    line-height: 1rem;
    color: #9ca3af;
    margin: 0 0 0.75rem 0;
}

.otagh-prof-upload-formats {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1rem;
    color: #6b7280;
}

.otagh-prof-upload-formats svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* ===== پیش‌نمایش تصویر ===== */
.otagh-prof-preview-box {
    /* hidden by default, toggled via JS */
}

.otagh-prof-preview-wrapper {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background-color: #f9fafb;
    max-height: 16rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.otagh-prof-preview-img {
    max-height: 14rem;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
    border-radius: 0.75rem;
}

.otagh-prof-remove-image {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease;
    padding: 0;
}

.otagh-prof-remove-image:hover {
    background-color: #ef4444;
    transform: scale(1.1);
}

.otagh-prof-remove-image svg {
    width: 1rem;
    height: 1rem;
}

/* ===== دکمه تولید ===== */
.otagh-prof-section button.otagh-prof-generate-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 200ms ease;
    text-decoration: none;
    box-sizing: border-box;
}

.otagh-prof-section button.otagh-prof-generate-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.otagh-prof-section button.otagh-prof-generate-button:hover:enabled {
    opacity: 0.9;
}

.otagh-prof-section button.otagh-prof-generate-button svg {
    width: 1rem;
    height: 1rem;
}

/* ===== بخش لودینگ ===== */
.otagh-prof-loading-card {
    background-color: #ffffff;
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.otagh-prof-loading-spinner {
    position: relative;
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.5rem;
}

.otagh-prof-spinner-outer {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 4px solid #f3f4f6;
}

.otagh-prof-spinner-ring1 {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 4px solid transparent;
    animation: otaghProfSpin 1s linear infinite;
}

.otagh-prof-spinner-ring2 {
    position: absolute;
    inset: 0.5rem;
    border-radius: 9999px;
    border: 4px solid transparent;
    animation: otaghProfSpin 1s linear infinite;
    animation-duration: 1.5s;
}

@keyframes otaghProfSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.otagh-prof-loading-title {
    font-size: 1.125rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.otagh-prof-loading-subtitle {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #6b7280;
    margin: 0 0 1.5rem 0;
}

.otagh-prof-progress-bar {
    width: 100%;
    max-width: 20rem;
    height: 0.375rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    overflow: hidden;
}

.otagh-prof-progress-fill {
    height: 100%;
    border-radius: 9999px;
    animation: otaghProfProgressSlide 2s ease-in-out infinite;
}

@keyframes otaghProfProgressSlide {
    0% { width: 0%; }
    50% { width: 80%; }
    100% { width: 100%; }
}

/* ===== بخش نتیجه ===== */
.otagh-prof-result-card {
    background-color: #ffffff;
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid;
    height: 100%;
}

.otagh-prof-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.otagh-prof-result-header .otagh-prof-label {
    margin-bottom: 0;
}

.otagh-prof-badge-ready {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: #f0fdf4;
    color: #16a34a;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
}

.otagh-prof-badge-ready svg {
    width: 0.75rem;
    height: 0.75rem;
}

.otagh-prof-result-image-wrapper {
    border-radius: 1rem;
    overflow: hidden;
    background-color: #f9fafb;
    max-height: 16rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.otagh-prof-result-img {
    max-height: 14rem;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
    border-radius: 0.75rem;
}

.otagh-prof-result-actions {
    display: flex;
}

.otagh-prof-download-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    border-radius: 0.75rem;
    transition: all 200ms ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.otagh-prof-download-button:hover {
    opacity: 0.9;
}

.otagh-prof-download-button svg {
    width: 1rem;
    height: 1rem;
}

/* ===== پیام خطا ===== */
.otagh-prof-error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    color: #b91c1c;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    animation: otaghProfShake 0.5s ease;
}

.otagh-prof-error-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

@keyframes otaghProfShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ===== گوشه‌های گرد برای تصاویر ===== */
.otagh-prof-section img {
    border-radius: 12px;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 640px) {
    .otagh-prof-section {
        padding: 1.5rem 0.75rem;
    }

    .otagh-prof-upload-area {
        padding: 1.5rem;
    }

    .otagh-prof-loading-spinner {
        width: 4rem;
        height: 4rem;
    }
}

/* RTL Support */
body.rtl .otagh-prof-remove-image {
    right: auto;
    left: 0.75rem;
}

/* Print & Accessibility */
@media print {
    .otagh-prof-section {
        display: none;
    }
}

.otagh-prof-upload-area:focus-within {
    outline: 2px solid #8B5CF6;
    outline-offset: 4px;
}
/* ============================================================
   قابلیت‌های جدید: اعتبار، بسته‌ها و پنل کاربری
   ============================================================ */

/* نشان اعتبار در هدر اتاق پرو */
.otagh-prof-credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    padding: 6px 14px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--badge-color, #8B5CF6) 12%, #fff);
    color: var(--badge-color, #8B5CF6);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}
.otagh-prof-credit-badge .otagh-prof-credit-unit {
    font-weight: 500;
    opacity: .8;
    font-size: 12px;
}

/* بسته‌های اعتبار */
.otagh-prof-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin: 16px 0;
}
.otagh-prof-package-card {
    position: relative;
    border: 1.5px solid #E9E5FF;
    border-radius: 18px;
    padding: 26px 18px;
    text-align: center;
    background: #fff;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.otagh-prof-package-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(139, 92, 246, .14);
    border-color: #8B5CF6;
}
.otagh-prof-package-card.is-featured {
    border-color: #8B5CF6;
    box-shadow: 0 10px 26px rgba(139, 92, 246, .18);
}
.otagh-prof-package-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #8B5CF6;
    color: #fff;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.otagh-prof-package-credits {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}
.otagh-prof-package-number {
    font-size: 40px;
    font-weight: 800;
    color: #8B5CF6;
    line-height: 1;
}
.otagh-prof-package-unit { color: #6b7280; font-size: 14px; }
.otagh-prof-package-title { font-size: 16px; margin: 4px 0 10px; color: #111827; }
.otagh-prof-package-price { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 6px; }
.otagh-prof-package-expiry { font-size: 12px; color: #9ca3af; margin-bottom: 16px; }
.otagh-prof-package-buy {
    display: inline-block;
    width: 100%;
    padding: 12px 0;
    border-radius: 12px;
    background: #8B5CF6;
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s ease;
}
.otagh-prof-package-buy:hover { background: #7c4ef0; }

/* پنل کاربری: کارت موجودی */
.otagh-prof-balance-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 26px;
    border-radius: 18px;
    background: linear-gradient(135deg, #8B5CF6, #6d28d9);
    color: #fff;
    margin-bottom: 26px;
}
.otagh-prof-balance-label { font-size: 14px; opacity: .9; }
.otagh-prof-balance-value { font-size: 44px; font-weight: 800; line-height: 1.1; }
.otagh-prof-balance-unit { font-size: 13px; opacity: .85; }
.otagh-prof-balance-expiry { font-size: 12px; opacity: .85; margin-top: 6px; }
.otagh-prof-account-subtitle { margin: 26px 0 12px; font-size: 17px; }

.otagh-prof-credit-log { width: 100%; }
.otagh-prof-change.is-plus { color: #16a34a; font-weight: 700; }
.otagh-prof-change.is-minus { color: #dc2626; font-weight: 700; }

/* پنل کاربری: ریفرال */
.otagh-prof-referral-stats { display: flex; gap: 16px; margin: 16px 0; }
.otagh-prof-referral-stat {
    flex: 1;
    text-align: center;
    padding: 18px;
    border-radius: 14px;
    background: #F8F7FF;
    border: 1px solid #E9E5FF;
}
.otagh-prof-referral-stat-num { display: block; font-size: 30px; font-weight: 800; color: #8B5CF6; }
.otagh-prof-referral-stat-label { font-size: 13px; color: #6b7280; }
.otagh-prof-referral-link-box { margin: 16px 0; }
.otagh-prof-referral-link-box label { display: block; margin-bottom: 6px; font-weight: 600; }
.otagh-prof-referral-link-input { display: flex; gap: 8px; }
.otagh-prof-referral-link-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E9E5FF;
    border-radius: 10px;
    direction: ltr;
    text-align: left;
    background: #fff;
}
.otagh-prof-copy-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: #8B5CF6;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}
.otagh-prof-copy-btn:hover { background: #7c4ef0; }

/* ویجت داشبورد حساب کاربری */
.otagh-prof-dashboard-widget { margin: 20px 0; }
.otagh-prof-dashboard-balance {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 14px;
    background: #F8F7FF;
    border: 1px solid #E9E5FF;
}
.otagh-prof-dashboard-icon { font-size: 26px; }
.otagh-prof-dashboard-balance strong { font-size: 24px; color: #8B5CF6; display: block; line-height: 1; }
.otagh-prof-dashboard-balance span { font-size: 13px; color: #6b7280; }
.otagh-prof-dashboard-link {
    margin-right: auto;
    padding: 8px 16px;
    border-radius: 10px;
    background: #8B5CF6;
    color: #fff !important;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.otagh-prof-dashboard-referral-link {
    display: block;
    margin-top: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 1px dashed #fb923c;
    color: #9a3412 !important;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
}
