/* ==========================================================================
   Estilo de Design System - Simulador de Panfleto 3D
   ========================================================================== */

:root {
    /* Paleta de Cores */
    --bg-main: #0a0a0f;
    --bg-sidebar: rgba(15, 15, 24, 0.75);
    --bg-card: rgba(25, 25, 38, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    --text-primary: #f0f0f5;
    --text-secondary: #9aa0b5;
    --text-muted: #62687f;
    
    --accent-glow: linear-gradient(135deg, #8a2387, #e94057, #f27121);
    --accent-color: #e94057;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    
    /* Transições */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset e Configurações Básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Layout Principal */
.app-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
}

.app-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(233, 64, 87, 0.4));
}

.logo-container h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 40%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-container h1 span {
    background: var(--accent-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Área de Rolagem dos Controles */
.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Custom Scrollbar */
.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Seções de Controle */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-color);
    padding-left: 10px;
}

/* Upload Grid */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.upload-box {
    position: relative;
    aspect-ratio: 1 / 1.414; /* Proporção A5 */
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-card);
    transition: all var(--transition-normal);
}

.upload-box:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(233, 64, 87, 0.15);
    transform: translateY(-2px);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.upload-preview {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    transition: transform var(--transition-slow);
}

.upload-box:hover .upload-preview {
    transform: scale(1.05);
}

.upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(10, 10, 15, 0.65);
    color: var(--text-primary);
    text-align: center;
    padding: 12px;
    z-index: 2;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.upload-box:hover .upload-overlay {
    background: rgba(10, 10, 15, 0.4);
}

.upload-icon {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    transition: transform var(--transition-normal);
}

.upload-box:hover .upload-icon {
    transform: translateY(-3px);
    color: var(--text-primary);
}

.upload-overlay span {
    font-size: 0.75rem;
    font-weight: 600;
}

.helper-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: -4px;
}

/* Grupos de Controle */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.value-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Custom Select */
.custom-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.custom-select:hover {
    border-color: var(--border-hover);
}

.custom-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(233, 64, 87, 0.15);
}

/* Custom Slider */
.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    margin: 8px 0;
}

.custom-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 3px solid var(--accent-color);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 8px rgba(233, 64, 87, 0.4);
    transition: transform var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Button Toggle Grid */
.button-toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 300px) {
    .button-toggle-grid {
        grid-template-columns: 1fr;
    }
}

.btn-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
}

.btn-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.btn-toggle.active {
    background: linear-gradient(135deg, rgba(233, 64, 87, 0.15), rgba(138, 35, 135, 0.15));
    border-color: var(--accent-color);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(233, 64, 87, 0.15);
}

.btn-icon {
    font-size: 1rem;
}

/* Background Selector Grid */
.bg-selector-grid {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.bg-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.bg-option:hover {
    transform: scale(1.15);
}

.bg-option.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(10, 10, 15, 0.4);
}

.btn-primary {
    width: 100%;
    background: var(--accent-glow);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(233, 64, 87, 0.3);
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(233, 64, 87, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Área do Canvas (3D Viewport)
   ========================================================================== */

.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#threejs-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Controles Flutuantes */
.floating-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    z-index: 5;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.float-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.float-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.float-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
}

.btn-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
}

/* Ponto Indicador */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
    transition: all var(--transition-fast);
}

.status-dot.active {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* Dicas de Interação */
.interaction-hints {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(10, 10, 15, 0.4);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    z-index: 4;
    pointer-events: none;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Responsividade
   ========================================================================== */

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .sidebar {
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .scroll-container {
        padding: 16px;
        gap: 20px;
    }
    
    .canvas-container {
        height: 50vh;
    }
    
    .floating-controls {
        bottom: 20px;
    }
    
    .interaction-hints {
        display: none; /* Ocultar dicas no mobile para poupar espaço */
    }
}
