:root {
    --bg-dark: #0a0b1e;
    --glass-bg: rgba(20, 20, 40, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --neon-blue: #00f3ff;
    --neon-pink: #ff0055;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --blur-strength: 16px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(circle at top right, #1a1c4b 0%, var(--bg-dark) 60%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- TEMA CLARO --- */
.light-theme {
    --bg-dark: #e0e5ec;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #333;
    --neon-blue: #0077ff;
    background: #f0f2f5;
}

/* --- UTILITÁRIOS --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
.neon-text { color: var(--neon-blue); text-shadow: 0 0 10px var(--neon-blue); }
.text-center { text-align: center; }

/* --- NAVBAR --- */
.navbar {
    width: 90%; max-width: 1000px; margin-top: 20px; padding: 15px 30px;
    display: flex; justify-content: space-between; align-items: center; box-sizing: border-box;
}
.logo { font-size: 1.5rem; font-weight: bold; }
.nav-controls { display: flex; gap: 15px; align-items: center; }
.btn-icon-nav { background: transparent; border: none; color: var(--neon-blue); font-size: 1.2rem; cursor: pointer; transition: 0.3s; }
.btn-icon-nav:hover { transform: scale(1.1); text-shadow: 0 0 10px var(--neon-blue); }
.user-info-box { border-left: 1px solid var(--glass-border); padding-left: 15px; display: flex; align-items: center; gap: 10px; }
.btn-small-exit { text-decoration: none; background: rgba(255, 0, 0, 0.2); color: #ff5555; padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; border: 1px solid #ff5555; }

/* --- LOGIN --- */
.login-page { justify-content: center; }
.login-container { padding: 3rem; width: 350px; text-align: center; border-top: 2px solid var(--neon-blue); }
.input-group { position: relative; margin-bottom: 1.5rem; }
.input-group input { width: 100%; padding: 12px 12px 12px 40px; background: rgba(0,0,0,0.3); border: 1px solid #333; color: white; border-radius: 6px; box-sizing: border-box; }
.neon-icon { position: absolute; left: 12px; top: 14px; color: var(--neon-blue); }
.btn-neon { background: transparent; border: 1px solid var(--neon-blue); color: var(--neon-blue); padding: 12px 24px; width: 100%; font-weight: bold; cursor: pointer; text-transform: uppercase; transition: 0.3s; border-radius: 6px; }
.btn-neon:hover { background: var(--neon-blue); color: #000; box-shadow: 0 0 20px var(--neon-blue); }

/* --- DASHBOARD --- */
.container { width: 90%; max-width: 1000px; margin-top: 30px; }
.download-section { padding: 40px; margin-bottom: 30px; text-align: center; }
.main-input { width: 80%; padding: 15px; border-radius: 30px; border: none; background: rgba(255,255,255,0.1); color: white; margin-bottom: 20px; text-align: center; font-size: 1.1rem; }
.controls { display: flex; justify-content: center; gap: 15px; align-items: center; flex-wrap: wrap; }
.glass-select { background: rgba(0,0,0,0.5); color: white; border: 1px solid #555; padding: 10px; border-radius: 5px; }

/* --- SWITCH (Toggle) --- */
.switch-container { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; border-radius: 20px; border: 1px solid #555; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--neon-blue); border-color: var(--neon-blue); }
input:checked + .slider:before { transform: translateX(19px); }

/* --- HISTORY TABLE --- */
.history-section { padding: 20px; }
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
th { color: var(--neon-blue); text-transform: uppercase; font-size: 0.8rem; }
.badge { background: rgba(255,255,255,0.1); padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }
.btn-download-link { text-decoration: none; color: var(--neon-blue); border: 1px solid var(--neon-blue); padding: 5px 10px; border-radius: 4px; font-size: 0.8rem; transition: 0.2s; }
.btn-download-link:hover { background: var(--neon-blue); color: #000; }
.blink { animation: blinker 1.5s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* --- TERMINAL & MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); z-index: 1000; display: none; justify-content: center; align-items: center; }
.terminal-window { width: 90%; max-width: 600px; height: 400px; background: rgba(10, 10, 20, 0.95); border: 1px solid var(--neon-blue); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 30px rgba(0, 243, 255, 0.2); }
.terminal-header { background: rgba(0, 243, 255, 0.1); padding: 10px 20px; border-bottom: 1px solid var(--neon-blue); display: flex; justify-content: space-between; align-items: center; font-family: 'Courier New', monospace; font-weight: bold; color: var(--neon-blue); }
.btn-close { background: none; border: none; color: #ff5555; font-size: 1.2rem; cursor: pointer; }
.progress-container { height: 4px; background: #222; width: 100%; }
.progress-bar-fill { height: 100%; background: var(--neon-blue); width: 0%; transition: width 0.5s ease; box-shadow: 0 0 10px var(--neon-blue); }
.terminal-content { flex: 1; padding: 20px; overflow-y: auto; font-family: 'Courier New', monospace; font-size: 0.8rem; color: #e0e0e0; text-align: left; }
.terminal-content p { margin: 3px 0; line-height: 1.4; }

/* --- MOBILE RESPONSIVE (MEDIA QUERIES) --- */
@media (max-width: 768px) {
    /* 1. Ajustes Gerais de Layout */
    .container { width: 95%; margin-top: 15px; }
    .navbar { flex-direction: column; gap: 15px; padding: 15px; }
    .nav-controls { width: 100%; justify-content: space-between; }
    
    /* 2. Área de Download (Botões empilhados) */
    .download-section { padding: 20px; }
    .controls { flex-direction: column; gap: 15px; }
    .glass-select, .btn-neon { width: 100%; }
    .switch-container { justify-content: center; width: 100%; border: 1px solid var(--glass-border); padding: 10px; border-radius: 5px; }

    /* 3. MÁGICA: TRANSFORMAR TABELA EM CARDS */
    /* Quebra o comportamento de tabela padrão */
    table, thead, tbody, th, td, tr { display: block; }
    
    /* Esconde o cabeçalho da tabela (Title, Format, etc) pois não cabe */
    thead tr { position: absolute; top: -9999px; left: -9999px; }

    /* Estiliza cada linha como um Cartão Neon */
    tr { 
        margin-bottom: 15px; 
        border: 1px solid var(--neon-blue); /* Borda Neon suave */
        border-radius: 12px; 
        padding: 15px; 
        background: rgba(0, 0, 0, 0.3);
        box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    }

    td { 
        border: none;
        padding: 8px 0; 
        position: relative;
        display: flex;
        justify-content: space-between; /* Texto na esquerda, valor na direita */
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    td:last-child { border-bottom: none; }

    /* --- REORGANIZANDO AS COLUNAS --- */
    
    /* Coluna 1: Título do Vídeo (Destaque no topo) */
    td:nth-of-type(1) { 
        width: 100%; 
        display: block; 
        font-size: 1rem;
        font-weight: bold;
        color: white;
        margin-bottom: 10px;
        text-align: center;
        border-bottom: 1px solid var(--glass-border);
        padding-bottom: 10px;
    }
    /* Permite que o título use múltiplas linhas se for longo */
    td:nth-of-type(1) div { 
        max-width: 100% !important; 
        white-space: normal !important; 
        overflow: visible;
    }

    /* Coluna 2: Formato */
    td:nth-of-type(2):before { 
        content: "FORMATO"; 
        font-size: 0.7rem; 
        font-weight: bold; 
        color: var(--neon-blue); 
    }

    /* Coluna 3: Status */
    td:nth-of-type(3):before { 
        content: "STATUS"; 
        font-size: 0.7rem; 
        font-weight: bold; 
        color: var(--neon-blue); 
    }

    /* Coluna 4: Botão de Ação (Full Width) */
    td:nth-of-type(4) { 
        margin-top: 10px; 
        justify-content: center; 
        padding-top: 10px;
    }
    .btn-download-link { 
        width: 100%; 
        text-align: center; 
        display: block; 
        padding: 10px;
        background: rgba(0, 243, 255, 0.1);
    }
}