/* e-Karta Studio 3D - Main Stylesheet */
/* Extracted from studio.html embedded styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0f0f0f;
    color: #fff;
    font-family: 'Inter', -apple-system, sans-serif;
    height: 100vh;
    overflow: hidden;
    /* Prevent pinch zoom on mobile */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Prevent zoom on all elements */
html {
    touch-action: manipulation;
}

/* 
 * Modal styling - Each modal manages its own layout.
 * Only apply specific adjustments where truly needed.
 */
.swal2-popup {
    /* SweetAlert popups may need slight adjustment to avoid AI bar overlap */
    margin-bottom: 80px;
}

/* ======================================== AI BAR ======================================== */
#builder-interface {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.builder-bar {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 50px;
    padding: 8px 8px 8px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#builder-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    outline: none;
}

#builder-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.builder-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0071e3, #00c6ff);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.4);
}

.builder-send-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 25px rgba(0, 198, 255, 0.5);
}

/* Magic Particles */
.magic-container {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 150px;
    pointer-events: none;
    z-index: 9998;
    overflow: visible;
}

.magic-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #fff, transparent);
    border-radius: 50%;
    bottom: 0;
    opacity: 0;
    animation: magicRise 1.5s ease-out forwards;
}

@keyframes magicRise {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
        transform: translateY(-10px) scale(1);
    }

    100% {
        transform: translateY(-120px) scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* ======================================== STUDIO ======================================== */
#studio-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 100px;
    background: #0a0a0a;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    transition: opacity 0.5s, transform 0.5s;
}

.studio-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.98);
}

.studio-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Toolbar */
#studio-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#studio-product-name {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.9rem;
}

.type-badge {
    background: linear-gradient(135deg, #0071e3, #00c6ff);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
}

.toolbar-metrics span {
    margin-left: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.studio-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.studio-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

/* 3D Stage */
#studio-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(ellipse at center, #1a1a1a 0%, #050505 100%);
}

#studio-stage.place-mode {
    cursor: crosshair;
}

#studio-stage.view-mode {
    cursor: grab;
}

#studio-stage.move-mode {
    cursor: move;
}

#studio-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Mode Indicator */
#mode-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#mode-indicator.visible {
    opacity: 1;
}

/* AI Response in Studio */
#studio-ai-response {
    position: fixed;
    bottom: 280px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.95), rgba(0, 198, 255, 0.95));
    color: white;
    padding: 18px 36px;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 600;
    max-width: 85%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 113, 227, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    z-index: 99999;
}

#studio-ai-response.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

#studio-ai-response.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
}

/* Controls - Main definition at line ~1374 with !important rules */

#studio-controls::-webkit-scrollbar {
    width: 6px;
}

#studio-controls::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

#studio-controls::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.studio-controls-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(20px);
}

.studio-controls-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

#studio-controls label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

#studio-controls input[type="range"] {
    width: 100%;
    height: 4px;
    accent-color: #00c6ff;
    margin-bottom: 14px;
    cursor: pointer;
}

#studio-controls input[type="color"] {
    width: 100%;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    margin-bottom: 14px;
}

/* Section Divider */
.ctrl-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ctrl-section-title {
    font-size: 11px;
    color: #00ff88;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Logo Buttons */
.btn-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.btn-logo:last-child {
    margin-bottom: 0;
}

.btn-upload {
    background: linear-gradient(135deg, #0071e3, #00c6ff);
}

.btn-upload:hover {
    box-shadow: 0 4px 15px rgba(0, 113, 227, 0.4);
}

.btn-upload.active {
    background: linear-gradient(135deg, #00ff88, #00c6ff);
}

.btn-move {
    background: linear-gradient(135deg, #ff9500, #ffcc00);
}

.btn-move:hover {
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.4);
}

.btn-move.active {
    background: linear-gradient(135deg, #00ff88, #00c6ff);
}

.btn-delete {
    background: linear-gradient(135deg, #ff3b30, #ff6b6b);
}

.btn-delete:hover {
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
}

.btn-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* === DESKTOP CUSTOMIZATION GRID === */
@media (min-width: 769px) {

    /* Hide accordion toggle buttons on desktop */
    .group-toggle {
        display: none !important;
    }

    /* Show sub-buttons directly as grid */
    .customization-group {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-top: 8px !important;
        padding-left: 0 !important;
        border-left: none !important;
    }

    /* Compact button style for grid */
    .customization-group .btn-logo {
        flex-direction: column;
        padding: 10px 6px;
        font-size: 10px;
        gap: 4px;
        margin-bottom: 0;
        min-height: 60px;
    }

    .customization-group .btn-logo .btn-icon {
        font-size: 18px;
    }

    .customization-group .btn-logo .btn-label {
        font-size: 9px;
        text-align: center;
        line-height: 1.2;
        word-break: break-word;
    }
}

/* Layer Manager */
.layer-item {
    position: relative;
    /* Required for popup positioning */
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    overflow: visible;
    /* Allow popup to overflow */
}

.layer-item.selected {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.layer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    background: linear-gradient(135deg, #0071e3, #00c6ff);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    padding: 0 6px;
    margin-right: 10px;
    flex-shrink: 0;
}

.layer-thumb {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    background-color: #333;
    border-radius: 4px;
    margin-left: 6px;
    flex-shrink: 0;
    object-fit: contain;
    font-size: 14px;
    overflow: hidden;
}

.layer-info {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.3px;
}

.layer-info .layer-number {
    color: #00c6ff;
    font-weight: 700;
}

.layer-controls {
    display: flex;
    align-items: center;
    gap: 0;
}

.layer-actions {
    display: flex;
    gap: 2px;
}

.layer-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
}

.layer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.layer-status-icon {
    font-size: 14px;
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.layer-status-icon.warn {
    color: #ffcc00;
}

.layer-status-icon.success {
    color: #00ff88;
}

/* Floating popup for rotation/size controls */
.layer-tool-popup {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    /* Cover the layer-item itself */
    background: rgba(30, 30, 30, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    z-index: 200;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: none;
    /* Changed from default flex to none */
}

.popup-thumb {
    width: 32px;
    height: 32px;
    background-color: #333;
    border-radius: 4px;
    flex-shrink: 0;
}

.popup-value {
    font-size: 13px;
    color: #00ff88;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
    background: rgba(0, 255, 136, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.layer-tool-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layer-tool-popup-title {
    font-size: 12px;
    font-weight: 600;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-tool-popup-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.layer-tool-popup-close:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.layer-tool-popup input[type="range"] {
    width: 100%;
    margin-top: 6px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

/* Slider thumb - Webkit (Chrome, Safari) */
.layer-tool-popup input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #888888;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.layer-tool-popup input[type="range"]::-webkit-slider-thumb:hover {
    background: #aaaaaa;
    transform: scale(1.1);
}

/* Slider thumb - Firefox */
.layer-tool-popup input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #888888;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.layer-tool-popup input[type="range"]::-moz-range-thumb:hover {
    background: #aaaaaa;
}

.layer-tool-popup-value {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-top: 4px;
}

/* ==================== TEXT EDITOR MODAL ==================== */
.text-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.text-editor-container {
    background: rgba(30, 30, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    /* No margin needed - flexbox parent handles centering */
}

.text-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    /* Reduced from 16px */
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.text-editor-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.text-editor-close-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.text-editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.text-editor-toolbar select,
.text-editor-toolbar input[type="number"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    padding: 6px 10px;
    font-size: 12px;
}

.text-editor-toolbar select option {
    background: #222;
    color: white;
}

.text-editor-toolbar input[type="color"] {
    width: 36px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.text-tool-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
}

.text-tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.text-tool-btn.active {
    background: rgba(0, 198, 255, 0.3);
    border-color: rgba(0, 198, 255, 0.5);
}

.text-editor-preview {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    min-height: 60px;
    /* Reduced from 120px */
    padding: 10px;
    color: white;
    font-size: 24px;
    text-align: center;
    outline: none;
    margin-bottom: 10px;
    /* Reduced from 16px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-editor-preview:empty::before {
    content: attr(data-placeholder);
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.text-editor-preview:focus {
    border-color: rgba(0, 198, 255, 0.5);
}

.text-editor-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-primary {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 10px 20px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Advanced Text Editor Sections */
.text-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px;
    /* Reduced from 12px */
    margin-bottom: 6px;
    /* Reduced from 10px */
}

.text-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #00c6ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    /* Reduced from 10px */
}

.text-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
    /* Reduced from 8px */
}

.text-row:last-child {
    margin-bottom: 0;
}

.text-row select,
.text-row input[type="number"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: white;
    padding: 6px 10px;
    font-size: 12px;
}

.text-row select option {
    background: #1a1a1a;
    color: white;
}

.text-row input[type="color"] {
    width: 36px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.text-row input[type="color"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.text-row input[type="number"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.text-label {
    font-size: 11px;
    color: #aaa;
    min-width: 50px;
}

.text-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #ccc;
    cursor: pointer;
}

.text-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00c6ff;
    cursor: pointer;
}

#logo-upload {
    display: none;
}

/* Logo Size Control */
#logo-controls {
    display: none;
}

#logo-controls.visible {
    display: block;
}

/* Footer */
#studio-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.price-display span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

#studio-price {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00ff88, #00c6ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: 10px;
}

.btn-checkout {
    background: linear-gradient(135deg, #0071e3, #00c6ff);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(0, 113, 227, 0.3);
}

.btn-checkout:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 198, 255, 0.4);
}

/* AI Messages */
.ai-msg {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.25);
    color: #00ff88;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 14px;
    z-index: 9500;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.4s, fadeOut 0.4s 2.5s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

@keyframes progressPulse {
    0% {
        width: 5%;
        opacity: 0.8;
    }

    50% {
        width: 70%;
        opacity: 1;
    }

    100% {
        width: 95%;
        opacity: 0.8;
    }
}

/* Response Title (Large Apple-style background text) */
#response-title {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    max-width: 70%;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    z-index: 8500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    text-shadow: 0 0 60px rgba(0, 198, 255, 0.4);
}

#response-title.visible {
    opacity: 1;
}

#response-title.fade-out {
    opacity: 0;
}

/* Placeholder hint */
#hint-text {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.2);
    z-index: 8000;
    pointer-events: none;
    transition: opacity 0.5s;
}

#hint-text.hidden {
    opacity: 0;
}

/* In-Studio AI Response Display (Override) */
#studio-ai-response {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.4;
    text-align: center;
    z-index: 9100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#studio-ai-response.visible {
    opacity: 1;
    pointer-events: auto;
}

#studio-ai-response.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

#studio-ai-response::before {
    content: '🤖';
    margin-right: 10px;
}

/* ======================================== FOOTER & CHECKOUT ======================================== */
#studio-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.price-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.price-display strong {
    font-size: 20px;
    color: #00ff88;
    font-weight: 700;
}

.btn-checkout {
    padding: 14px 28px;
    background: linear-gradient(135deg, #00ff88, #00c6ff);
    border: none;
    border-radius: 30px;
    color: #000;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.5);
}

.btn-checkout:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ======================================== MOBILE RESPONSIVE ======================================== */
@media (max-width: 768px) {

    /* Controls Panel -> Bottom Sheet */
    #studio-controls {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        min-width: 0;
        max-height: 55vh;
        overflow-y: auto;
        border-radius: 24px 24px 0 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding-bottom: 100px;
        padding-top: 20px;
        z-index: 9050;
        transform: translateY(0);
        transition: transform 0.3s ease;
    }

    /* Mobile: reduce modal max-heights */
    .text-editor-container {
        max-height: 80vh;
    }

    #studio-controls.collapsed {
        transform: translateY(calc(100% - 50px));
    }

    /* Mobile Toggle Handle - HIDDEN as per user request */
    #studio-controls::before {
        display: none;
    }

    /* Stage adjusts for bottom sheet */
    #studio-stage {
        height: calc(100vh - 60px);
    }

    /* Larger touch targets for buttons */
    .btn-logo {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 14px;
    }

    .product-btn,
    .size-btn {
        min-height: 44px !important;
        padding: 12px 16px !important;
    }

    /* AI Bar adjustments */
    #builder-interface {
        z-index: 10000;
        padding: 10px 15px 20px;
    }

    .builder-bar {
        padding: 6px 6px 6px 16px;
    }

    #builder-input {
        font-size: 16px;
    }

    /* Footer */
    #studio-footer {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }

    .btn-checkout {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }

    /* Mobile Bottom Sheet Primary Actions */
    /* Mobile Bottom Sheet Primary Actions */
    #studio-controls .ctrl-section:has(#btn-place-logo) {
        /* position: sticky; removed as per user request */
        /* top: 0; */
        /* z-index: 10; */
        /* background: rgba(10, 10, 10, 0.98); kept for visibility but scrolls now */
        margin-top: 0;
        padding-top: 10px;
        padding-bottom: 15px;
        border-top: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Mobile horizontal layout for personalization buttons */
    #studio-controls .ctrl-section:has(#btn-place-logo) {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    #studio-controls .ctrl-section:has(#btn-place-logo) .ctrl-section-title {
        width: 100%;
        margin-bottom: 5px;
    }

    #studio-controls .ctrl-section:has(#btn-place-logo) .btn-logo {
        flex: 1 1 calc(50% - 4px);
        margin-top: 0 !important;
        min-height: 44px;
    }

    /* Hide file input */
    #logo-upload {
        display: none;
    }

    /* Mobile Text/AI Editor Modal adjustments */
    .text-editor-modal {
        align-items: flex-start;
        padding-top: 20px;
        overflow-y: auto;
    }

    .text-editor-container {
        width: 95% !important;
        max-width: none !important;
        max-height: 85vh !important;
        padding: 15px;
        margin-bottom: 50px;
    }

    /* AI Generator modal - reduced height on mobile */
    #ai-generator-modal .text-editor-container {
        max-height: calc(85vh - 100px) !important;
    }
}

/* ==================== STUDIO CONTROLS (SIDEBAR) ==================== */
/* User Request: Well delimited, visible scroll, not overlapping header, mobile optimized */
#studio-controls {
    position: fixed !important;
    /* Changed to fixed to ensure it stays relative to viewport */
    top: 80px !important;
    transform: none !important;
    /* CRITICAL: Reset inherited translateY(-50%) */
    right: 20px !important;
    width: 350px !important;
    /* Increased width to prevent squishing */
    max-height: calc(100vh - 180px) !important;
    overflow: hidden !important;
    margin-top: 0 !important;

    /* Visuals */
    background: rgba(15, 15, 20, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 0 !important;
    /* Removed padding from parent (moved to children) */
    z-index: 1000 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;

    display: flex !important;
    flex-direction: column !important;
    padding-bottom: 0 !important;
}

/* Scrollable Content Wrapper */
#studio-controls-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    /* Moved padding here for standard scrollbar look */
    min-height: 0;
    /* Crucial for nested flex scrolling */

    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#studio-controls-scroll::-webkit-scrollbar {
    width: 6px;
}

#studio-controls-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#studio-controls-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

/* Sticky Footer (Request Quote) */
#studio-controls-footer {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 10px !important;
    padding: 15px 16px 20px 16px !important;
    /* Added side padding */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Mobile specific overrides */
@media (max-width: 768px) {
    #studio-controls {
        top: auto !important;
        bottom: 85px !important;
        /* Above agent bar (~80px) */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 55vh !important;
        /* Reduced to fit with agent bar */
        border-radius: 20px 20px 0 0 !important;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        padding: 16px !important;
        padding-bottom: 80px !important;
        /* Extra space for quote button visibility */
        transform: translateY(0) !important;
        margin: 0 !important;
    }

    #studio-controls.studio-controls-hidden {
        transform: translateY(120%) !important;
        opacity: 0;
    }

    /* Ensure gear icon is above everything */
    #mobile-controls-toggle {
        position: fixed !important;
        bottom: 95px !important;
        right: 15px !important;
        z-index: 60001 !important;
        /* Above builder-interface */
    }
}

/* Ensure AI Builder Bar is always visible above ALL modals */
#builder-interface {
    z-index: 60000 !important;
    /* Above confirm modal (50000) */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: auto;
}

/* If it's fixed in mobile/desktop logic, this z-index will apply */

/* Ensure Approval Modal is strictly on top of EVERYTHING including the builder bar */
#image-approval-modal {
    z-index: 25000 !important;
}

/* Confirmation modal - FORCE complete viewport coverage */
#confirm-action-modal {
    position: fixed !important;
    inset: 0 !important;
    /* Shorthand for top:0 right:0 bottom:0 left:0 */
    width: 100% !important;
    height: 100% !important;
    /* CRITICAL: Override the generic [id*="modal"] rule that limits height */
    max-height: none !important;
    margin-bottom: 0 !important;
    z-index: 999999 !important;
    /* Higher than EVERYTHING including builder bar */
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* Disable the ::before pseudo-element for this modal */
#confirm-action-modal::before {
    display: none !important;
}