/* ============================================================================
   SIMAS CONFIGURATORE 3D — Style  ver S.1.0.1
   Layout: top-bar  +  full-width 3D canvas  +  bottom panel
   ============================================================================ */

/* === RESET & BASE === */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    background: #f5f5f5;
}

/* ============================================================================
   WELCOME OVERLAY — Login (Screen 1)
   ============================================================================ */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background-color: #ffffff;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.welcome-logo-wrap {
    text-align: center;
    padding: 30px 20px 0;
    width: 100%;
}

.welcome-logo {
    height: 40px;
}

.welcome-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 700px;
    width: 90%;
    padding: 2rem;
    text-align: center;
}

.welcome-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.btn-welcome {
    padding: 1rem 3rem;
    background-color: #ffffff;
    color: #000;
    border: 1px solid #000;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    min-width: 220px;
}

.btn-welcome:hover {
    background-color: #000;
    color: #fff;
}

.btn-welcome:active,
.btn-welcome:focus {
    background-color: #000;
    border-color: #000;
    color: #fff;
    box-shadow: none;
    outline: none;
}

/* Login/Register modals must appear ABOVE the welcome overlay (z-index 2000) */
#loginModal, #registerModal, #changePasswordModal, #forgotPasswordModal {
    z-index: 2050;
}

/* Dark blurred backdrop when modals open over the welcome overlay */
.modal-backdrop.show {
    opacity: 0.55;
}

.modal-backdrop {
    background-color: #000;
    z-index: 2040;
}

/* Blur effect on welcome overlay when a modal is open */
body.modal-open .welcome-overlay {
    filter: blur(4px);
    transition: filter 0.2s ease;
}

/* Registration form dynamic fields invalid state */
.profile-field.is-invalid {
    border-color: #dc3545;
}

/* ============================================================================
   TOP BAR — Fixed header (Screens 2-5)
   ============================================================================ */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
}

.top-bar-logo {
    text-align: center;
    padding: 12px 20px 4px;
}

.header-logo {
    height: 28px;
}

.collection-subtitle {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #999;
    margin-top: 2px;
    min-height: 14px;
}

.top-bar-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    gap: 20px;
}

/* === Category Navigation Tabs === */
.category-nav {
    display: flex;
    gap: 30px;
    padding: 0;
    margin: 0;
    list-style: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-tab {
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 400;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
    letter-spacing: 0.5px;
}

.category-tab:hover {
    color: #000;
}

.category-tab.active {
    color: #000;
    font-weight: 700;
}

.category-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #000;
}

/* === Icons Row (below nav, right-aligned inside canvas-width container) === */
.top-bar-icons-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px 20px 4px;
}

/* === Toolbar Icons === */
.toolbar-icons {
    display: flex;
    align-items: flex-end;
    gap: 22px;
    flex-shrink: 0;
}

.icon-btn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.icon-btn-wrap .icon-label {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
    font-size: 22px;
    padding: 0;
}

.icon-btn:hover,
.icon-btn-wrap:hover .icon-btn {
    color: #000;
}

.icon-btn-wrap:hover .icon-label {
    color: #000;
}

.icon-btn i {
    font-size: 22px;
    line-height: 1;
}

/* === Ambienti Section === */
.ambienti-section {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-shrink: 0;
}

.ambienti-label {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    letter-spacing: 0.5px;
}

.ambienti-num {
    font-size: 14px;
    color: #999;
    cursor: pointer;
    transition: color 0.15s;
    padding: 4px 2px;
}

.ambienti-num:hover {
    color: #000;
}

.ambienti-num.active {
    color: #000;
    font-weight: 700;
}

/* Ambienti mobile dropdown — hidden on desktop */
.ambienti-dropdown-mobile {
    display: none;
}

.ambienti-dropdown-toggle {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ambienti-dropdown-toggle i {
    font-size: 16px;
}

/* Mobile 3-dots toggle — hidden on desktop */
.mobile-icons-toggle {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    margin-left: 8px;
    color: #000;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.mobile-icons-toggle i {
    font-size: 22px;
}

/* === Canvas floating delete button === */
.canvas-delete-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.15s;
    z-index: 10;
}

.canvas-delete-btn:hover {
    color: #d00;
    border-color: #d00;
}

/* AR button — top-right corner of canvas */
/* AR button — top-right corner of the actual canvas (.page-content) */
.page-content > .ar {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 20;
    margin: 0;
    padding: 0;
    line-height: 0;
    pointer-events: auto;
}

.page-content > .ar a {
    display: inline-block;
    width: 48px;
    height: 48px;
    line-height: 0;
    padding: 0;
    overflow: hidden;
}

.page-content > .ar a:hover {
    border-color: #999;
}

.page-content > .ar img {
    display: block;
    width: 48px !important;
    height: 48px !important;
}

/* Delete button — top-left corner of the actual canvas */
.page-content > .canvas-delete-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 20;
}

/* ============================================================================
   CATEGORY DROPDOWN (Screen 3)
   ============================================================================ */
.category-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 90;
    display: none;
    padding: 20px 40px;
    border-top: 1px solid #f0f0f0;
}

.category-dropdown.open {
    display: block;
}

.collection-link {
    display: block;
    padding: 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    color: #666;
    text-decoration: none;
    transition: color 0.15s;
}

.collection-link:hover {
    color: #000;
}

.collection-link:first-child {
    font-weight: 700;
    color: #000;
}

/* ============================================================================
   3D CANVAS
   ============================================================================ */
.canvas-container {
    position: fixed;
    top: 171px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
}

.page-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.page-content.nopadding {
    padding: 0;
}

.page-content.nopadding canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ============================================================================
   SCENE LOADER — overlay shown while a product loads or a finish changes
   ============================================================================ */
.scene-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.scene-loader.visible {
    display: flex;
}

.scene-loader-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(0, 0, 0, 0.12);
    border-top-color: #000;
    border-radius: 50%;
    animation: scene-loader-spin 0.8s linear infinite;
}

@keyframes scene-loader-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   BOTTOM PANEL (Screens 4-5)
   ============================================================================ */
.bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 260px;
    background: rgba(255, 255, 255, 0.3);
    /*backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);*/
    display: flex;
    border-top: 1px solid rgba(232, 232, 232, 0.6);
    z-index: 110;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.bottom-panel.visible {
    transform: translateY(0);
}

.bottom-panel-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
}

.bottom-panel-close:hover {
    color: #333;
}

/* === Products Section (left, 2/3) === */
.bottom-panel-products {
    flex: 2;
    min-width: 0;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid rgba(240, 240, 240, 0.7);
}

.product-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.product-tab-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}

.product-tab-btn.active {
    color: #000;
    font-weight: 700;
    border-bottom: 2px solid #000;
}

.product-thumbnails {
    display: flex;
    gap: 20px;
    flex: 1;
    align-items: center;
    padding-bottom: 5px;
    min-width: 0;
}

/* Quando slick e' attivo l'overflow lo gestisce lui; non usiamo flex */
.product-thumbnails.slick-initialized {
    display: block;
    padding: 0 30px;
}

.product-thumbnails .slick-slide {
    margin-right: 20px;
}

.product-thumbnails .slick-prev,
.product-thumbnails .slick-next {
    width: 24px;
    height: 24px;
    z-index: 2;
}

.product-thumbnails .slick-prev { left: 0; }
.product-thumbnails .slick-next { right: 0; }

.product-thumbnails .slick-prev:before,
.product-thumbnails .slick-next:before {
    color: #333;
    font-size: 22px;
    opacity: 0.85;
}

.product-thumb {
    min-width: 120px;
    max-width: 120px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.product-thumb:hover {
    opacity: 0.8;
}

.product-thumb.active {
    opacity: 1;
}

.product-thumb img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 4px;
}

.product-thumb-code {
    font-size: 11px;
    margin-top: 4px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-thumb.active .product-thumb-code {
    font-weight: 700;
    color: #000;
}

/* Dim non-selected products */
.product-thumbnails.has-selection .product-thumb:not(.active) {
    opacity: 0.4;
}

/* === Finishes Section (right, 1/3) === */
.bottom-panel-finishes {
    flex: 1;
    min-width: 0;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.finishes-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0 0 8px;
    color: #333;
}

.finish-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.finish-tab {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
}

.finish-tab.active {
    color: #000;
    font-weight: 600;
    border-bottom: 1px solid #000;
}

.finish-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
    scrollbar-width: thin;
    scrollbar-color: #ddd #f8f8f8;
    padding-right: 4px;
}

.finish-swatches::-webkit-scrollbar {
    width: 4px;
}

.finish-swatches::-webkit-scrollbar-track {
    background: #f8f8f8;
}

.finish-swatches::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.finish-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.15s, border-color 0.15s;
}

.finish-swatch:hover {
    transform: scale(1.15);
}

.finish-swatch.active {
    border-color: #333;
}

.finish-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.finishes-empty {
    color: #999;
    font-size: 13px;
    padding: 20px 0;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    .top-bar,
    .bottom-panel,
    .welcome-overlay,
    .toolbar-icons {
        display: none !important;
    }

    .canvas-container {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* ============================================================================
   RESPONSIVE — Tablet (769px - 1024px)
   ============================================================================ */
@media (max-width: 1024px) {
    .product-thumb {
        min-width: 100px;
        max-width: 100px;
    }
}

/* ============================================================================
   RESPONSIVE — Mobile (<= 768px)
   ============================================================================ */
@media (max-width: 768px) {
    /* Top bar */
    .top-bar {
        position: sticky;
    }

    .top-bar-logo {
        padding: 8px 15px 2px;
    }

    .header-logo {
        height: 22px;
    }

    .collection-subtitle {
        font-size: 9px;
    }

    .top-bar-nav-row {
        padding: 0 10px;
    }

    .category-nav {
        gap: 15px;
    }

    .category-tab {
        font-size: 12px;
        padding: 10px 0;
    }

    /* Icons row — hidden by default, shown as dropdown when .mobile-open */
    .top-bar-icons-row {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        padding: 12px 16px;
        z-index: 95;
        border: 1px solid #f0f0f0;
        border-radius: 4px;
        margin-top: 4px;
        max-width: 90vw;
    }

    .top-bar-icons-row.mobile-open {
        display: block;
    }

    .toolbar-icons {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .icon-btn-wrap {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .icon-btn-wrap .icon-label {
        font-size: 12px;
        margin-top: 0;
        color: #000;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .icon-btn i {
        font-size: 20px;
    }

    /* Ambienti: hide inline numbers, show dropdown */
    .ambienti-section .ambienti-label-desktop,
    .ambienti-section > .ambienti-num {
        display: none;
    }

    .ambienti-dropdown-mobile {
        display: inline-block;
    }

    .ambienti-section {
        gap: 6px;
    }

    /* Show 3-dots toggle on mobile */
    .mobile-icons-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Canvas — fills remaining space (only logo + nav rows on mobile) */
    .canvas-container {
        position: relative;
        top: auto;
        height: calc(100vh - 95px);
    }

    /* Category dropdown */
    .category-dropdown {
        padding: 15px 20px;
    }

    .collection-link {
        font-size: 13px;
        padding: 10px 0;
    }

    /* Bottom panel — stacks vertically */
    .bottom-panel {
        flex-direction: column;
        height: 55vh;
        overflow-y: auto;
    }

    .bottom-panel-products {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        flex: none;
        min-height: 180px;
    }

    .bottom-panel-finishes {
        width: 100%;
        flex: 1;
        min-height: 160px;
    }

    .product-thumb {
        min-width: 90px;
        max-width: 90px;
    }

    .finish-swatch {
        width: 32px;
        height: 32px;
    }

    /* Welcome overlay — responsive buttons */
    .welcome-logo-wrap {
        padding: 20px 15px 0;
    }

    .welcome-logo {
        height: 32px;
    }

    .welcome-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .btn-welcome {
        padding: 0.8rem 2rem;
        font-size: 0.8rem;
        min-width: 0;
        width: 100%;
    }
}

/* ============================================================================
   RESPONSIVE — Small mobile (<= 480px)
   ============================================================================ */
@media (max-width: 480px) {
    .welcome-logo {
        height: 28px;
    }

    .btn-welcome {
        padding: 0.75rem 1.5rem;
        font-size: 0.75rem;
    }

    .product-thumb {
        min-width: 80px;
        max-width: 80px;
    }

    .bottom-panel-finishes {
        min-height: 140px;
    }
}
