@font-face {
    font-family: 'Montserrat';
    src: url('./fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #DA5060;
    --secondary-color: #ff6b7a;
    --white-color: #FFFFFF;
    --black-color: #000000;
    --bg-color:#f6f4f0;
    --gray-color: #1c1c1c;
    --light-gray-color: #f6f4f0;

    --colore-titolo-gruppo: #1c1c1c;
    --sfondo-colonna-gruppo: #ffffff;
    --sfondo-gruppo: #f6f4f0;
    --sfondo-pulsante-gruppo-attivo: #1c1c1c;
    --colore-titolo-sottogruppo: #1c1c1c;
    --colore-titolo-texture-selezionate: #1c1c1c;
    --colore-percentuale-texture-selezionate: #1c1c1c;
    --sfondo-percentuale-texture-selezionate: #f6f4f0;
    --sfondo-colonna-texture-selezionate: #ffffff;

    --logo-altezza: 35px;
    --logo-larghezza: auto;
    --logo-offset-x: 0;
    --logo-offset-y: 0;

}

/* ===== LOADER CON BARRA DI PROGRESSO ===== */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.app-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    position: relative;
    text-align: center;
    max-width: 400px;
    padding: 40px;
    transform: translateY(30px);
}

.loader-logo {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
    /* Dimensioni saranno impostate dinamicamente via JavaScript */
}

.loader-logo img {
    opacity: 1;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--gray-color);
    margin-bottom: 20px;
    min-height: 24px;
}

.loader-progress {
    width: 250px;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 10px;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.loader-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

* {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
}

/* Nascondi controlli mobile su desktop */
.mobile-controls {
    display: none;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Nascondi il contenuto principale durante il caricamento */
body.loading .main-content {
    opacity: 0;
    pointer-events: none;
}

/* ===== HEADER MODERNO ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.help-button {
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-button svg {
    width: 24px;
    height: 24px;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-button:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.help-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-right {
    display: flex;
    align-items: center;
}

.logo {
    height: var(--logo-altezza);
    width: var(--logo-larghezza);
    object-fit: contain;
    color: #1c1c1c;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transform: translate(var(--logo-offset-x), var(--logo-offset-y));
}

/* Logo specifico per l'header */
.logo-header {
    height: var(--logo-altezza);
    width: var(--logo-larghezza);
    object-fit: contain;
    color: #1c1c1c;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transform: translate(var(--logo-offset-x), var(--logo-offset-y));
}

/* Logo specifico per il loader */
.logo-loader {
    opacity: 1;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Responsive header */
@media (max-width: 768px) {
    .header {
        padding: 0 10px;
        height: 60px;
    }
    
    .help-button {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .help-button svg {
        width: 20px;
        height: 20px;
    }
    
    .logo {
        height: 25px;
        padding-top: 7px;
    }
}

canvas {
    display: block;
}

h4 {
    text-transform: uppercase;
}

/* ===== LAYOUT A DUE COLONNE ===== */
#ui {
    position: absolute;
    top: 90px; /* Spazio per l'header fisso */
    left: 20px;
    background: var(--sfondo-colonna-gruppo);
    padding: 20px;
    border-radius: 12px;
    overflow-y: auto;
    width: 300px;
    max-height: calc(100vh - 220px); /* Spazio per header + bottoni + 20px margine */
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 15px;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#ui.show {
    opacity: 1;
    visibility: visible;
}

#ui.introanimation {
    transform: translateX(0);
}

.collection {
    background: var(--sfondo-gruppo);
    border-radius: 6px;
    padding: 10px;
}

#selectedTextures {
    position: relative;
    width: 100%;
    background: transparent;
    padding: 0;
    border-radius: 0;
    overflow: visible;
    border: none;
    box-shadow: none;
    z-index: auto;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
}

#rightPanelContainer {
    position: absolute;
    top: 90px; /* Spazio per l'header fisso */
    right: 20px;
    background: var(--sfondo-colonna-texture-selezionate);
    padding: 20px;
    border-radius: 12px;
    overflow-y: auto;
    width: 300px;
    max-height: calc(100vh - 220px); /* Spazio per header + bottoni + 20px margine */
    border: 1px solid rgba(0, 0, 0, 0.08);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: opacity 0.6s ease, visibility 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#rightPanelContainer.show {
    opacity: 1;
    visibility: visible;
}

#rightPanelContainer.introanimation {
    transform: translateX(0);
}

/* ===== PANEL CONTENT STYLES ===== */
.panel-content {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    position: relative;
    width: 100%;
    height: auto;
    display: block;
}

.panel-content.hidden-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: -1 !important;
}

.panel-content.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    z-index: 1 !important;
}

#ui h4 {
    position: relative;
    color: var(--colore-titolo-gruppo);
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
}

#selectedTextures h4 {
    position: relative;
    margin-bottom: 15px;
    color: var(--gray-color);
    font-weight: 700;
    font-size: 16px;
    text-align: left;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--colore-titolo-texture-selezionate);
}

/* ===== BOTTONI DI CONTROLLO ===== */
.control-buttons {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50% !important;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 18px;
}

.control-btn .btn-icon {
    width: 24px;
    height: 24px;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bg-color-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.bg-color-btn:hover {
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.btn-icon {
    font-size: 20px;
    line-height: 1;
}

.hidden-color-input {
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== BOTTONI CONTROLLO COLONNA CENTRALE ===== */
.center-panel-controls {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 1000;
}

.panel-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative;
}

.panel-btn .btn-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-color);
    white-space: nowrap;
    pointer-events: none;
}

.panel-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.panel-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.panel-btn.active:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.panel-btn .btn-icon {
    width: 24px;
    height: 24px;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.group-option {
    display: flex;
}

/* ===== BOTTONI ESPORTAZIONE ===== */
#exportImage, #export3D {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-color);
}

#exportImage:hover, #export3D:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

#exportImage:active, #export3D:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#exportImage:disabled, #export3D:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#exportImage:disabled:hover, #export3D:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.export-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--gray-color);
    border: 1px solid var(--gray-color);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-text {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-color);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BOTTONI GRUPPI ===== */
.group-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.group-button:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.group-button.active {
    border-color: var(--primary-color);
    background: var(--sfondo-pulsante-gruppo-attivo);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.group-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--gray-color);
    border: 1px solid var(--gray-color);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-button.active .group-icon {
    color: var(--primary-color);
    background: var(--white-color);
    border-radius: 2px;
}

.group-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-color);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-button.active .group-name {
    color: var(--white-color);
}

.apply-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

#groutColorPreview, #adhesiveColorPreview {
    width: 100%;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    box-sizing: border-box;
}

.color-box {
    width: 30px;
    height: 30px;
    cursor: pointer;
    border: 3px solid var(--light-gray-color);
    box-sizing: border-box;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.color-box:hover {
    border: 3px solid var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-box.selected {
    border: 3px solid var(--primary-color);
}

label {
    position: relative;
    display: block;
    font-weight: bold;
    padding: 10px 0;
}

#textureLibrary img {
    position: relative;
    width: 30px;
    height: 30px;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 6px;
}

#textureLibrary img.selected {
    border-color: var(--primary-color);
}

.selected-texture {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.selected-texture img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 8px;
}

.selected-texture button {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Stili per i controlli delle linee di colla */
#showAdhesiveLines {
    margin-right: 8px;
}

#adhesiveThicknessSlider {
    margin: 0 10px;
}

#adhesiveThicknessValue {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
}

#apply {
    position: relative;
    display: block;
    margin-top: 45px;
    padding: 10px;
    min-width: 150px;
    width: 100%;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 100px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 2;
}

#apply span {
    position: relative;
    z-index: 3;
}

#apply::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #03a9f4, #f441a5, #ffeb3b, #03a9f4);
    background-size: 300% 300%;
    animation: animate 8s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    border-radius: 100px;
}

button:not(#apply) {
    padding: 10px;
    border-radius: 5px;
    border: none;
}

/* Animazioni */
@keyframes animate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#apply:hover::before {
    opacity: 1;
}

#modelViewer {
    visibility: hidden;
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Stili per i button toggle */
.toggle-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-color);
}

.toggle-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toggle-btn.active {
    border-color: var(--primary-color);
    background: var(--gray-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.toggle-btn.active .toggle-text {
    color: var(--white-color);
}

.toggle-btn.active .toggle-icon {
    color: var(--primary-color);
    background: var(--white-color);
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--gray-color);
    border: 1px solid var(--gray-color);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-text {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-color);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stili per i color picker personalizzati */
.custom-color-picker-container {
    margin-top: 15px;
}

.custom-color-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
}

.custom-color-input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.custom-color-input {
    flex: 1;
    width: 100%;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.custom-color-input:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-color-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-color-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
}

.custom-color-btn:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--gray-color);
}

.custom-color-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Separatore tra sezioni grout e colla */
.section-separator {
    margin: 20px 0;
    border-top: 1px solid var(--primary-color);
    position: relative;
}

.section-separator::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color) 20%, var(--primary-color) 80%, transparent);
}

.ar-placement-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.ar-placement-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Stili per i sottogruppi di texture */
.subgroup-title {
    font-weight: bold;
    color: var(--colore-titolo-sottogruppo);
    font-size: 15px;
    margin: 16px 0 12px 0;
    text-transform: uppercase;
}

.subgroup-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

.subgroup-texture {
    width: 30px;
    height: 30px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    transform-origin: center;
    display: block;
    outline: none;
}

.subgroup-texture img {
    outline: none;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.subgroup-texture.selected {
    border: 2px solid var(--primary-color);
}

/* Stili per le texture selezionate */
.selected-texture-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin: 5px 0;
    width: 100%;
    gap: 12px;
}

.selected-texture-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    aspect-ratio: 1/1;
    border-radius: 4px;
}

.selected-texture-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 1;
    padding: 0 8px;
}

.slider-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.percent-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--colore-percentuale-texture-selezionate);
    background: var(--sfondo-percentuale-texture-selezionate);
    border-radius: 6px;
    min-width: 50px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

/* ===== SLIDER PER TEXTURE ===== */
.texture-slider {
    flex: 1;
    height: 30px;
    border-radius: 30px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) var(--slider-progress, 0%), var(--light-gray-color) var(--slider-progress, 0%), var(--light-gray-color) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.texture-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}


.texture-slider::-moz-range-thumb {
    width: 0;
    height: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}


.texture-slider::-moz-range-track {
    height: 30px;
    border-radius: 30px;
    background: #e0e0e0;
    border: none;
}

.texture-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.texture-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
    opacity: 0.5;
}

.texture-slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
    opacity: 0.5;
}


.remove-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.remove-button:hover {
    transform: scale(1.1);
    background: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}


/* Stili per i controlli delle linee di colla */
#showAdhesiveLines {
    margin-right: 8px;
}

#adhesiveThicknessSlider {
    margin: 0 10px;
}

#adhesiveThicknessValue {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
}

/* Colori per i color-box del grout */
.grout-color-anthracite { background-color: #434950; }
.grout-color-bahama-beige { background-color: #e7d1b9; }
.grout-color-bianco { background-color: #ffffff; }
.grout-color-nero { background-color: #231f20; }
.grout-color-brown { background-color: #755953; }
.grout-color-caramel { background-color: #cea57b; }
.grout-color-cemento-grey { background-color: #cec5cc; }
.grout-color-coffee { background-color: #4b423f; }
.grout-color-dove-grey { background-color: #a79b8a; }
.grout-color-eucalyptus { background-color: #cee6c1; }
.grout-color-husky { background-color: #c9dee8; }
.grout-color-iron-grey { background-color: #a9a791; }
.grout-color-ivory { background-color: #e9d8ad; }
.grout-color-jasmin { background-color: #eceadc; }
.grout-color-light-grey { background-color: #e7e7dd; }
.grout-color-limestone { background-color: #e7d1b9; }
.grout-color-magnolia { background-color: #e5c0b0; }
.grout-color-mediterranean { background-color: #6baed5; }
.grout-color-moss { background-color: #687857; }
.grout-color-neutro { background-color: #ffffff; }
.grout-color-pearl-grey { background-color: #d1d3d4; }
.grout-color-pergamon { background-color: #cfc8b9; }
.grout-color-red { background-color: #da1f3d; }
.grout-color-silver { background-color: #e6e7e8; }
.grout-color-sunset { background-color: #cd8f91; }
.grout-color-terracotta { background-color: #cc8462; }
.grout-color-walnut { background-color: #885d3c; }
.grout-color-yellow { background-color: #fff32a; }

/* Colori per i color-box dell'adhesive */
.adhesive-color-white { background-color: #FFFFFF; }
.adhesive-color-saddle-brown { background-color: #8B4513; }
.adhesive-color-sienna { background-color: #A0522D; }
.adhesive-color-peru { background-color: #CD853F; }
.adhesive-color-chocolate { background-color: #D2691E; }
.adhesive-color-tan { background-color: #8B7355; }
.adhesive-color-sandy-brown { background-color: #F4A460; }
.adhesive-color-burlywood { background-color: #DEB887; }
.adhesive-color-tan-light { background-color: #D2B48C; }
.adhesive-color-wheat { background-color: #F5DEB3; }
.adhesive-color-beige { background-color: #F5F5DC; }

/* ===== SISTEMA DI NOTIFICHE ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    border-left: 4px solid #2196F3;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--gray-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--gray-color);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    transition: background-color 0.2s;
}

.notification-close:hover {
    background-color: #f5f5f5;
}

/* Tipi di notifiche */
.notification-success {
    border-left-color: #4CAF50;
}

.notification-success .notification-icon {
    color: #4CAF50;
}

.notification-error {
    border-left-color: #f44336;
}

.notification-error .notification-icon {
    color: #f44336;
}

.notification-warning {
    border-left-color: #ff9800;
}

.notification-warning .notification-icon {
    color: #ff9800;
}

.notification-info {
    border-left-color: #2196F3;
}

.notification-info .notification-icon {
    color: #2196F3;
}

/* ===== PRESET CAMERA ===== */
.camera-presets-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.camera-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.camera-preset-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

.camera-preset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preset-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.preset-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-color);
    text-align: center;
    line-height: 1.2;
}

.reset-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.reset-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-color);
}

.reset-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.reset-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--gray-color);
    border: 1px solid var(--gray-color);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reset-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-color);
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive */
@media (max-width: 768px) {
    #ui {
        top: 80px; /* Spazio ridotto per header mobile */
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(50vh - 100px); /* Spazio per bottoni + 20px margine */
        padding: 15px;
    }
    
    #selectedTextures {
        position: relative;
        width: 100%;
        background: transparent;
        padding: 0;
        border-radius: 0;
        overflow: visible;
        border: none;
        box-shadow: none;
        z-index: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }
    
    .control-buttons {
        bottom: 10px;
        left: 10px;
        gap: 8px;
    }
    
    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .control-btn .btn-icon {
        width: 20px;
        height: 20px;
    }
    
    .btn-icon {
        font-size: 18px;
    }
    
    .center-panel-controls {
        bottom: 50px;
        gap: 15px;
    }
    
    .panel-btn {
        width: 50px;
        height: 50px;
        border-radius: 50% !important;
    }
    
    .panel-btn .btn-icon {
        width: 20px;
        height: 20px;
    }
    
    .panel-btn .btn-label {
        font-size: 9px;
        font-weight: 700;
        bottom: -15px;
    }
    
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .notification {
        min-width: auto;
        max-width: none;
    }
    
    #exportImage, #export3D {
        padding: 10px 14px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .export-icon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }
    
    .export-text {
        font-size: 12px;
    }
    
    .reset-btn {
        padding: 10px 14px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .reset-icon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }
    
    .reset-name {
        font-size: 12px;
    }
    
    .toggle-btn {
        padding: 10px 14px;
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .toggle-icon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }
    
    .toggle-text {
        font-size: 12px;
    }
    
    .custom-color-picker-container {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .custom-color-label {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .custom-color-input {
        height: 36px;
    }
    
    .custom-color-btn {
        width: 36px;
        height: 36px;
    }
}

/* Stili per i button di ancoraggio AR */
.ar-placement-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.ar-placement-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    color: var(--gray-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    min-height: 80px;
}

.ar-placement-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-color);
}

.ar-placement-btn.active {
    border-color: var(--primary-color);
    background: var(--gray-color);
    color: var(--white-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.placement-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: inherit;
    margin-bottom: 8px;
}

.placement-name {
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
}

/* ===== HELP MODAL STYLES ===== */
.help-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.help-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.help-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.help-modal-header {
    background: linear-gradient(135deg, var(--primary-color), #e74c3c);
    color: white;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.help-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.help-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
}

.help-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.help-modal-body {
    padding: 32px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.help-modal-body::-webkit-scrollbar {
    width: 6px;
}

.help-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.help-modal-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.help-modal-body::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.help-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
}

.help-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.help-section h3 {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section ol,
.help-section ul {
    margin: 0;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #444;
}

.help-section strong {
    color: #2c3e50;
    font-weight: 600;
}

.help-tips {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 24px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    margin-top: 24px;
}

.help-tips h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.help-tips ul {
    margin-bottom: 0;
}

.help-modal-footer {
    padding: 24px 32px;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.help-close-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-close-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.help-close-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsiveness for help modal */
@media (max-width: 768px) {
    .help-modal.show {
        padding: 0; /* Rimuove padding per occupare tutto lo spazio */
        /* Stesse dimensioni delle colonne */
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: calc(100svh - 80px); /* Stessa altezza delle colonne */
        z-index: 1000; /* Stesso z-index delle colonne */
        overflow: hidden;
    }
    
    .help-modal-content {
        /* Stesse dimensioni delle colonne */
        width: 100vw;
        height: calc(100svh - 80px);
        max-width: none;
        max-height: none;
        border-radius: 0; /* Rimuove border-radius per occupare tutto lo spazio */
        /* Assicura che il contenuto non esca dalla viewport */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        background: white; /* Stesso background delle colonne */
    }
    
    .help-modal-header {
        padding: 20px 24px;
        border-radius: 0; /* Rimuove border-radius per adattarsi al layout fullscreen */
        flex-shrink: 0; /* Non si riduce */
    }
    
    .help-modal-header h2 {
        font-size: 20px;
    }
    
    .help-modal-body {
        padding: 24px 20px;
        max-height: calc(100svh - 200px); /* Usa svh per consistenza con le colonne */
        overflow-y: auto;
        flex: 1; /* Occupa lo spazio disponibile */
        /* Assicura che il contenuto sia scrollabile */
        -webkit-overflow-scrolling: touch;
    }
    
    .help-section {
        margin-bottom: 24px;
        padding-bottom: 20px;
    }
    
    .help-section h3 {
        font-size: 16px;
    }
    
    .help-modal-footer {
        padding: 20px 24px;
        border-radius: 0; /* Rimuove border-radius per adattarsi al layout fullscreen */
        flex-shrink: 0; /* Non si riduce */
    }
    
    .help-close-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
}

/* Media query per schermi fino a 1024px */
@media (max-width: 1024px) {
    
    /* Metti header sotto alle colonne in responsive */
    .header {
        z-index: 100 !important;
    }
    

    .fullscreen-btn {
        display: none;
    }
    
    /* Nascondi controlli desktop */
    .center-panel-controls {
        display: none;
    }
    
    /* Nascondi completamente le colonne desktop in responsive */
    #ui {
        display: none !important;
    }
    
    #rightPanelContainer {
        display: none !important;
    }
    
    /* Mostra controlli mobile */
    .mobile-controls {
        display: block;
    }
    
    /* Stile per i controlli mobile */
    .mobile-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding: 12px 16px;
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    
    /* Posiziona il button apply sopra ai mobile-controls solo in responsive */
    .apply-button-container {
        bottom: 110px; /* Sopra ai mobile-controls */
        z-index: 1;
    }
    
    .mobile-controls-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }
    
    .mobile-panel-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 4px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        background: var(--white-color);
        color: var(--gray-color);
        font-size: 12px;
        font-weight: 500;
        transition: all 0.2s ease;
        min-height: 60px;
        cursor: pointer;
    }
    
    .mobile-panel-btn:hover {
        background: #f5f5f5;
        border-color: var(--primary-color);
        transform: translateY(-1px);
    }
    
    .mobile-panel-btn.active {
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }
    
    .mobile-panel-btn .btn-icon {
        margin-bottom: 4px;
    }
    
    /* Icone specifiche per Vista ed Esporta - dimensioni più grandi */
    #mobileViewBtn .btn-icon,
    #mobileExportBtn .btn-icon {
        width: 20px !important;
        height: 20px !important;
    }
    
    .mobile-panel-btn .btn-label {
        font-size: 11px;
        font-weight: 500;
    }
    
    /* Aggiungi padding bottom al body per evitare che il contenuto sia coperto dai controlli */
    body {
        padding-bottom: 80px;
    }
    
    /* Modifica le colonne per occupare tutto lo schermo fino ai controlli mobile */
    #ui.show {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: calc(100svh - 80px) !important; /* Altezza totale meno spazio per controlli mobile */
        z-index: 999 !important;
        background: white !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: none !important;
        border: none !important;
        padding: 25px 15px 25px 15px !important;
        border-radius: 0 !important;
        max-height: none !important;
        box-sizing: border-box !important;
        /* Animazione mobile - slide up da sotto */
        transform: translateY(100%) !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    #ui.show.introanimation {
        transform: translateY(0) !important;
    }
    
    #rightPanelContainer.show {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: calc(100svh - 80px) !important; /* Altezza totale meno spazio per controlli mobile */
        z-index: 999 !important;
        background: white !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: none !important;
        border: none !important;
        padding: 25px 15px 25px 15px !important;
        border-radius: 0 !important;
        max-height: none !important;
        box-sizing: border-box !important;
        /* Animazione mobile - slide up da sotto (uguale alla colonna sinistra) */
        transform: translateY(100%) !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    #rightPanelContainer.show.introanimation {
        transform: translateY(0) !important;
    }
    
    /* Adattamento contenuto interno colonne per mobile */
    #ui.show .collection {
        margin-bottom: 15px;
        padding: 10px;
        box-sizing: border-box;
    }
    
    #ui.show .group-selection {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    #ui.show #textureLibrary {
        margin-top: 15px;
        box-sizing: border-box;
    }
    
    #ui.show #textureLibrary img {
        width: 50px !important;
        height: 50px !important;
        object-fit: cover;
        border-radius: 4px;
    }
    
    #rightPanelContainer.show .panel-content {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        width: 100%;
    }
    
    #rightPanelContainer.show .panel-content.visible {
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    #rightPanelContainer.show #selectedTextures {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        width: 100%;
    }
    
    #rightPanelContainer.show h4 {
        margin-top: 0;
        margin-bottom: 15px;
        font-size: 16px;
        word-wrap: break-word;
    }
    
    #rightPanelContainer.show .toggle-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    #rightPanelContainer.show .toggle-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        box-sizing: border-box;
        word-wrap: break-word;
    }
    
    #rightPanelContainer.show .form-group {
        margin-bottom: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    #rightPanelContainer.show .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
        display: block;
        word-wrap: break-word;
    }
    
    #rightPanelContainer.show input[type="range"],
    #rightPanelContainer.show input[type="number"],
    #rightPanelContainer.show select {
        width: 100%;
        padding: 8px;
        font-size: 14px;
        box-sizing: border-box;
    }
    
    #rightPanelContainer.show .button-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    #rightPanelContainer.show .button-group button {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        box-sizing: border-box;
        word-wrap: break-word;
    }

    .color-box {
        width: 50px;
        height: 50px;
    }
    
    /* Assicura che tutti gli elementi rispettino la viewport */
    #ui.show *,
    #rightPanelContainer.show * {
        max-width: 100%;
        box-sizing: border-box;
    }
}
