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

/* ===== ریست و کانتینر اصلی ===== */
.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;
}