/* --- Variáveis de Cor para o Tema Escuro --- */
:root {
    --bg-dark: #1a1a2e;
    --bg-light: #16213e;
    --primary: #0f3460;
    --secondary: #e94560;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #2a3a5e;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

/* --- Estilos Gerais e de Login --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--bg-dark);
    color: var(--text);
}

.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-container { background-color: var(--bg-light); padding: 40px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); text-align: center; border: 1px solid var(--border-color); }
.login-container h1 { margin-bottom: 25px; color: var(--text); }
.login-container input { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--primary); color: var(--text); box-sizing: border-box; }
.login-container button { width: 100%; padding: 12px; border: none; border-radius: 5px; background-color: var(--secondary); color: white; font-weight: bold; cursor: pointer; transition: background-color 0.3s; }
.login-container button:hover { background-color: #c73850; }

/* --- Estilos do Dashboard --- */
.dashboard-container { display: flex; flex-direction: column; min-height: 100vh; }
header { background-color: var(--bg-light); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; gap: 10px; }
header h1 { margin: 0; font-size: 1.5em; }
.logout-button { background-color: var(--secondary); color: white; padding: 8px 15px; border-radius: 5px; text-decoration: none; font-weight: bold; transition: background-color 0.3s; }
.logout-button:hover { background-color: #c73850; }
.dashboard-main { display: flex; flex-grow: 1; padding: 20px; gap: 20px; overflow: hidden; }

/* Painel de Estatísticas */
.stats-panel { background: var(--bg-light); padding: 20px; border-radius: 8px; width: 300px; flex-shrink: 0; border: 1px solid var(--border-color); }
.stats-panel h2, .main-content h2 { margin-top: 0; border-bottom: 2px solid var(--secondary); padding-bottom: 10px; margin-bottom: 20px; }
.stat-item { margin-bottom: 20px; }
.stat-item.simple { display: flex; justify-content: space-between; align-items: center; }
.stat-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.9em; color: var(--text-muted); }
.stat-header span:first-child { font-weight: bold; color: var(--text); }
.progress-bar { background-color: var(--primary); border-radius: 5px; height: 10px; overflow: hidden; }
.progress-bar div { background-color: var(--secondary); height: 100%; width: 0%; border-radius: 5px; transition: width 0.5s ease-out; }

/* Conteúdo Principal (Sites e Logs) */
.main-content { flex-grow: 1; display: flex; flex-direction: column; gap: 20px; overflow: hidden; }
.sites-section, .logs-section { background: var(--bg-light); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); display: flex; flex-direction: column; }
.sites-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.logs-section { flex-grow: 1; overflow: hidden; }
#log-content { background-color: #0d1117; color: var(--text-muted); padding: 15px; border-radius: 4px; white-space: pre-wrap; word-wrap: break-word; flex-grow: 1; overflow-y: auto; font-size: 0.85em; }
i { margin-right: 8px; }

/* --- Estilos para os Cards de Site --- */
.site-card { background-color: var(--primary); border-radius: 8px; border-top: 4px solid var(--border-color); transition: all 0.3s ease; display: flex; flex-direction: column; justify-content: space-between; }
.site-card:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.2); }
.site-card.status-online { border-top-color: var(--success); }
.site-card.status-stopped { border-top-color: #6c757d; }
.site-card.status-errored { border-top-color: var(--danger); }
.site-card-content { padding: 15px; flex-grow: 1; }
.site-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.site-header h3 { margin: 0; font-size: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-header h3 a { color: var(--text); text-decoration: none; }
.site-header h3 a:hover { color: var(--secondary); }
.status-indicator { height: 12px; width: 12px; border-radius: 50%; flex-shrink: 0; margin-left: 10px; box-shadow: 0 0 8px currentColor; }
.status-indicator.status-online { background-color: var(--success); color: var(--success); }
.status-indicator.status-stopped { background-color: #6c757d; color: #6c757d; }
.status-indicator.status-errored { background-color: var(--danger); color: var(--danger); }

.site-details { font-size: 0.9em; color: var(--text-muted); margin-bottom: 15px; }
.site-details div { display: flex; align-items: center; margin-bottom: 5px; }
.site-details i { color: var(--secondary); }

.site-stats { display: flex; justify-content: space-around; font-size: 0.8em; color: var(--text-muted); margin-bottom: 15px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.stat { text-align: center; }
.stat span { display: block; font-weight: bold; color: var(--text); }
.timer-status { padding: 10px 15px; font-size: 0.9em; text-align: center; border-top: 1px solid var(--border-color); }
.timer-status.active { color: var(--success); }
.timer-status.expired { color: var(--danger); }
.timer-status.expiring-soon { color: var(--warning); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 15px; background-color: rgba(0,0,0,0.1); border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.actions button { flex-grow: 1; font-size: 0.8em; background-color: var(--bg-light); color: var(--text); border: 1px solid var(--border-color); padding: 8px 10px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.actions button:hover { background-color: var(--secondary); border-color: var(--secondary); color: white; }
.actions button i { font-size: 0.9em; }


/* --- Estilos para o Modal --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.7); }
.modal-content { background-color: var(--bg-light); margin: 10% auto; padding: 0; border: 1px solid var(--border-color); width: 80%; max-width: 500px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); animation: fadeIn 0.3s; }
.modal-header { padding: 15px 25px; background-color: var(--primary); border-bottom: 1px solid var(--border-color); border-top-left-radius: 10px; border-top-right-radius: 10px; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.3em; }
.close-button { color: var(--text); font-size: 28px; font-weight: bold; cursor: pointer; }
.close-button:hover { color: var(--secondary); }
#link-form { padding: 25px; }
#link-form label { display: block; margin-bottom: 5px; font-weight: bold; color: var(--text-muted); }
#link-form input, #link-form select { width: 100%; padding: 10px; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 5px; background-color: var(--primary); color: var(--text); box-sizing: border-box; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions button { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.modal-actions .button-primary { background-color: var(--secondary); color: white; }
.modal-actions .button-primary:hover { background-color: #c73850; }
.modal-actions .button-secondary { background-color: var(--border-color); color: var(--text); }
.modal-actions .button-secondary:hover { background-color: #3b4d70; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* --- Responsividade --- */
@media (max-width: 768px) {
    .dashboard-main { flex-direction: column; padding: 10px; gap: 10px; }
    .stats-panel { width: auto; margin-bottom: 10px; }
    .sites-container { grid-template-columns: 1fr; }
    header { padding: 15px; }
    header h1 { font-size: 1.3em; }
    .sites-section, .logs-section { padding: 15px; }
    .modal-content { width: 95%; margin: 5% auto; }
}
