/* ==========================================================================
   1. DEFINIÇÃO DE VARIÁVEIS E TEMAS
   ========================================================================== */
:root[data-theme="dark"] {
    --bg-main: #0b0f19;
    --bg-card: rgba(21, 30, 46, 0.88);
    --bg-input: rgba(11, 17, 32, 0.8);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(56, 189, 248, 0.2);
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

:root[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-input: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(2, 132, 199, 0.3);
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
}

/* ==========================================================================
   2. RESET E FONDOS DINÂMICOS (FUNDO 1 NO LOGIN / FUNDO 2 NO DASHBOARD)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
    background-color: var(--bg-main);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Fundo da Tela de Logon: Fundo01.jpg */
body.view-login {
    background-image: 
        linear-gradient(rgba(11, 15, 25, 0.72), rgba(11, 15, 25, 0.85)), 
        url("Fundo01.jpg");
}

/* Fundo da Tela com os Painéis: Fundo02.jpg */
body.view-dashboard {
    background-image: 
        linear-gradient(rgba(11, 15, 25, 0.78), rgba(11, 15, 25, 0.88)), 
        url("Fundo02.jpg");
}

/* ==========================================================================
   3. BARRA SUPERIOR (NAVBAR)
   ========================================================================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.5rem;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
}

.btn-danger-sm {
    background-color: var(--danger);
    color: #ffffff;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   4. CARDS E CONTAINERS (EFEITO VIDRO / GLASSMORPHISM)
   ========================================================================== */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

h2 {
    font-size: 1.35rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ==========================================================================
   5. TELA DE LOGIN
   ========================================================================== */
#login-view {
    max-width: 440px;
    margin: 3.5rem auto;
    border-top: 3px solid var(--primary);
}

.form-group {
    margin-bottom: 1.1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

input, textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: 0.95rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

.password-meter-container {
    height: 4px;
    width: 100%;
    background-color: var(--border-color);
    border-radius: 2px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.meter-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
}

.meter-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   6. BOTÕES E ALERTAS
   ========================================================================== */
button {
    cursor: pointer;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.btn-secondary {
    background-color: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.alert {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger);
    color: #fca5a5;
}

/* ==========================================================================
   7. DASHBOARD E PAINÉIS
   ========================================================================== */
.dash-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.session-timer-box {
    text-align: right;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.timer-digits {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    font-family: monospace;
}

.services-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    align-items: center;
    justify-content: space-between;
}

.srv-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.hardware-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hw-card {
    padding: 1.25rem;
}

.hw-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-track {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--primary);
    border-radius: 5px;
    transition: width 0.5s ease-in-out, background-color 0.3s;
}

.hw-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
}

.metric-val {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
}

.hash-output-container {
    margin-top: 0.75rem;
}

.hash-output-container textarea,
.hash-output-container input {
    margin-top: 0.25rem;
    font-family: monospace;
    font-size: 0.8rem;
}

.password-gen-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.password-gen-control input[type="range"] {
    width: 50%;
}

.logs-card {
    margin-top: 1rem;
}

.table-responsive {
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.logs-table th, .logs-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.logs-table th {
    color: var(--text-muted);
    font-weight: 600;
}

.badge {
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-info { 
    background: rgba(2, 132, 199, 0.2); 
    color: #38bdf8; 
}

.badge-warn { 
    background: rgba(245, 158, 11, 0.2); 
    color: #fbbf24; 
}

.badge-danger { 
    background: rgba(239, 68, 68, 0.2); 
    color: #f87171; 
}

.badge-success { 
    background: rgba(34, 197, 94, 0.2); 
    color: #4ade80; 
}

.hidden {
    display: none !important;
}