/* --- A Modern CSS Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --light-gray: #f8f9fa;
    --dark-gray: #343a40;
    --white: #fff;
    --black: #000;

    --font-family-sans-serif: "Roboto Flex", sans-serif;
    --font-family-monospace: "Victor Mono", monospace;
    --font-family-stretch: 'StretchPro', sans-serif;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 3rem;

    --border-color: #e0e0e0;
    --background-color: rgba(255, 255, 255, 0.9);
    --background-blur: 8px;
    --panel-padding: 20px;
}

@font-face {
    font-family: 'After-Disaster';
    src: url('../fonts/After_Disaster-ATLÉTICO BILBAO 2016.2017.otf') format('opentype');
}

@font-face {
    font-family: 'Barcelona';
    src: url('../fonts/Barcelona-Font.otf') format('opentype');
}

@font-face {
    font-family: 'Bayern-Munchen-24-25';
    src: url('../fonts/Bayern-Munchen-24-25.ttf') format('truetype');
}

@font-face {
    font-family: 'Brasil-Qatar-2022';
    src: url('../fonts/Brasil-Qatar-2022.ttf') format('truetype');
}

@font-face {
    font-family: 'Costa-Rica-New-Balance-2018';
    src: url('../fonts/Costa-Rica-New-Balance-2018.ttf') format('truetype');
}

@font-face {
    font-family: 'Flamengo-2024';
    src: url('../fonts/Flamengo-2024.ttf') format('truetype');
}

@font-face {
    font-family: 'Flamengo-23-24';
    src: url('../fonts/Flamengo_23-24.ttf') format('truetype');
}

@font-face {
    font-family: 'France-2020-2021';
    src: url('../fonts/France-2020-2021.otf') format('opentype');
}

@font-face {
    font-family: 'Palmeiras-23-24';
    src: url('../fonts/Palmeiras_23-24.otf') format('opentype');
}

@font-face {
    font-family: 'Real-Madrid-24-25';
    src: url('../fonts/Real Madrid-24-25.ttf') format('truetype');
}

@font-face {
    font-family: 'SAO-PAULO-2024';
    src: url('../fonts/SAO-PAULO-2024.otf') format('opentype');
}

@font-face {
    font-family: 'StretchPro';
    src: url('../fonts/StretchPro.otf') format('opentype');
}

@font-face {
    font-family: 'Warriatron';
    src: url('../fonts/warriatroncondstraight.ttf') format('truetype');
}

@import url('https://fonts.googleapis.com/css2?family=Alumni+Sans+Pinstripe:ital@0;1&family=Bungee+Hairline&family=Do+Hyeon&family=Jolly+Lodger&family=Martian+Mono:wght@100..800&family=Quicksand:wght@300..700&family=Roboto+Flex:opsz,wght@8..144,100..1000&family=Victor+Mono:ital,wght@0,100..700;1,100..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Jolly+Lodger&family=Quicksand:wght@300..700&family=Roboto+Flex:opsz,wght@8..144,100..1000&family=Staatliches&family=Victor+Mono:ital,wght@0,100..700;1,100..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Atma:wght@300;400;500;600;700&family=Bahiana&display=swap');

#loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-icon-container {
    width: 60px;
    height: 60px;
    
    /* 1. O gradiente animado é agora o FUNDO do nosso contentor */
    background: linear-gradient(
        90deg, 
        #E0E0E0 25%, 
        #F5F5F5 50%, 
        #E0E0E0 75%
    );
    background-size: 200% 100%;
    animation: gradientMove 1.5s linear infinite;

    /* 2. A "MAGIA": Usamos o seu SVG como uma máscara */
    /* O código do seu SVG (já corrigido com fill="white") é colocado aqui dentro */
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5282.11 3279.15'><path fill='white' d='M0 3266.3l1476.78 12.85 1916.06 -1907.4 9.36 -0.08 -1351.78 -1371.67 -1447.18 13.43 1325.22 1344.71 -11.54 -0.1 -1916.92 1908.26zm1879.92 0l1476.78 12.85 1916.05 -1907.4 9.36 -0.08 -1351.77 -1371.67 -1447.18 13.43 1325.22 1344.71 -11.54 -0.1 -1916.92 1908.26z'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5282.11 3279.15'><path fill='white' d='M0 3266.3l1476.78 12.85 1916.06 -1907.4 9.36 -0.08 -1351.78 -1371.67 -1447.18 13.43 1325.22 1344.71 -11.54 -0.1 -1916.92 1908.26zm1879.92 0l1476.78 12.85 1916.05 -1907.4 9.36 -0.08 -1351.77 -1371.67 -1447.18 13.43 1325.22 1344.71 -11.54 -0.1 -1916.92 1908.26z'/></svg>");
    
    /* 3. Propriedades para garantir que a máscara se comporte bem */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* A animação que move a posição do gradiente (continua a mesma) */
@keyframes gradientMove {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}


.simulator-container {
    position: relative; 
    
    width: 100vw;
    height: var(--app-height, 100vh);
    overflow: hidden;
    background-color: var(--light-gray); /* Cor de fundo para o canvas */
}

/* Container principal da topbar do simulador */
.simulator-topbar {
    position: absolute; /* Fixa o elemento em relação à página */
    top: 2.5em;           /* Mantém sua margem do topo */
    left: 0;
    width: 100%;
    z-index: 2;       /* Garante que fique por cima da cena 3D */
    
    /* Usa flexbox para alinhar os lados esquerdo e direito */
    display: flex;
    justify-content: space-between; /* Empurra os filhos para as extremidades */
    align-items: center;          /* Alinha verticalmente */
    
    /* Adiciona espaçamento interno */
    padding: 0 40px;
    box-sizing: border-box; /* Garante que o padding não aumente a largura total */

    pointer-events: none;
}

.simulator-topbar > * {
    pointer-events: auto;
}

/* Lado esquerdo da topbar (título) */
.simulator-topbar-left h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--dark-gray);
    font-family: var(--font-family-stretch);
}

.simulator-topbar-right {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: var(--spacing-md);
}

/* Lado direito da topbar (botão) */

.simulator-topbar-right .finish-button {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 5%;     /* Deixa o botão redondo */
    width: auto ;
    height: 42px;
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    /* Usa flexbox para centralizar o SVG dentro do botão */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-sans-serif);
    font-weight: 800;
    font-size: 0.9em;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#image-editor-modal .modal-header-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .simulator-topbar {
        padding: 0 15px;
        justify-content: space-between;
        gap: 10px;
        top: 1em; /* Move it up a bit on mobile */
    }

    .simulator-topbar-left, .simulator-topbar-right {
        flex-basis: auto; /* Allow them to align on the same line */
        display: flex; /* Ensure flex properties apply */
        align-items: center;
    }

    .simulator-topbar-right {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .simulator-topbar-right .btn-primary,
    .simulator-topbar-right .finish-button {
        padding: 0.5em 0.8em;
        height: 38px;
        font-size: 0.8em;
    }

    .simulator-topbar-right .share-button {
        width: 38px;
        height: 38px;
    }

    .simulator-topbar-right .share-button svg {
        width: 18px;
        height: 18px;
    }

    /* --- Side Panels --- */
    #left-panel-container .panel-content,
    #right-panel-container,
    #texture-panel .panel-content {
        width: 85vw;
        max-width: 380px; /* Add a max-width for larger phones/tablets */
    }

    #left-panel-container.is-retracted {
        /* This panel is animated with transform. Using -100% makes it slide out completely. */
        transform: translateX(-100%);
    }

    #right-panel-container {
        /* This panel is animated with the 'right' property. */
        width: 85vw;
        max-width: 380px;
        right: -85vw; /* Set initial off-screen position */
    }

    /* --- Modal Layouts --- */
    #texture-editor-modal .customization-modal-content,
    #text-editor-modal .customization-modal-content {
        flex-direction: column;
        overflow-y: auto;
    }

    #texture-editor-modal .customization-controls,
    #text-editor-modal .customization-controls {
        width: 100%;
        flex-basis: auto; /* Reset fixed basis */
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 15px;
        flex-shrink: 0; /* Prevent the controls panel from shrinking */
    }

    #texture-canvas-container,
    #image-preview-container {
        flex-grow: 1;
        min-height: 300px; /* Give the preview area a decent height */
    }

    #text-editor-modal .product-modal,
    #texture-editor-modal .product-modal {
        height: 95vh; /* Allow modals to use more vertical space */
    }

    .viewer-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1; /* Sit behind UI panels but fill the space */
    }
}


.top-controls-container {
    position: absolute;
    top: 6.5em;
    left: 40px;
    right: 40px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none; /* Allow clicks to pass through the container */
}

.top-controls-container button,
.top-controls-container input,
.top-controls-container label {
    pointer-events: auto;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    width: 200px;
    box-sizing: border-box;
    position: relative;   
}

.button-grid-bottom-row {
    display: contents;
}

.button-with-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.button-label {
    font-weight: bold;
    color: var(--dark-gray);
    font-size: 14px;
}

.button-with-label hr {
    width: 80%;
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

.button-grid .btn-secondary {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
}

.button-grid .btn-secondary img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#open-logo-modal-btn img {
    transform: scale(1.6);
    object-fit: contain;
}

#open-acessorios-modal-btn img {
    object-fit: cover;
}


/* --- New Topbar Styles --- */
.topbar-logo-small {
    height: 16px; /* Smaller logo */
}

.finish-button .mobile-icon {
    display: none;
}

.finish-button .desktop-text {
    display: inline;
}


.simulei-logo {
    height: 25px;
    width: auto;
    margin-left: auto; /* Push to the far right */
}

/* --- Global Simulator Page Styles --- */

/* Disable text selection on the entire page for better UX */
html, body {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
}

/* Re-enable text selection on input fields */
input,
textarea,
select {
    -webkit-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}


.button-grid .btn-secondary svg {
    width: 90%;
    height: 90%;
}

#vertical-visibility-controls {
    z-index: 100;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-sm);
    background-color: rgba(255, 255, 255, 0.8);
    padding: var(--spacing-sm);
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    pointer-events: auto;
}

/* --- General Button Styles --- */
.btn-secondary, .btn-danger {
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 5px;
    cursor: pointer;
    color: var(--white);
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-secondary {
    background-color: var(--secondary-color);
}
.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
}


/* --- Texture Editor Modal --- */
#texture-editor-modal .product-modal {
    max-width: 80vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
}

#texture-editor-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--panel-padding);
    border-bottom: 1px solid #eee;
    background-color: var(--white);
}

#texture-editor-modal .modal-header .product-modal-title {
    position: static;
    color: var(--dark-gray);
    margin: 0;
    text-shadow: none;
    white-space: nowrap;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: hidden;
    flex-grow: 1;
}


.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 1em;
    min-width: 23%;
}

.editor-tabs {
    display: flex;
    gap: 5px;
    border-bottom: none;
    padding-bottom: 0;
}

.editor-tab-btn {
    padding: var(--spacing-sm) var(--panel-padding);
    cursor: pointer;
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-size: 1em;
    font-weight: 600;
    color: #555;
    transition: background-color 0.2s, color 0.2s;
}

.editor-tab-btn:hover {
    background-color: #e9e9e9;
}

.editor-tab-btn.active {
    background-color: var(--white);
    border-color: var(--border-color);
    color: var(--black);
    border-bottom: 1px solid var(--white);
    position: relative;
    top: 1px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

#texture-editor-modal .modal-header .product-modal-close,
#text-editor-modal .modal-header .product-modal-close {
    position: static;
}

#texture-editor-modal .customization-modal-content {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

#texture-editor-modal .customization-controls {
    width: 250px;
    padding: var(--spacing-md);
    border-right: 1px solid #eee;
    background: var(--light-gray);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

#texture-editor-modal .customization-controls p {
    font-size: 14px;
    color: #666;
    margin-top: 0;
}

#texture-editor-modal .customization-controls button {
    width: 100%;
}

#texture-editor-modal .customization-controls hr {
    width: 100%;
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
}

#texture-canvas-container {
    flex-grow: 1;
    background-color: var(--light-gray);
    position: relative;
    background-image:
        linear-gradient(45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border-color) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: auto;
}

#texture-canvas-container .canvas-container {
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.simulator-topbar-right finish:hover {
    background-color: var(--light-gray);
    border-color: var(--black);
}

.simulator-topbar-right .share-button {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;     /* Deixa o botão redondo */
    width: 42px;
    height: 42px;
    cursor: pointer;
    padding: 0.5em;
    /* Usa flexbox para centralizar o SVG dentro do botão */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-sans-serif);
    
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.simulator-topbar-right button:hover {
    border-color: #b9b9b9;
}

/* O ícone SVG dentro do botão */
.simulator-topbar-right svg {
    width: 22px;  /* Tamanho do ícone */
    height: 22px;
    fill: var(--dark-gray);
}

.viewer-container {
    flex-grow: 1;
    position: relative;
    height: 100%;
}

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

/* --- Estilos do Simulador --- */

.simulator-container {
    display: flex;
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}


/* --- Estilos para o Painel Lateral Esquerdo (Dinâmico) --- */
#left-panel-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 101;
    display: flex;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#left-panel-container.is-retracted {
    transform: translateX(-320px);
}

#left-panel-container .panel-content {
    position: relative;
    width: 320px;
    height: 100%;
    background-color: var(--background-color);
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    padding: var(--panel-padding);
    box-sizing: border-box;
}

#left-panel-container #toggle-panel-btn {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background-color: var(--background-color);
    backdrop-filter: blur(var(--background-blur));
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 5px 0px 15px rgba(0,0,0,0.05);
}

#left-panel-container #toggle-panel-btn svg {
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    transform: rotate(180deg);
}

#left-panel-container.is-retracted #toggle-panel-btn svg {
    transform: rotate(0deg);
}

#left-panel-container .part-selector {
    display: flex;
    justify-content: flex-start;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

#left-panel-container .part-selector-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

#left-panel-container .part-selector-btn.active {
    border-color: var(--primary-color);
}

#left-panel-container .scrollable-area {
    flex-grow: 1;
    overflow-y: auto;
}

#left-panel-container .texture-group {
    display: none;
}

#left-panel-container .texture-group.active {
    display: block;
}

#left-panel-container .texture-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
}

#threejs-canvas {
    width: 100%;
    height: 100%;
}

/* --- Estilos para o Painel de Cores (Lateral Esquerda) --- */
#cores-panel-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 102; /* Higher z-index to appear above the other panel if both are somehow open */
    display: flex;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none; /* Allow clicks to pass through when retracted */
}

#cores-panel-container.is-retracted {
    transform: translateX(-100%);
}

#cores-panel-container .panel-content {
    pointer-events: auto; /* Re-enable pointer events for the content */
    position: relative;
    width: 100%; /* Increased width */
    height: 100%;
    background-color: var(--background-color);
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    padding: var(--panel-padding);
    box-sizing: border-box;
}

.cores-panel-layout {
    display: flex;
    height: 100%;
    margin-top: 2rem;
}

.cores-steps-menu {
    width: 120px;
    border-right: 1px solid var(--border-color);
    padding-right: var(--spacing-md);
    overflow-y: auto;
    flex-shrink: 0;
}

.step-menu-btn {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: 5px;
    margin-bottom: var(--spacing-sm);
}

.step-menu-btn.active {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.cores-options-area {
    flex-grow: 1;
    padding-left: var(--spacing-md);
    overflow-y: auto;
}

.cores-options-area .color-swatches-container {
    display: grid;
    grid-template-columns: repeat(12, auto);
    row-gap: 5px;
    column-gap: 2px;
    justify-items: center;
    justify-content: center;
}

.color-swatch-wrapper {
    flex-shrink: 0;
}

.color-swatch-rect {
    width: 24px;
    height: 30px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease-in-out;
}

.color-swatch-rect.active {
    border-color: var(--primary-color);
    border-width: 3px;
    transform: scale(1.05);
}

.button-grid .btn-cores {
    width: 60px;
    height: 60px;
}

.cores-subsection-title {
    font-size: 0.83rem;
    margin: 20px 0 10px 0;
    text-align: center;
    color: var(--dark-gray);
}

/* Video Aspect Ratio Modal */
.aspect-ratio-modal-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
}

.btn-aspect-ratio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-aspect-ratio:hover {
    border-color: #007bff;
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-aspect-ratio img {
    width: 80px;
    height: 80px;
}

.btn-aspect-ratio span {
    font-size: 1rem;
    font-weight: 500;
}


/* Styles for the control stubs for visibility */
.control-wrapper {
    padding: var(--spacing-sm);
    border: 1px dashed var(--border-color);
    border-radius: 5px;
    text-align: center;
    background: var(--light-gray);
}

.simple-color-palette-container,
.generic-swatches-container {
    text-align: center;
}

.simple-color-palette-container h5 {
    display: none;
}


/* ==========================================================================
   PAINEL LATERAL DE OPÇÕES - VERSÃO REFINADA
   ========================================================================== */

/* --- Variáveis de Design --- */
#texture-panel {
    --primary-color: var(--black);
}

/* --- Estrutura Principal do Painel --- */
#texture-panel {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 101;
    display: flex;
    align-items: center;
}

.panel-content {
    position: relative; 
    width: 320px; /* Um pouco mais largo para acomodar melhor o conteúdo */
    height: 100%;
    background-color: var(--background-color);
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0px 20px rgba(0,0,0,0.08);
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Transição mais suave */
    
    /* NOVO: Organiza o conteúdo em uma coluna (abas em cima, scroll em baixo) */
    display: flex;
    flex-direction: column;
    padding: var(--panel-padding);
    box-sizing: border-box;
}

/* --- Botão de Recolher/Expandir (Aba) --- */
#toggle-panel-btn {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background-color: var(--background-color);
    backdrop-filter: blur(var(--background-blur));
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 5px 0px 15px rgba(0,0,0,0.05);
    transition: background-color 0.3s;
}
#toggle-panel-btn:hover { background-color: var(--white); }
#toggle-panel-btn svg { transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); }

/* --- Área de Conteúdo e Scroll --- */
.scrollable-area {
    flex: 1; /* FAZ ESTA ÁREA OCUPAR TODO O ESPAÇO RESTANTE */
    overflow-y: auto;
    min-height: 0; /* Truque de flexbox para permitir o encolhimento correto */
    
    /* Estilização da barra de scroll (para Chrome/Safari) */
    &::-webkit-scrollbar {
        width: 8px;
    }
    &::-webkit-scrollbar-track {
        background: transparent;
    }
    &::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 4px;
    }
    &::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }
}

/* Lógica de visibilidade dos grupos de textura (igual a antes) */
.texture-group { display: none; }
.texture-group.active { display: block; }
.texture-group h4 { margin-top: 0; }

/* Amostras de textura (swatches) com feedback visual melhorado */
.texture-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: var(--spacing-sm);
}

.texture-swatch {
    border: 2px solid transparent;
    border-radius: 1px;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}
.texture-swatch:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.texture-swatch.active {
    border-color: var(--primary-color);
}
.texture-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transform: scale(1.2);
    transition: transform 0.2s ease;
}


/* --- Lógica de Recolhimento (igual a antes, mas com SVG ajustado) --- */
#texture-panel.is-retracted .panel-content {
    transform: translateX(-100%);
}

#texture-panel.is-retracted #toggle-panel-btn svg {
    transform: rotate(0deg);
}

#texture-panel:not(.is-retracted) #toggle-panel-btn svg {
    transform: rotate(180deg);
}

/* --- BARRA LATERAL DIREITA --- */
#customization-panel {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 999;
}

.panel-btn {
    writing-mode: vertical-rl; /* Escreve o texto na vertical */
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-right: none;
    padding: 15px 8px;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-weight: bold;
    box-shadow: -2px 0px 15px rgba(0,0,0,0.1);
}

/* --- MODAL DE PATROCINADORES --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 640px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.close-btn {
    border: none;
    background: none;
    font-size: 2rem;
    cursor: pointer;
}

.modal-body {
    max-width: 700px;
    max-height: 600px;
    
    aspect-ratio: 1 / 1;
    border: 1px dashed var(--border-color);
    margin-bottom: var(--spacing-md);
    overflow: auto;
}
#sponsor-canvas {
    width: 100%;
    height: 100%;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm);
}

.button-like-label {
    background-color: var(--light-gray);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 5px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* --- Estilos para o Painel Lateral de Edição Fabric.js --- */

.fabric-editor-sidebar {
    position: fixed;
    top: 0;
    
    /* MUDANÇA: "Ancora" o painel à direita da tela */
    right: 0; 
    
    width: 350px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: -4px 0 15px rgba(0,0,0,0.1); /* Sombra agora à esquerda */
    z-index: 1100;

    /* MUDANÇA: A posição "escondida" agora é à direita */
    transform: translateX(100%);
    
    transition: transform 0.4s ease-in-out;
}

/* A classe que o JS adiciona para mostrar o painel */
.fabric-editor-sidebar.is-open {
    /* A posição final (visível) continua a ser a mesma */
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--panel-padding);
    border-bottom: 1px solid var(--border-color);
}
.sidebar-header h3 {
    margin: 0;
    font-size: 1.2em;
}

#close-editor-btn {
    font-size: 2em;
    line-height: 1;
    color: #888;
}

.sidebar-content {
    padding: var(--panel-padding);
}

.action-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: var(--spacing-sm);
    background-color: var(--light-gray);
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
}

/* --- ESTILOS PARA O SELETOR DE PEÇAS E GRUPOS DE TEXTURA --- */

/* Container para os botões de seleção de peça (camisa, calção, etc.) */
.part-selector {
    display: flex;
    justify-content: flex-start; /* Alinha os botões à esquerda */
    gap: var(--spacing-sm); /* Espaço entre os botões */
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color); /* Linha separadora */
}

/* Estilo individual de cada botão de seleção */
.part-selector-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

/* Estilo do ícone SVG dentro do botão */
.part-selector-btn svg {
    width: 80%;
    height: 80%;
    transition: fill 0.2s;
}

/* Efeito ao passar o mouse sobre um botão não selecionado */
.part-selector-btn:not(.active):hover {
    background-color: #e9e9e9;
    border-color: #aaa;
}

/* Estilo para o botão ATIVO (selecionado) */
.part-selector-btn.active {
    background-color: #dadada; /* Fundo azul claro */
    border-color: var(--black); /* Borda azul primário */
}


/* --- Lógica de visibilidade para os Grupos de Textura --- */

/* Por padrão, todos os grupos de textura ficam escondidos */
.texture-group {
    display: none;
}

/* Apenas o grupo de textura que tiver a classe .active será exibido */
.texture-group.active {
    display: block;
}

/* Estilo para o título dentro de cada grupo de textura (ex: "Designs de Camisa") */
.texture-group h4 {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    color: var(--dark-gray);
    font-size: 1rem;
}

/* --- Estilos para as Amostras de Cor --- */



.color-swatch {
    /* Transforma o botão num círculo */
    min-height: 40px;
    min-width: 40px;

    border-radius: 50%; 
    
    /* Usa a variável de cor que o JavaScript define */
    background-color: var(--swatch-color, var(--white));

    /* Borda para que as cores claras (como branco) sejam visíveis */
    border: 2px solid var(--border-color);

    margin: 5px 0px;

    /* Efeito de sombra para destacar */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ================================================= */
/* --- ESTILOS DO PAINEL DE CORES (VERSÃO FINAL) --- */
/* ================================================= */

.layer-title {
    width: 100%;
    text-align: center;
    font-size: 14px;
    color: var(--dark-gray);
    margin: 0px 0px;
}

/* O "Pai" que organiza todas as cores */
.palette-grid {
    display: flex;          /* Ativa o modo flexbox */
    width: 90%;             /* Ocupa 90% da largura do painel, como pedido */
    margin: 0 auto;         /* Centra o bloco de 90% no meio do painel */
    gap: var(--spacing-xs); /* Um pequeno espaço entre as cores */
    overflow: hidden;       /* Garante que nada transborde, sem barras de scroll */
    padding-bottom: var(--spacing-xs);
}

/* O "Filho": contentor para uma cor + seu nome */
.color-wrapper {
    /* Propriedades existentes (NÃO MUDAR) */
    flex: 1;                
    min-width: 0;           
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;

    /* ▼▼▼ ALTERAÇÕES MÍNIMAS ABAIXO ▼▼▼ */

    /* 1. Transforma este elemento numa "âncora" de posicionamento */
    position: relative; 
    
    /* 2. Adiciona um pequeno espaço em baixo para a etiqueta "flutuante" caber */
    padding-bottom: 25px; 
}

/* A etiqueta de nome da cor */
.color-label {
    font-family: var(--font-family-sans-serif);
    /* 3. "Liberta" a etiqueta do fluxo normal da página */
    position: absolute;
    top: 40px; /* Distância do topo da "âncora" (.color-wrapper) */
    
    /* Truque para centralizar perfeitamente */
    left: 50%; 
    transform: translateX(-50%);
    
    /* Estilos visuais para garantir boa legibilidade */
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap; /* Impede que o nome quebre a linha */
    z-index: 10; /* Garante que a etiqueta aparece por cima de tudo */
    
    /* Lógica de visibilidade (igual à sua, mas agora com uma transição melhor) */
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-gray);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, top 0.2s ease-in-out;
}

/* Torna a etiqueta visível quando tem a classe .active */
.color-label.active {
    visibility: visible;
    opacity: 1;
    top: 45px; /* Move-a ligeiramente para baixo ao aparecer, para um efeito suave */
}

.layer-color-control {
    text-align: center;
}

.layer-color-control h5{
    margin: 10px auto;
}

/* Botões Globais */
.btn-primary {
    background-color: transparent;
    border: 1px solid var(--border-color); /* Borda para visibilidade */
    border-radius: 5%;     /* Deixa o botão redondo */
    width: auto ;
    height: 42px;
    cursor: pointer;
    padding: 0.5em;
    /* Usa flexbox para centralizar o SVG dentro do botão */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-sans-serif);
    font-weight: 800;
    font-size: 0.9em;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ================================================================= */
/* --- CORREÇÃO DEFINITIVA DO CABEÇALHO DOS MODAIS DE EDIÇÃO --- */
/* ================================================================= */

/*
 * DOCUMENTAÇÃO (Passo 1):
 * Esta regra garante que os cabeçalhos dos modais de imagem e texto
 * usem Flexbox para alinhar seu conteúdo (título à esquerda, botões à direita).
*/
#image-editor-modal .modal-header,
#text-editor-modal .modal-header,
#acessorios-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/*
 * DOCUMENTAÇÃO (Passo 2):
 * Esta é a correção crucial. Anula a regra 'position: absolute' do ficheiro HTML,
 * forçando o botão 'X' a permanecer DENTRO do fluxo do layout Flexbox.
 * O 'position: static' é o valor padrão que permite que o Flexbox funcione.
*/
#image-editor-modal .modal-header .product-modal-close,
#text-editor-modal .modal-header .product-modal-close,
#acessorios-modal .modal-header .product-modal-close {
    position: static;
}


/*
 * DOCUMENTAÇÃO (Passo 3):
 * Garante que o contêiner dos botões de ação ('Aplicar e Fechar', 'X')
 * tenha um espaçamento interno e não encolha.
*/
#image-editor-modal .modal-header-actions,
#text-editor-modal .modal-header-actions,
#acessorios-modal .modal-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md); /* Aumentei um pouco o espaço para melhor visualização */
    flex-shrink: 0;
}

/* Toggle Switch Styles */
.visibility-toggle-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.toggle-label {
    font-size: 12px;
    color: var(--dark-gray);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--white);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

/* --- Camera Controls --- */
#camera-controls {
    display: grid;
    grid-template-areas:
        ". up ."
        "left center right"
        ". down .";
    gap: var(--spacing-sm);
    background-color: transparent;
    padding: var(--spacing-sm);
    border-radius: 20px;
    box-shadow: none;
    z-index: 100;
}

.camera-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 5px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.camera-btn:hover {
    border-color: #b9b9b9;
    background-color: var(--light-gray);
}

.camera-btn:active {
    transform: scale(0.95);
    background-color: var(--light-gray);
}


.camera-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--dark-gray);
}

#camera-up { grid-area: up; }
#camera-down { grid-area: down; }
#camera-left { grid-area: left; }
#camera-right { grid-area: right; }
#camera-recenter { grid-area: center; }

.right-controls-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--spacing-md);
}

.topbar-logo {
    height: 30px;
    margin-right: 15px;
}
.simulator-topbar-left {
    display: flex;
    align-items: center;
}
.btn-topbar {
    background-color: var(--white) !important;
    color: var(--dark-gray) !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    border-radius: 20px !important;
}
#record-btn {
    display: none;
}
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 90vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(5px);
}

.product-modal {
    background-color: var(--white);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 80%;
    max-width: 900px;
    transform: scale(0.9);
    transition: transform 0.3s ease-out;
    position: relative;
}

.product-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.product-modal-title {
    padding: 0.75em 1.5em;
    margin: 0;
    color: var(--dark-gray);
    z-index: 10;
    text-shadow: none;
}

.product-modal-grid {
    display: flex; /* Changed to flexbox for better animation control */
    gap: 0;
    margin-top: 0; /* Removed margin-top */
    height: 500px; /* Increased height */
    width: 100%; /* Ensure grid takes full width of modal */
    overflow: hidden;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
    background-color: var(--light-gray);
}

.product-card {
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    position: relative;
    flex: 1; /* Distribute space evenly */
    min-width: 100px; /* Prevent cards from becoming too small */
    transition: flex-grow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Animate flex-grow */
    will-change: flex; /* Hint for browser performance */
}

.product-card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--panel-padding) var(--spacing-md);
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: var(--white);
    font-weight: 600;
    text-align: center;
    transition: opacity 0.3s ease;
}

#loading-overlay {
    flex-direction: column;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--dark-gray);
}

#progress-container {
    width: 80%;
    max-width: 400px;
    margin-top: 20px;
    display: none; /* Initially hidden */
}

#progress-bar-container {
    width: 100%;
    background-color: var(--border-color);
    border-radius: 5px;
    height: 10px;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 0.2s ease-in-out;
}

#progress-text {
    margin-top: 10px;
    font-size: 16px;
    font-weight: bold;
}

#time-estimate {
    margin-top: 5px;
    font-size: 14px;
    color: #555;
}

#error-container {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    color: #721c24;
    display: none; /* Hidden by default */
}

#error-container button {
    margin-top: 10px;
    border: 1px solid #721c24;
    background-color: transparent;
    color: #721c24;
    padding: 8px 15px;
}

/* Styles for the text editor modal */
#text-editor-modal .product-modal {
    width: 90vw;
    max-width: 1800px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

#text-editor-modal .customization-modal-content {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
}

#text-editor-modal .customization-controls {
    flex-basis: auto;
    border-right: none;
    width: 100%;
    flex-shrink: 0;
    padding: 28px;
    overflow-y: auto;
    background-color: var(--light-gray);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#text-controls, #number-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: var(--panel-padding);
    border-radius: 8px;
    background-color: var(--white);
    border: 1px solid #ddd;
}

.customization-controls label {
    font-weight: bold;
    font-size: 14px;
    color: var(--dark-gray);
    margin-bottom: -5px;
}

.customization-controls .form-control,
.customization-controls select {
    width: 100%;
    padding: var(--spacing-sm);
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-size: 16px;
    box-sizing: border-box;
}

.customization-controls input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 5px;
}

#text-editor-modal .btn-secondary,
#text-editor-modal .btn-danger {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* Styles for the image editor modal */
#image-editor-modal .product-modal {
    width: 90vw;
    max-width: 700px; /* Made wider */
    height: 90vh;
    display: flex;
    flex-direction: column;
}

#manufacturer-area-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    justify-items: center;
}

#sponsor-area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin: 15px 0;
    justify-items: center;
}

#sponsor-area-grid .area-btn > span {
    display: none; /* Hide the text label on desktop grid view */
}

#text-area-grid {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 15px;
    margin: 15px 0;
    justify-items: center;
    justify-content: center;
}

#text-editor-modal #text-area-grid {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 15px;
    margin: 15px 0;
    justify-items: center;
    justify-content: center;
}

#image-editor-modal .customization-modal-content {
    flex-grow: 1;
    overflow-y: auto; /* Allow scrolling in the main panel */
}

#image-editor-modal .customization-controls {
    padding: 28px;
    background-color: var(--light-gray);
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100%; /* Make controls fill the content area */
}

#image-editor-modal .btn-secondary,
#image-editor-modal .btn-danger {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

#image-preview-container,
#image-preview-container-image-editor {
    flex-grow: 1;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto; /* Use auto for scrollbars if image is too large */
    padding: 20px;
    border: 2px dotted #888;
}

#image-wrapper,
#image-wrapper-image-editor {
    position: relative;
    max-width: 100%;
    max-height: 100%;
}

#texture-static-image,
#texture-static-image-image-editor {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.simulei-logo-bottom-right {
    position: absolute;
    bottom: 2.5em;
    right: 40px;
    width: 120px;
    height: auto;
    z-index: 1000;
}

.btn-modelos {
    width: 90px !important;
    height: 90px !important;
}

#left-panel-container .close-panel-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    width: 30px;
    height: 30px;
    background-color: transparent;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    z-index: 10;
}

.interactive-area {
    position: absolute;
    border: 2px dotted #888;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(0,0,0,0.7);
    font-weight: bold;
    background-color: transparent;
    transition: background-color 0.2s;
}

.interactive-area:hover {
    background-color: transparent;
}

.interactive-area.placeholder {
    font-size: 1.5em;
}

/* Color Swatches for Text Editor */
.color-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px 0;
}

.customization-controls .color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    padding: 0;
}

.customization-controls .color-swatch.active {
    border-color: var(--primary-color);
    transform: scale(1.15);
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

.customization-controls .color-swatch:hover {
    transform: scale(1.1);
}

/* Styles for the sponsor area grid items */
.sponsor-area-item {
    /* Use Flexbox to align children */
    display: flex;
    /* Stack children vertically */
    flex-direction: column;
    /* Center children horizontally */
    align-items: center;
    /* Add space between image and label */
    gap: 8px;
    cursor: pointer;
}

.area-preview {
    /* Set a fixed size for the preview area */
    width: 100px;
    height: 100px;
    /* Style the border */
    border: 2px dashed var(--border-color);
    /* Set a background color */
    background-color: var(--light-gray);
    /* Center the content (like a placeholder icon or image) */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px; /* Optional: rounded corners */
    transition: border-color 0.3s;
}

.sponsor-area-item:hover .area-preview {
    border-color: var(--primary-color); /* Highlight on hover */
}

.area-preview img {
    /* Ensure the image fits within the container */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.area-label {
    /* Style for the text label */
    font-size: 14px;
    color: var(--dark-gray);
    text-align: center;
}

/* --- Refined Sponsor (Image Editor) Modal --- */

#image-editor-modal .product-modal {
    max-width: 700px;
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-gray);
}

#image-editor-modal .modal-header {
    background-color: var(--white);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

#image-editor-modal .product-modal-title {
    font-size: 1.5em;
    font-weight: 700;
    padding: 0;
}

#image-editor-modal .customization-modal-content {
    padding: var(--panel-padding);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.control-section {
    background-color: var(--white);
    padding: var(--panel-padding);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.control-section-title {
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
    font-size: 1.1em;
    font-weight: 600;
}

.control-section-desc {
    font-size: 0.9em;
    color: #666;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

hr.control-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

#manufacturer-area-grid,
#sponsor-area-grid,
#text-area-grid {
    gap: var(--spacing-md);
}

.area-btn {
    border: 2px solid #ccc;
    padding: 0;
    text-align: center;
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    background-color: var(--light-gray);
}

.area-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.area-btn[style*="border-color: rgb(0, 123, 255);"] {
    background-color: #e7f3ff;
    transform: scale(1.05);
}

.action-section {
    background-color: var(--light-gray);
    border-style: dashed;
}

#sponsor-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#sponsor-action-buttons {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    width: 100%;
    justify-content: center;
}

#sponsor-action-buttons .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    max-width: 200px;
}

.action-layout-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

.controls-column {
    flex: 2;
}

.preview-column {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    min-height: 150px;
}

.text-preview {
    font-size: 24px;
    word-break: break-word;
}

/* --- Logo Editor Modal --- */
#logo-editor-modal {
    display: none; /* Hidden by default */
    z-index: 1002; /* Above other modals if needed */
}

#logo-editor-modal .product-modal {
    max-width: 500px;
    width: 90%;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

#logo-editor-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

#logo-editor-modal .product-modal-title {
    margin: 0;
    font-size: 1.25rem;
}

#logo-editor-modal .product-modal-close {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.logo-modal-content {
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.logo-preview-area {
    width: 100%;
    height: 300px;
    background-color: #f8f9fa;
    border: 1px dashed #ced4da;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

#logo-preview-image {
    position: absolute;
    cursor: move;
    max-width: none; /* Allow image to be larger than container */
    z-index: 1;
}

.logo-guide-square {
    position: absolute;
    width: 300px;
    height: 300px;
    border: 2px solid white;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    pointer-events: none; /* So it doesn't interfere with dragging */
    z-index: 2;
}

.logo-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.logo-controls label {
    font-weight: bold;
}

.logo-controls input[type="range"] {
    width: 100%;
}


#acessorios-modal .product-modal {
    max-width: 700px;
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-gray);
}

#acessorios-modal .modal-header {
    background-color: var(--white);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

#acessorios-modal .product-modal-title {
    font-size: 1.5em;
    font-weight: 700;
    padding: 0;
}

#acessorios-modal .customization-modal-content {
    padding: var(--panel-padding);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.acessorios-modal-content {
    padding: var(--panel-padding);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background-color: var(--light-gray);
}

.acessorios-section {
    background-color: var(--white);
    padding: var(--panel-padding);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.acessorios-section-title {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
}

.acessorios-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.acessorio-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.acessorio-option span {
    font-weight: 500;
    font-size: 14px;
    color: var(--dark-gray);
}

.btn-acessorio {
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-sm);
    cursor: pointer;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.btn-acessorio:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-acessorio.active {
    border-color: var(--primary-color);
    background-color: #e7f3ff;
    transform: scale(1.05);
}

.btn-acessorio img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.simulei-logo-bottom-right {
    bottom: 1em;
    right: 1em;
}

.outline-color-label {
    margin-top: 15px;
}

#undo-btn,
#redo-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#undo-btn svg,
#redo-btn svg {
    width: 22px;
    height: 22px;
}