/* ============================================================
   ✅ ORGANIZAÇÃO (REFATORAÇÃO PROGRESSIVA)
   ------------------------------------------------------------
   - Este arquivo mantém o LAYOUT / ESTRUTURA do app (sidebar,
     tabs, canvas, containers, etc.)
   - Componentes reutilizáveis (botões, inputs, sliders, cards)
     ficam em: components.css
   - A intenção aqui é facilitar manutenção SEM mudar visual.
   ============================================================ */

/* ============================================================
   📌 ÍNDICE DE SEÇÕES (REFERÊNCIA)
   ============================================================ */
/* ===== BASE / RESET / TOKENS ===== */
/* ===== LAYOUT GERAL (HEADER / SIDEBAR / MAIN) ===== */
/* ===== SISTEMA DE ABAS (TABS + CONTEÚDO) ===== */
/* ===== CANVAS (WRAPPER / OVERLAYS / HUD) ===== */
/* ===== ABA BÁSICO (layout específico, se existir) ===== */
/* ===== ABA ESTILO (layout específico, se existir) ===== */
/* ===== ABA ANIMAÇÃO (layout específico, se existir) ===== */
/* ===== UTILITÁRIOS / HELPERS ===== */

/* ============================================================
   🎨 VARIÁVEIS GLOBAIS - DESIGN SYSTEM
   ============================================================ */
:root {
    /* Cores Principais */
    --primary-color: #3a86ff;
    --secondary-color: #8338ec;
    --accent-color: #ff006e;
    --success-color: #38b000;
    --warning-color: #ff9e00;
    --danger-color: #ff0054;
    
    /* Cores de Interface */
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e9ecef;
    --panel-bg: #f8f9fa;

    /* Canvas */
    --canvas-bg: #ffffff;
    
    /* Design Tokens */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ============================================================
   🎯 RESET E CONFIGURAÇÕES GERAIS
   ============================================================ */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    color: var(--dark-color);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   🏗️ ESTRUTURA PRINCIPAL DO APLICATIVO
   ============================================================ */
.app-container { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
}

/* ============================================================
   🎪 CABEÇALHO DA APLICAÇÃO
   ============================================================ */
.app-header {
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

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

.app-title { 
    font-size: 1.5rem; 
    color: var(--primary-color); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 700;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--gray-color);
    background: #f0f2f5;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.project-info { 
    background: #f0f2f5; 
    padding: 8px 20px; 
    border-radius: 20px; 
    font-weight: 600; 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 200px;
}

.project-status {
    font-size: 0.8rem;
    color: var(--danger-color);
    font-weight: normal;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* ============================================================
   📐 CONTEÚDO PRINCIPAL
   ============================================================ */
.main-content { 
    display: flex; 
    flex: 1; 
    overflow: hidden; 
    position: relative;
}

/* ============================================================
   📊 SIDEBARS (ESQUERDA E DIREITA)
   ============================================================ */
.sidebar {
    width: 350px; /* Aumentado para comportar mais controles */
    /* ✅ Mantém a sidebar fixa (não encolhe quando o canvas aumenta) */
    flex: 0 0 350px;
    min-width: 350px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex; 
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.right-sidebar { 
    border-right: none; 
    border-left: 1px solid var(--sidebar-border); 
}

.sidebar-header { 
    padding: 18px 20px; 
    border-bottom: 1px solid var(--sidebar-border); 
    background: #fcfcfc; 
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h3 { 
    font-size: 1.1rem; 
    color: var(--dark-color); 
    margin: 0;
    font-weight: 600;
}

.sidebar-scroll-area { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px;
}

.sidebar-footer { 
    padding: 20px; 
    border-top: 1px solid var(--sidebar-border); 
    background: #fcfcfc; 
}

/* ✅ NOVO: Espaçamento entre botões no rodapé da sidebar */
.sidebar-footer .btn + .btn {
    margin-top: 10px;
}

/* ============================================================
   🎛️ ABAS DE CONTROLE
   ============================================================ */
.control-tabs {
    display: flex;
    border-bottom: 1px solid var(--sidebar-border);
    background: #f8f9fa;
}

.tab-btn {
    flex: 1;
    padding: 12px 10px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-color);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(58, 134, 255, 0.05);
}

.tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.03);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================
   📦 PAINÉIS DE CONTROLE (ACCORDIONS)
   ============================================================ */
.controls-panel {
    background: white;
    border: 1px solid var(--sidebar-border);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: var(--transition);
}

.controls-panel:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.panel-header {
    padding: 14px 18px;
    background: var(--panel-bg);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    cursor: pointer; 
    font-weight: 600; 
    color: var(--dark-color);
    transition: var(--transition);
}

.panel-header:hover {
    background: #e9ecef;
}

.panel-body { 
    padding: 18px; 
}

.panel-body.collapsed {
    display: none;
}

/* ============================================================
   🎮 BOTÕES GERAIS
   ============================================================ */
.btn { 
    border: none; 
    padding: 10px 20px; 
    border-radius: var(--border-radius-sm); 
    font-weight: 600; 
    cursor: pointer; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 8px; 
    transition: var(--transition); 
    font-family: inherit;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary { 
    background: linear-gradient(135deg, var(--primary-color), #2575fc); 
    color: white; 
    box-shadow: 0 4px 15px rgba(58,134,255,0.3); 
}

.btn-primary:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 6px 20px rgba(58,134,255,0.4); 
}

.btn-secondary { 
    background: white; 
    border: 1px solid #dee2e6; 
    color: #495057; 
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #ced4da;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.btn-danger { 
    background: linear-gradient(135deg, var(--danger-color), #ff0040); 
    color: white; 
    box-shadow: 0 4px 15px rgba(255, 0, 84, 0.3); 
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 84, 0.4);
}

.btn-success { 
    background: linear-gradient(135deg, var(--success-color), #2d9c00); 
    color: white; 
    box-shadow: 0 4px 15px rgba(56, 176, 0, 0.3); 
}

.btn-icon { 
    background: white; 
    border: 1px solid #dee2e6; 
    width: 40px; 
    height: 40px; 
    padding: 0; 
    justify-content: center; 
    border-radius: 50%;
}

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

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================
   📤 PLACEHOLDER DE UPLOAD
   ============================================================ */
.canvas-placeholder {
    position: absolute; 
    inset: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    background: rgba(255, 255, 255, 0.98); 
    z-index: 50; 
    border: 3px dashed #cbd5e0; 
    color: #6c757d;
    transition: var(--transition);
}

.canvas-placeholder.drag-over {
    border-color: var(--primary-color);
    background: rgba(58, 134, 255, 0.05);
    border-style: solid;
}

.canvas-placeholder i { 
    font-size: 4rem; 
    margin-bottom: 20px; 
    color: var(--primary-color); 
    opacity: 0.7; 
}

.canvas-placeholder h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #495057;
}

.canvas-placeholder p {
    color: #6c757d;
    margin-bottom: 25px;
    text-align: center;
    max-width: 400px;
}

/* ============================================================
   📱 RESPONSIVIDADE
   ============================================================ */
@media (max-width: 1200px) {
    .sidebar {
        width: 320px;
        flex: 0 0 320px;
        min-width: 320px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 280px;
        flex: 0 0 280px;
        min-width: 280px;
    }
}

/* ============================================================
   🎪 UTILITÁRIOS
   ============================================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f2f5;
    color: #666;
}

.badge-primary {
    background: #e7f1ff;
    color: var(--primary-color);
}

.badge-success {
    background: #e8f5e9;
    color: var(--success-color);
}

/* ============================================================
   🎨 ESTILOS DO CANVAS
   ============================================================ */
canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

#hotspot-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#hotspot-layer .hotspot-element {
    pointer-events: auto;
}

/* SOCIAL BUTTON EDITOR - spacing helper */
.sb-editor-grid { }

/* ============================================================
   🧩 ABA BÁSICO (PLACEHOLDER)
   - Coloque aqui apenas regras de layout específicas da aba.
   - Evite redefinir componentes (btn, slider, input) aqui.
   ============================================================ */

/* ============================================================
   🎨 ABA ESTILO (PLACEHOLDER)
   - Layout específico da aba de estilo (se necessário).
   ============================================================ */

/* ============================================================
   🎞️ ABA ANIMAÇÃO (PLACEHOLDER)
   - Layout específico da aba de animação (se necessário).
   ============================================================ */

/* ============================================================
   🔧 REFACTOR FOUNDATION (opcional)
   - Classes utilitárias para debug/diagnóstico durante migração.
   - Não usadas por padrão.
   ============================================================ */

/* Quando ativar a refatoração via JS, você pode opcionalmente
   adicionar no <body> a classe .refac-enabled para inspeção. */

/* body.refac-enabled { outline: 0; } */



/* ============================================================
   🧩 Toggle da Sidebar de Camadas (direita)
   - Controlado via classe no <body>
   ============================================================ */
body.layers-sidebar-hidden #right-sidebar{ display:none; }
body.layers-sidebar-hidden .canvas-area{ flex: 1 1 auto; }
#toggle-layers-btn.is-on{ box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08); }


/* ============================================================
   🪟 HANDLE SIDEBAR CAMADAS (quando oculta)
   - aparece apenas quando body.layers-sidebar-hidden
   - permite reabrir com 1 clique
   ============================================================ */
.layers-sidebar-handle{
  display:none;
  position:fixed;
  right:10px;
  top:92px;
  z-index:9999;
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.10);
  background:rgba(255,255,255,0.85);
  cursor:pointer;
  align-items:center;
  justify-content:center;
  padding:0;
}
.layers-sidebar-handle i{ opacity:0.9; }
.layers-sidebar-handle:hover{ background:rgba(255,255,255,0.95); }
body.layers-sidebar-hidden .layers-sidebar-handle{ display:inline-flex; }

