/* =========================================
   1. VARIÁVEIS E RESET (Design System)
   ========================================= */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --bg-grey: #f8fafc;
    --text-main: #334155;
    --border-color: #cbd5e1;
    --success: #10b981;
    --error: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
    overflow: hidden; 
}

/* =========================================
   2. LAYOUT PRINCIPAL (Sidebar & Header)
   ========================================= */
.app-header {
    height: 60px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.logo { 
    font-weight: 600; 
    font-size: 1.2rem; 
    color: #f1f5f9;
}

.subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 300;
}

.app-container { display: flex; height: calc(100vh - 60px); }

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid #334155;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer p {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
}

.footer-link {
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.footer-link:hover {
    color: #60a5fa;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.source-link {
    font-size: 0.7rem;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.source-link:hover {
    opacity: 1;
    color: #fff;
}

.icon-code {
    font-family: monospace;
    font-weight: bold;
    color: #3b82f6;
}

.sidebar-title {
    padding: 20px 20px 10px 20px;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 1px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, padding-left 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--hover-bg);
    border-left: 3px solid var(--primary);
    padding-left: 25px;
}

.content-area {
    flex-grow: 1;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    position: relative;
    width: 100%;
    height: 100%;
}

iframe { width: 100%; height: 100%; border: none; }

/* =========================================
   3. ESTILOS GLOBAIS PARA IFRAMES (Demos)
   ========================================= */
body.demo-page {
    background: transparent;
    overflow: hidden;
}

/* =========================================
   4. COMPONENTE: CARDS (Modern Dark Style)
   ========================================= */
.card, .image-input-card, .model-picker-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 420px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 50;
    transition: all 0.3s ease;
    color: #f1f5f9;
}

.card h3, .image-input-card h3, .model-picker-card h3 {
    margin: 0 0 5px 0;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.btn-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-upload-area:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    color: #ffffff;
}

.default-image-option {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.default-image-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.image-input-default-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    padding: 5px;
}

.default-image-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 500;
}

/* =========================================
   5. COMPONENTE: BOTÕES (Unificado)
   ========================================= */
button {
    appearance: none;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-main);
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 12px 24px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 5px;
}

button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: #eff6ff;
    transform: translateY(-1px);
}

button:active, button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

button.primary {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

button.primary:hover {
    background-color: var(--primary-hover);
    color: white;
}

.image-input-card-body, 
.model-picker-card-body, 
.card-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    align-items: center;
}

.image-input-card-body > *, 
.model-picker-card-body > * {
    margin: 0;
}

.button-17, 
.image-input-button-17, 
.model-picker-button-17 {
    width: 100%;
    padding: 16px 24px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.button-17:hover, 
.image-input-button-17:hover, 
.model-picker-button-17:hover {
    background-color: #2563eb;
    border-color: #60a5fa;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.image-input-default-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    padding: 0;
    margin: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.card-body p {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
}

/* =========================================
   6. COMPONENTE: DROPUP (Filtros)
   ========================================= */
.dropup {
    position: absolute;
    display: flex;
    bottom: 15px;
    right: 10px;
    flex-direction: column-reverse;
    width: 15em;
    z-index: 100;
}

.dropbtn {
    background-color: rgba(30, 41, 59, 0.6);
    border: 1px solid #475569;
    color: #f1f5f9;
    backdrop-filter: blur(8px);
    padding: 12px 24px;
    font-size: 16px;
    border: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.5),
                inset 0 0 10px rgba(37, 99, 235, 0.2);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropbtn::after {
    content: '▲';
    font-size: 0.7em;
    margin-left: 5px;
}

.dropbtn:hover {
    background-color: rgba(37, 99, 235, 0.9);
    border-color: #60a5fa;
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.8),
                0 0 10px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.dropup:hover .dropbtn {
    background-color: var(--primary);
    color: white;
}

.dropup-content {
    display: none;
    position: absolute;
    bottom: 67px;
    left: 0;
    background-color: #1e293b;
    border: 1px solid #334155;
    min-width: 240px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 101;
    animation: slideUp 0.2s ease-out;
    color: #f1f5f9;
}

.dropup-content::after {
    content: "";
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent; 
    display: block;
}

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

.dropup-content a {
    color: #cbd5e1;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropup-content a:hover {
    background-color: #334155;
    color: #60a5fa;
}

.dropup:hover .dropup-content {
    display: block;
    cursor: pointer;
}

/* =========================================
   7. COMPONENTE: LOADING SPINNER
   ========================================= */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   8. COMPONENTE: TOAST NOTIFICATIONS
   ========================================= */
.toast-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #ccc;
    font-size: 0.9rem;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateX(50px);
}

.show-toast { opacity: 1; transform: translateX(0); }
.hide-toast { opacity: 0; pointer-events: none; }

.success-border { border-left-color: var(--success); }
.success { color: var(--success); }

.error-border { border-left-color: var(--error); }
.error { color: var(--error); }

.info-border { border-left-color: var(--info); }
.info { color: var(--info); }

.warning-border { border-left-color: var(--warning); }
.warning { color: var(--warning); }

.toast-content { flex-grow: 1; margin-left: 10px; }
.toast-title { font-weight: 700; display: block; margin-bottom: 4px; }
.toast-text { color: #64748b; font-size: 0.85rem; margin: 0; }

.close-toast-icon {
    margin-left: auto;
    cursor: pointer;
    color: #94a3b8;
    font-weight: bold;
}

/* =========================================
   9. LIL GUI STYLES OVERRIDE
   ========================================= */
.lil-gui { 
    --background-color: rgba(15, 23, 42, 0.85);
    --text-color: #cbd5e1;
    --title-background-color: #1e293b;
    --widget-color: #334155;
    --hover-color: #475569;
    --focus-color: #475569;
    --number-color: #60a5fa;
    --string-color: #a3e635;
    --width: 280px;
}

.lil-gui.root > .title {
    border-top: 2px solid #2563eb; 
    border-bottom: 1px solid #334155;
}

.lil-gui.root {
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* =========================================
   CRÉDITOS E ATRIBUIÇÕES (Footer Overlay)
   ========================================= */
.credits-overlay {
    position: absolute;
    bottom: 10px;
    right: 15px; /* Canto inferior direito */
    z-index: 20; /* Garante que fique acima do vídeo, mas abaixo de menus pop-up */
    
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem; /* Pequenininho */
    color: rgba(255, 255, 255, 0.4); /* Bem discreto/transparente por padrão */
    
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); /* Sombra preta para ler mesmo se o fundo for claro */
    pointer-events: all; /* Garante que os links sejam clicáveis */
    transition: opacity 0.3s;
}

/* Quando passar o mouse, fica branquinho para ler melhor */
.credits-overlay:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Estilo dos Links */
.credits-overlay a {
    color: inherit; /* Herda a cor (transparente ou branca) */
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5); /* Linha pontilhada sutil */
    transition: color 0.2s;
}

.credits-overlay a:hover {
    color: #60a5fa; /* Azul claro ao passar o mouse no link específico */
    border-bottom-style: solid;
}