/* ============================================= */
/* MONITORAMENTO DE SITES — STYLE               */
/* ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f1219;
    --bg-card: #1a1f2e;
    --bg-input: #0f1219;
    --border: #2a3040;
    --border-light: #1e2535;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --text-dimmer: #475569;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #22c55e;
    --green-soft: #4ade80;
    --green-bg: #052e16;
    --red: #ef4444;
    --red-soft: #fca5a5;
    --red-bg: #450a0a;
    --yellow: #facc15;
    --yellow-bg: #422006;
    --radius: 10px;
    --radius-sm: 8px;
    --sidebar-width: 220px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 20px 12px;
    z-index: 100;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 8px;
    padding: 0 8px 20px; border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.logo-dot { color: var(--accent); font-size: 16px; }
.logo-text { font-size: 14px; font-weight: 700; color: #f1f5f9; }
.logo-accent { color: var(--accent); }

.sidebar-menu { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.menu-item:hover { background: #1e293b; color: #cbd5e1; }
.menu-item.active { background: #1e293b; color: var(--accent); }

.sidebar-footer {
    border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px;
}
.user-info { padding: 4px 12px 8px; }
.user-name { font-size: 12px; color: var(--text-dim); }
.logout-link { color: var(--red-soft) !important; }
.logout-link:hover { background: var(--red-bg) !important; }

/* ---- CONTENT ---- */
.content {
    margin-left: var(--sidebar-width);
    padding: 28px 32px 40px;
    max-width: 1000px;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: #f1f5f9; }
.page-header .subtitle { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; border: none;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #1e293b; color: var(--text-muted); border: 1px solid #334155; }
.btn-secondary:hover { background: #273548; }
.btn-danger { background: var(--red-bg); color: var(--red-soft); }
.btn-danger:hover { background: #5c1010; }
.btn-success { background: var(--green-bg); color: var(--green-soft); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---- STATS ---- */
.stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
}
.stat-card .label { font-size: 12px; color: var(--text-dim); font-weight: 500; margin-bottom: 4px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }
.stat-card .value.blue { color: #60a5fa; }

/* ---- TABLE ---- */
.table-wrap {
    overflow-x: auto; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; font-size: 11px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.data-table tr:hover td { background: #1e2535; }
.data-table .site-name { font-weight: 600; }
.data-table .site-url { font-size: 12px; color: var(--text-dim); }

/* ---- STATUS ---- */
.status-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5); animation: pulse-red 1.5s infinite; }
.status-dot.pendente { background: var(--yellow); }

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 6px rgba(239,68,68,0.5); }
    50% { box-shadow: 0 0 14px rgba(239,68,68,0.8); }
}

.status-badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-badge.online { background: var(--green-bg); color: var(--green-soft); }
.status-badge.offline { background: var(--red-bg); color: var(--red-soft); }
.status-badge.pendente { background: var(--yellow-bg); color: var(--yellow); }

.row-offline { background: #1c0a0a !important; }
.row-offline:hover td { background: #250e0e !important; }

.latency { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---- CARDS ---- */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: #f1f5f9; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 9px 13px; background: var(--bg-input);
    border: 1px solid #334155; border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-family: inherit;
}
.form-group input:focus,
.form-group select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group .hint { font-size: 11px; color: var(--text-dimmer); margin-top: 3px; }

/* ---- CONFIG STATUS ---- */
.config-status {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px;
    font-size: 13px;
}
.config-status.ok { background: var(--green-bg); border: 1px solid #166534; color: var(--green-soft); }
.config-status.warn { background: var(--yellow-bg); border: 1px solid #854d0e; color: var(--yellow); }
.config-status .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.config-status.ok .dot { background: var(--green); }
.config-status.warn .dot { background: var(--yellow); }

/* ---- INCIDENTES ---- */
.incident {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.incident:last-child { border-bottom: none; }
.incident-icon {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0; font-weight: 700;
}
.incident-icon.down { background: var(--red-bg); color: var(--red-soft); }
.incident-icon.up { background: var(--green-bg); color: var(--green-soft); }
.incident-title { font-size: 14px; font-weight: 500; }
.incident-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---- UPTIME TIMELINE ---- */
.uptime-timeline { display: flex; gap: 2px; margin: 10px 0; }
.uptime-timeline .day { flex: 1; height: 28px; border-radius: 3px; cursor: default; position: relative; }
.uptime-timeline .day.up { background: var(--green); opacity: 0.7; }
.uptime-timeline .day.down { background: var(--red); opacity: 0.8; }
.uptime-timeline .day.partial { background: linear-gradient(to top, var(--red) 20%, var(--green) 20%); opacity: 0.7; }
.uptime-timeline .day.none { background: #1e293b; }
.timeline-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dimmer); }

/* ---- LOGIN ---- */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 36px; width: 100%; max-width: 380px;
}
.login-box .logo { text-align: center; margin-bottom: 28px; }
.login-box .logo .logo-text { font-size: 18px; }
.login-box .error-msg {
    background: var(--red-bg); border: 1px solid #7f1d1d; color: var(--red-soft);
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
}
.login-box .info-msg {
    background: #1e293b; border: 1px solid #334155; color: var(--text-muted);
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
}

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--green-bg); border: 1px solid #166534; color: var(--green-soft); }
.alert-error { background: var(--red-bg); border: 1px solid #7f1d1d; color: var(--red-soft); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center; padding: 48px 20px; color: var(--text-dim);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; margin-bottom: 16px; }

/* ---- TOAST ---- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; z-index: 9999;
    animation: slideUp 0.3s ease;
}
.toast.success { background: #166534; color: var(--green-soft); }
.toast.error { background: #7f1d1d; color: var(--red-soft); }

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

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
