/**
 * Interior Visualizer Styles
 *
 * Clean, minimal, modern design.
 *
 * @package ShopWriter
 * @since   1.5.0
 */

/* ============================================
   Base Container
   ============================================ */
.shopwr-interior-visualizer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    max-width: 560px;
    margin: 32px auto;
    padding: 0 16px;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.shopwr-interior-visualizer *,
.shopwr-interior-visualizer *::before,
.shopwr-interior-visualizer *::after {
    box-sizing: border-box;
}

/* ============================================
   Header
   ============================================ */
.shopwr-iv-header {
    text-align: center;
    margin-bottom: 28px;
}

.shopwr-iv-header-minimal {
    margin-bottom: 16px;
    text-align: left;
}

.shopwr-iv-title {
    font-size: 22px;
    font-weight: 600;
    color: #111;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.shopwr-iv-title-minimal {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.shopwr-iv-description {
    font-size: 15px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* ============================================
   Compact Form Layout
   ============================================ */
.shopwr-iv-form-compact {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e9ecef;
}

/* Reset WordPress auto-p tags */
.shopwr-iv-form-compact p,
.shopwr-iv-form-row p,
.shopwr-iv-form-col p {
    margin: 0;
    padding: 0;
    display: contents;
}

.shopwr-iv-form-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.shopwr-iv-form-col {
    /* Base styles handled by specific col classes */
}

.shopwr-iv-col-upload {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

.shopwr-iv-col-instructions {
    flex: 1;
    display: flex;
}

/* Minimal Upload Button */
.shopwr-iv-upload-compact {
    display: flex;
    align-items: stretch;
    padding: 0;
}

.shopwr-iv-upload-btn-minimal {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    min-height: 80px;
    align-self: stretch;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.shopwr-iv-upload-btn-minimal:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #faf5ff;
}

.shopwr-iv-upload-btn-minimal svg {
    opacity: 0.7;
}

.shopwr-iv-upload-btn-minimal:hover svg {
    opacity: 1;
}

/* Compact Preview (same size as upload button) */
.shopwr-iv-preview-compact {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    height: 100%;
    min-height: 80px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.shopwr-iv-preview-compact img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.shopwr-iv-remove-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.shopwr-iv-remove-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* Minimal Textarea */
.shopwr-iv-textarea-minimal {
    width: 100%;
    min-height: 80px;
    height: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    background: #fff;
    color: #374151;
    transition: border-color 0.2s ease;
}

.shopwr-iv-textarea-minimal:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.shopwr-iv-textarea-minimal::placeholder {
    color: #9ca3af;
}

/* Minimal Submit */
.shopwr-iv-submit-minimal {
    margin-top: 12px;
    text-align: right;
}

.shopwr-iv-submit-btn-minimal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shopwr-iv-submit-btn-minimal:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.shopwr-iv-submit-btn-minimal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .shopwr-iv-form-row {
        flex-direction: column;
        gap: 6px;
    }

    .shopwr-iv-col-upload {
        width: 100%;
    }

    .shopwr-iv-col-instructions {
        width: 100%;
    }

    .shopwr-iv-upload-btn-minimal {
        width: 100%;
        min-height: 40px;
        padding: 0 12px;
        font-size: 12px;
        gap: 6px;
    }

    .shopwr-iv-upload-btn-minimal svg {
        width: 16px;
        height: 16px;
    }

    .shopwr-iv-preview-compact {
        min-height: 40px;
        padding: 4px 8px;
    }

    .shopwr-iv-preview-compact img {
        width: 28px;
        height: 28px;
    }

    .shopwr-iv-remove-btn {
        width: 22px;
        height: 22px;
    }

    .shopwr-iv-textarea-minimal {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .shopwr-iv-submit-minimal {
        margin-top: 6px;
        text-align: center;
    }

    .shopwr-iv-submit-btn-minimal {
        width: 100%;
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
    }

    .shopwr-iv-submit-btn-minimal svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================
   Upload Area
   ============================================ */
.shopwr-iv-upload-section {
    margin-bottom: 20px;
}

.shopwr-iv-upload-card {
    position: relative;
}

/* Compact Upload Button Style - see above for main styles */

.shopwr-iv-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.shopwr-iv-upload-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.shopwr-iv-upload-btn svg {
    width: 20px;
    height: 20px;
}

.shopwr-iv-upload-hint-compact {
    margin: 8px 0 0;
    font-size: 12px;
    color: #888;
}

.shopwr-iv-upload-compact .shopwr-iv-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.shopwr-iv-upload-area {
    position: relative;
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shopwr-iv-upload-area:hover {
    border-color: #0071e3;
    background: #f0f7ff;
}

.shopwr-iv-upload-area.dragover {
    border-color: #0071e3;
    background: #e8f2ff;
}

.shopwr-iv-upload-area.has-image {
    border: 1px solid #eee;
    padding: 0;
    background: #fff;
}

.shopwr-iv-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.shopwr-iv-upload-placeholder {
    pointer-events: none;
}

.shopwr-iv-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #999;
}

.shopwr-iv-upload-icon svg {
    width: 40px;
    height: 40px;
}

.shopwr-iv-upload-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
}

.shopwr-iv-upload-hint {
    font-size: 14px;
    color: #888;
    margin: 0 0 4px 0;
}

.shopwr-iv-upload-formats {
    font-size: 12px;
    color: #aaa;
}

/* Preview */
.shopwr-iv-upload-preview {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
}

.shopwr-iv-upload-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.shopwr-iv-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    z-index: 3;
    padding: 0;
}

.shopwr-iv-remove-image:hover {
    background: #ff3b30;
}

.shopwr-iv-remove-image svg {
    width: 16px;
    height: 16px;
}

.shopwr-iv-upload-status {
    margin-top: 6px;
    text-align: center;
    min-height: 20px;
}

.shopwr-iv-status-text {
    font-size: 13px;
    color: #666;
}

.shopwr-iv-status-text.error {
    color: #ff3b30;
}

/* ============================================
   Instructions
   ============================================ */
.shopwr-iv-instructions-section {
    margin-bottom: 20px;
}

.shopwr-iv-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.shopwr-iv-label-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.shopwr-iv-label-optional {
    font-size: 13px;
    color: #999;
}

.shopwr-iv-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    background: #fff;
    color: #333;
}

.shopwr-iv-textarea:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.shopwr-iv-textarea::placeholder {
    color: #aaa;
}

.shopwr-iv-instructions-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.shopwr-iv-hint-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #888;
}

.shopwr-iv-hint-item svg {
    color: #34c759;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
}

/* ============================================
   reCAPTCHA Notice
   ============================================ */
.shopwr-iv-recaptcha-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    font-size: 11px;
    color: #999;
    margin-bottom: 16px;
}

.shopwr-iv-recaptcha-notice svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   Submit Button
   ============================================ */
.shopwr-iv-submit-section {
    text-align: center;
    margin-top: 24px;
}

.shopwr-iv-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.shopwr-iv-submit-btn:hover:not(:disabled) {
    background: #333;
    transform: translateY(-1px);
}

.shopwr-iv-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.shopwr-iv-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.shopwr-iv-btn-icon {
    display: flex;
    align-items: center;
}

.shopwr-iv-btn-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
}

/* ============================================
   Loading State
   ============================================ */
.shopwr-iv-loading {
    text-align: center;
    padding: 48px 16px;
}

.shopwr-iv-loading-content {
    max-width: 280px;
    margin: 0 auto;
}

.shopwr-iv-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    position: relative;
}

.shopwr-iv-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid #eee;
    border-top-color: #0071e3;
    border-radius: 50%;
    animation: iv-spin 0.8s linear infinite;
}

.shopwr-iv-spinner-ring:nth-child(2),
.shopwr-iv-spinner-ring:nth-child(3) {
    display: none;
}

@keyframes iv-spin {
    to { transform: rotate(360deg); }
}

.shopwr-iv-loading-title {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
}

.shopwr-iv-loading-subtitle {
    font-size: 14px;
    color: #888;
    margin: 0 0 20px 0;
}

.shopwr-iv-progress-bar {
    width: 100%;
    height: 3px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.shopwr-iv-progress-fill {
    height: 100%;
    background: #0071e3;
    width: 0%;
    transition: width 0.4s ease;
}

/* ============================================
   Result Section
   ============================================ */
.shopwr-iv-result {
    text-align: center;
}

.shopwr-iv-result-header {
    margin-bottom: 16px;
}

.shopwr-iv-result-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 600;
    color: #34c759;
    margin: 0;
}

.shopwr-iv-result-title svg {
    width: 20px;
    height: 20px;
}

.shopwr-iv-result-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.shopwr-iv-result-image {
    display: block;
    max-width: 100%;
    height: auto;
}

.shopwr-iv-result-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
}

.shopwr-iv-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    padding: 0;
}

.shopwr-iv-zoom-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.shopwr-iv-zoom-btn svg {
    width: 20px;
    height: 20px;
}

.shopwr-iv-result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.shopwr-iv-download-btn,
.shopwr-iv-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    border: none;
}

.shopwr-iv-download-btn svg,
.shopwr-iv-new-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

.shopwr-iv-download-btn {
    background: #1a1a1a;
    color: #fff;
}

.shopwr-iv-download-btn:hover {
    background: #333;
    color: #fff;
    transform: translateY(-1px);
}

.shopwr-iv-new-btn {
    background: transparent;
    color: #1a1a1a;
    border: 1.5px solid #ddd;
}

.shopwr-iv-new-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
    transform: translateY(-1px);
}

/* ============================================
   Error State
   ============================================ */
.shopwr-iv-error {
    text-align: center;
    padding: 48px 16px;
}

.shopwr-iv-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #ff3b30;
}

.shopwr-iv-error-icon svg {
    width: 40px;
    height: 40px;
}

.shopwr-iv-error-title {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
}

.shopwr-iv-error-message {
    font-size: 14px;
    color: #888;
    margin: 0 0 20px 0;
}

.shopwr-iv-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #0071e3;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.shopwr-iv-retry-btn:hover {
    background: #0077ed;
}

/* ============================================
   Lightbox
   ============================================ */
.shopwr-iv-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shopwr-iv-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.shopwr-iv-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.shopwr-iv-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    padding: 0;
}

.shopwr-iv-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.shopwr-iv-lightbox-close svg {
    width: 18px;
    height: 18px;
}

.shopwr-iv-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================
   Responsive - General
   ============================================ */
@media (max-width: 480px) {
    .shopwr-interior-visualizer {
        margin: 4px auto;
        padding: 0 4px;
    }

    .shopwr-iv-header-minimal {
        margin-bottom: 4px;
    }

    .shopwr-iv-title-minimal {
        font-size: 13px;
    }

    .shopwr-iv-form-compact {
        padding: 8px;
        border-radius: 6px;
    }

    .shopwr-iv-title {
        font-size: 16px;
    }

    .shopwr-iv-upload-area {
        padding: 16px 10px;
        min-height: 100px;
    }

    .shopwr-iv-instructions-hints {
        flex-direction: column;
        gap: 6px;
    }

    .shopwr-iv-result-actions {
        flex-direction: column;
    }

    .shopwr-iv-download-btn,
    .shopwr-iv-new-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Disabled State (Feature unavailable)
   ============================================ */
.shopwr-iv-disabled {
    text-align: center;
    padding: 24px;
    background: #f5f5f5;
    border-radius: 8px;
    color: #888;
    font-size: 14px;
}

.shopwr-iv-login-required {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.shopwr-iv-login-required p {
    margin: 0 0 16px;
    color: #495057;
    font-size: 15px;
}

.shopwr-iv-login-required .button {
    display: inline-block;
    padding: 10px 24px;
    background: #6366f1;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.shopwr-iv-login-required .button:hover {
    background: #4f46e5;
    color: #fff;
}
