/* ============================================================
   3CX Monitor — Vertical Iberica
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --bg2: #1a1d27;
    --bg3: #22263a;
    --border: #2e3250;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f97316;
    --yellow: #eab308;
    --radius: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier New', monospace;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================ NAVBAR */
.navbar {
    display: flex; align-items: center; gap: 24px;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 8px; margin-right: 16px; }
.nav-logo { font-size: 20px; }
.nav-title { font-weight: 700; font-size: 15px; color: var(--text); }
.nav-subtitle { color: var(--text-muted); font-size: 12px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
    padding: 6px 14px; border-radius: var(--radius); color: var(--text-muted);
    font-size: 13px; transition: background 0.15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--bg3); color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.logout { color: var(--text-muted); }

/* ============================================================ LANG */
.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
    padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); border: 1px solid var(--border); transition: all 0.15s;
}
.lang-btn:hover { color: var(--text); text-decoration: none; border-color: var(--primary); }
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================ MAIN */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.btn-back {
    display: inline-block; margin-bottom: 12px; color: var(--text-muted);
    font-size: 13px;
}
.btn-back:hover { color: var(--text); }

/* ============================================================ STATS */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px;
}
.stat-value { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-online .stat-value { color: var(--green); }
.stat-danger .stat-value { color: var(--red); }
.stat-warning .stat-value { color: var(--yellow); }

/* ============================================================ TABLE */
.table-container { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--bg3); }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg3); }
.row-offline { opacity: 0.6; }
.td-mono { font-family: var(--font-mono); font-size: 12px; }
.td-description { font-weight: 500; max-width: 220px; }
.td-lastseen { font-size: 12px; color: var(--text-muted); }
.text-muted { color: var(--text-muted); }

/* ============================================================ STATUS DOT */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-offline { background: var(--red); }

/* ============================================================ BARS */
.bar-container { display: inline-block; width: 60px; height: 6px; background: var(--bg3); border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.bar-container.bar-lg { width: 120px; height: 8px; }
.bar { height: 100%; border-radius: 3px; transition: width 0.3s; }
.bar-ok { background: var(--green); }
.bar-warning { background: var(--yellow); }
.bar-danger { background: var(--red); }
.bar-label { font-size: 12px; color: var(--text-muted); }

/* ============================================================ BUTTONS */
.btn-primary {
    background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
    padding: 8px 18px; font-size: 14px; cursor: pointer; transition: background 0.15s;
    display: inline-block;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: 4px 12px; font-size: 12px; background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: 5px; cursor: pointer; display: inline-block; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ============================================================ BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-ok { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-warning { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge-ssh { color: var(--orange); font-weight: 600; }

/* ============================================================ CARDS */
.card {
    background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px;
}
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 16px; }
.mt { margin-top: 20px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }

.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-table td:first-child { color: var(--text-muted); width: 45%; }
.info-table tr:last-child td { border-bottom: none; }

.metric-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--text-muted); font-size: 13px; width: 120px; flex-shrink: 0; }
.metric-value { font-weight: 600; font-size: 13px; margin-left: auto; }

.textarea-desc {
    width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px;
    color: var(--text); padding: 8px 10px; font-family: var(--font); font-size: 13px;
    resize: vertical; min-height: 70px;
}
.textarea-desc:focus { outline: none; border-color: var(--primary); }
.form-actions { margin-top: 10px; }

/* ============================================================ LOGIN */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-container {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
    padding: 40px 48px; width: 100%; max-width: 380px; text-align: center;
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-lang { justify-content: center; margin-bottom: 24px; }
.login-form { text-align: left; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input {
    width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); padding: 10px 12px; font-size: 14px;
}
.form-group input:focus { outline: none; border-color: var(--primary); }
.login-form .btn-primary { width: 100%; margin-top: 8px; padding: 11px; }
.alert-error { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }

/* ============================================================ EMPTY */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ============================================================ RESPONSIVE */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 16px; }
    .main { padding: 16px; }
}
