/* ============================================================
   Atalaia by Parlem Empreses — CSS complet
   ============================================================ */

/*
 * ──────────────────────────────────────────────────────────────
 *  PERSONALITZACIÓ DE MARCA — edita aquí per canviar els colors
 * ──────────────────────────────────────────────────────────────
 *
 *  Color principal (botó login, accents, navbar top bar, etc.)
 *  Parlem Empreses usa groc daurat. Canvia per adaptar a la marca.
 *
 *    Groc Parlem (actual):  #F5C400
 *    Blau corporatiu:       #0066CC
 *    Verd:                  #16a34a
 *    O qualsevol hex propi
 *
 *  Per canviar: modifica NOMÉS les dues variables de sota.
 * ──────────────────────────────────────────────────────────────
 */

:root {
    --brand-primary:    #F5C400;   /* ← COLOR PRINCIPAL DE MARCA */
    --brand-primary-dk: #D4A900;   /* ← VARIANT FOSCA (hover, pressed) */
    --brand-primary-lt: #FFD740;   /* ← VARIANT CLARA (glow, focus ring) */

    /* Àlies per compatibilitat interna — no cal tocar */
    --parlem-yellow:      var(--brand-primary);
    --parlem-yellow-dark: var(--brand-primary-dk);
    --bg-base:          #0f1117;
    --bg-surface:       #1a1d27;
    --bg-card:          #20232f;
    --bg-hover:         #2a2d3a;
    --border:           #2e3147;
    --border-light:     #3d4060;
    --text-primary:     #e8eaf0;
    --text-muted:       #8b8fa8;
    --text-dim:         #555870;
    --auth-bg:          #f4f4f5;
    --auth-card:        #ffffff;
    --auth-border:      #e4e4e7;
    --auth-text:        #18181b;
    --auth-muted:       #71717a;
    --green:  #16a34a;
    --yellow: #ca8a04;
    --orange: #e07820;
    --red:    #e03030;
    --blue:   #2563eb;
    --radius:    6px;
    --radius-lg: 10px;
    --radius-xl: 16px;
}

html, body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.5; min-height: 100vh; }
body.auth-page  { background: var(--auth-bg); color: var(--auth-text); }
body:not(.auth-page) { background: var(--bg-base); color: var(--text-primary); }

/* ── AUTH split layout ──────────────────────────────────────── */
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-brand-panel {
    background: var(--brand-primary);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px; position: relative; overflow: hidden;
}
.auth-brand-panel::before {
    content: ''; position: absolute; top: -80px; right: -80px;
    width: 300px; height: 300px; border-radius: 50%; background: rgba(255,255,255,0.06);
}
.auth-brand-panel::after {
    content: ''; position: absolute; bottom: -60px; left: -60px;
    width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,0.04);
}
.auth-brand-inner { position: relative; z-index: 1; }
.auth-brand-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 64px; }
.auth-brand-names { display: flex; flex-direction: column; }
.auth-brand-product { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.02em; line-height: 1; }
.auth-brand-company { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 3px; }
.auth-brand-tagline h2 { font-size: 28px; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 12px; letter-spacing: -0.02em; }
.auth-brand-tagline p { font-size: 15px; color: rgba(255,255,255,0.75); line-height: 1.6; margin-bottom: 40px; }
.auth-brand-features { display: flex; flex-direction: column; gap: 14px; }
.auth-feature { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.85); font-size: 14px; }
.auth-feature-icon { font-size: 18px; }
.auth-brand-footer { font-size: 12px; color: rgba(255,255,255,0.45); position: relative; z-index: 1; }
.auth-form-panel { display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--auth-card); }
.auth-form-inner { width: 100%; max-width: 380px; }
.auth-form-header { margin-bottom: 32px; }
.auth-form-header h1 { font-size: 24px; font-weight: 700; color: var(--auth-text); margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-form-header p { font-size: 14px; color: var(--auth-muted); }
@media (max-width: 768px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-brand-panel { display: none; }
    .auth-form-panel { padding: 32px 24px; }
}

/* ── Auth simple ────────────────────────────────────────────── */
.auth-simple-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-simple-card { background: var(--auth-card); border: 1px solid var(--auth-border); border-radius: var(--radius-xl); padding: 40px; width: 100%; max-width: 440px; }
.auth-simple-card-wide { max-width: 560px; }
.auth-simple-logo { display: flex; align-items: baseline; gap: 8px; margin-bottom: 28px; }
.auth-simple-brand { font-size: 18px; font-weight: 700; color: var(--brand-primary); letter-spacing: -0.02em; }
.auth-simple-by { font-size: 11px; color: var(--auth-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.auth-simple-title { font-size: 20px; font-weight: 700; color: var(--auth-text); margin-bottom: 8px; }
.auth-simple-sub { font-size: 14px; color: var(--auth-muted); line-height: 1.6; margin-bottom: 24px; }
.mfa-icon { font-size: 36px; margin-bottom: 12px; }

/* ── Forms ──────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--auth-text); }
.form-group input, .form-group select {
    background: var(--auth-bg); border: 1px solid var(--auth-border); border-radius: var(--radius);
    color: var(--auth-text); padding: 10px 14px; font-size: 14px; font-family: inherit;
    width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}
.input-disabled { opacity: 0.6; cursor: not-allowed; }
.input-otp { font-size: 24px !important; letter-spacing: 0.3em; text-align: center; font-family: monospace !important; }
.form-hint { font-size: 12px; color: var(--auth-muted); }
.form-error { font-size: 12px; color: var(--brand-primary); }
.form-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--auth-muted); cursor: pointer; }
.form-remember input { width: 14px; height: 14px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    background: var(--brand-primary); color: #fff; border: none; border-radius: var(--radius);
    padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 0.15s; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn-primary:hover { background: var(--brand-primary-dk); }
.btn-full { width: 100%; }
.btn-arrow { font-size: 16px; }
.btn-secondary {
    background: transparent; color: var(--auth-text); border: 1px solid var(--auth-border);
    border-radius: var(--radius); padding: 9px 16px; font-size: 13px; font-weight: 500;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-secondary:hover { background: var(--auth-bg); }
.btn-danger {
    background: transparent; color: var(--red); border: 1px solid var(--red);
    border-radius: var(--radius); padding: 9px 16px; font-size: 13px; font-weight: 500;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-danger:hover { background: rgba(224,48,48,0.08); }
.btn-link { background: none; border: none; color: var(--auth-muted); font-size: 13px; cursor: pointer; font-family: inherit; text-decoration: underline; }

/* ── Alerts ─────────────────────────────────────────────────── */
.auth-alert { border-radius: var(--radius); padding: 12px 16px; font-size: 13px; line-height: 1.5; margin-bottom: 20px; }
.auth-alert-error   { background: rgba(245,196,0,0.08);  border: 1px solid rgba(245,196,0,0.30);  color: var(--brand-primary-dk); }
.auth-alert-warning { background: rgba(202,138,4,0.08); border: 1px solid rgba(202,138,4,0.25); color: #854d0e; }
.auth-alert-success { background: rgba(22,163,74,0.08); border: 1px solid rgba(22,163,74,0.25); color: #166534; }
.auth-alert-info    { background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.25); color: #1e40af; }
.auth-help { margin-top: 24px; text-align: center; font-size: 12px; color: var(--auth-muted); }
.auth-help a { color: var(--brand-primary); text-decoration: none; }
.auth-help a:hover { text-decoration: underline; }

/* ── MFA steps ──────────────────────────────────────────────── */
.mfa-steps { display: flex; flex-direction: column; gap: 24px; }
.mfa-step { display: flex; gap: 16px; align-items: flex-start; }
.mfa-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-primary); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.mfa-step-body { flex: 1; }
.mfa-step-body strong { font-size: 14px; color: var(--auth-text); display: block; margin-bottom: 4px; }
.mfa-step-body p { font-size: 13px; color: var(--auth-muted); margin-bottom: 12px; }
.mfa-qr-wrapper { background: #fff; border: 1px solid var(--auth-border); border-radius: var(--radius); padding: 12px; display: inline-block; margin-bottom: 12px; }
.mfa-qr { display: block; }
.mfa-secret-toggle { font-size: 12px; color: var(--auth-muted); cursor: pointer; }
.mfa-secret-toggle summary { list-style: none; }
.mfa-secret-code { display: block; font-family: monospace; font-size: 13px; letter-spacing: 0.08em; background: var(--auth-bg); padding: 8px 12px; border-radius: var(--radius); margin-top: 8px; word-break: break-all; color: var(--auth-text); }
.mfa-recovery-toggle { margin-top: 20px; font-size: 13px; color: var(--auth-muted); border: 1px solid var(--auth-border); border-radius: var(--radius); padding: 12px 16px; }
.mfa-recovery-toggle summary { cursor: pointer; list-style: none; }

/* ── Recovery codes ─────────────────────────────────────────── */
.recovery-codes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.recovery-code { font-family: monospace; font-size: 14px; letter-spacing: 0.1em; background: var(--auth-bg); border: 1px solid var(--auth-border); border-radius: var(--radius); padding: 8px 12px; text-align: center; color: var(--auth-text); }
.recovery-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.recovery-confirm { margin-bottom: 20px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--auth-muted); cursor: pointer; line-height: 1.5; }
.checkbox-label input { margin-top: 2px; flex-shrink: 0; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.badge-success { background: rgba(22,163,74,0.12); color: #166534; }
.badge-warning { background: rgba(202,138,4,0.12); color: #854d0e; }
.badge-danger  { background: rgba(245,196,0,0.10);  color: var(--brand-primary-dk); }

/* ── Profile card ───────────────────────────────────────────── */
.profile-card { background: #fff; border: 1px solid var(--auth-border); border-radius: var(--radius-lg); overflow: hidden; }
body:not(.auth-page) .profile-card { background: var(--bg-card); border-color: var(--border); }
.profile-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--auth-border); }
body:not(.auth-page) .profile-card-header { border-bottom-color: var(--border); }
.profile-card-header h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.profile-card-header p { font-size: 13px; color: var(--text-muted); }
.profile-card-body { padding: 20px 24px; }
.profile-info-text { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.mfa-disable-section { margin-top: 16px; }
.mfa-disable-toggle { font-size: 13px; color: var(--red); cursor: pointer; list-style: none; }
.mfa-disable-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar { background: var(--bg-surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; position: relative; }
.navbar::before { content: ''; display: block; height: 3px; background: var(--brand-primary); position: absolute; top: 0; left: 0; right: 0; }
.navbar-inner { max-width: 1600px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; justify-content: space-between; }
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-parlem-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); flex-shrink: 0; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.brand-by { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; padding-left: 8px; border-left: 1px solid var(--border); }
.client-logo { height: 26px; width: auto; object-fit: contain; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-user { font-size: 13px; color: var(--text-muted); }
.navbar-mfa-badge { font-size: 11px; background: rgba(22,163,74,0.15); color: #4ade80; border-radius: 99px; padding: 2px 8px; font-weight: 600; }
.navbar-profile-link { font-size: 12px; color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.navbar-profile-link:hover { color: var(--text-primary); }
.btn-logout { font-size: 12px; color: var(--text-muted); background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 12px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn-logout:hover { color: var(--text-primary); border-color: var(--border-light); }

/* ── App layout ─────────────────────────────────────────────── */
.main-content { max-width: 1600px; margin: 0 auto; padding: 24px 20px; }
.page-container { max-width: 900px; }
.page-header { margin-bottom: 32px; }
.page-title { font-size: 22px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); }

/* ── Dashboard list ─────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.dashboard-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-lg); padding: 20px;
    text-decoration: none; color: var(--text-primary); transition: all 0.15s;
}
.dashboard-card:hover { background: var(--bg-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.dashboard-card-icon { font-size: 24px; }
.dashboard-card-name { flex: 1; font-weight: 500; }
.dashboard-card-arrow { color: var(--brand-primary); font-size: 16px; }

/* ── Toolbar ────────────────────────────────────────────────── */
.dashboard-wrapper { width: 100%; }
.dash-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 14px; flex-wrap: wrap; gap: 10px; transition: opacity 0.4s, transform 0.4s; }
.toolbar-hidden { opacity: 0; pointer-events: none; transform: translateY(-8px); }
.dash-toolbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dash-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 13px; transition: color 0.15s; }
.back-link:hover { color: var(--text-primary); }
.dash-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.toolbar-select { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); padding: 5px 10px; font-size: 12px; cursor: pointer; font-family: inherit; }
.toolbar-select:focus { outline: none; border-color: var(--brand-primary); }
.toolbar-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; transition: all 0.15s; flex-shrink: 0; }
.toolbar-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.toolbar-btn-fullscreen { font-size: 17px; }
.refresh-countdown { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); min-width: 48px; }
.countdown-icon { display: inline-block; transition: transform 0.3s; }
.countdown-icon.spinning { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pages tabs ─────────────────────────────────────────────── */
.dash-pages { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); transition: opacity 0.4s; }
.page-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); padding: 8px 16px; font-size: 13px; cursor: pointer; transition: all 0.15s; margin-bottom: -1px; }
.page-tab:hover { color: var(--text-primary); }
.page-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

/* ── Zabbix grid ────────────────────────────────────────────── */
.zbx-grid { display: grid; grid-template-columns: repeat(36, 1fr); grid-auto-rows: 46px; gap: 4px; width: 100%; }
.zbx-widget { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.widget-title { font-size: 11px; font-weight: 500; color: var(--text-muted); padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; background: var(--bg-surface); }
.widget-body { flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: stretch; }
.widget-chart, .widget-map { width: 100%; height: 100%; }
.chart-img, .map-img { width: 100%; height: 100%; object-fit: fill; display: block; }
.widget-load-error { position: relative; }
.widget-load-error::after { content: 'Error de càrrega'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-dim); background: var(--bg-surface); }
.widget-clock { align-items: center; justify-content: center; flex-direction: column; }
.clock-display { text-align: center; }
.clock-time { display: block; font-size: 28px; font-weight: 300; font-variant-numeric: tabular-nums; color: var(--text-primary); letter-spacing: 0.04em; }
.clock-date { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.problems-list { width: 100%; height: 100%; overflow-y: auto; padding: 4px 0; }
.problems-ok { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--green); font-size: 13px; }
.ok-icon { font-size: 16px; }
.problems-count { font-size: 11px; color: var(--text-muted); padding: 4px 8px; }
.problem-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-left: 3px solid transparent; font-size: 12px; }
.problem-row + .problem-row { border-top: 1px solid var(--border); }
.problem-sev { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; min-width: 70px; }
.problem-name { flex: 1; color: var(--text-primary); }
.problem-age { color: var(--text-muted); font-size: 11px; min-width: 30px; text-align: right; }
.problem-ack { color: var(--green); font-size: 11px; }
.sev-nc      { border-left-color: #aaa; } .sev-nc .problem-sev { color: #aaa; }
.sev-info    { border-left-color: #4488ff; } .sev-info .problem-sev { color: #4488ff; }
.sev-warning { border-left-color: var(--yellow); background: rgba(240,192,64,0.05); } .sev-warning .problem-sev { color: var(--yellow); }
.sev-average { border-left-color: var(--orange); background: rgba(224,120,32,0.07); } .sev-average .problem-sev { color: var(--orange); }
.sev-high    { border-left-color: var(--red); background: rgba(224,48,48,0.08); } .sev-high .problem-sev { color: var(--red); }
.sev-disaster { border-left-color: #8b1a1a; background: rgba(139,26,26,0.15); } .sev-disaster .problem-sev { color: #ff6060; }
.widget-unsupported { align-items: center; justify-content: center; color: var(--text-dim); font-size: 11px; }

/* ── Fullscreen ─────────────────────────────────────────────── */
#dashboard-wrapper:fullscreen, #dashboard-wrapper:-webkit-full-screen { background: var(--bg-base); overflow-y: auto; padding: 0 16px 16px; }
#dashboard-wrapper:fullscreen .zbx-grid, #dashboard-wrapper:-webkit-full-screen .zbx-grid { grid-auto-rows: calc((100vh - 100px) / 12); }
.fullscreen-trigger { position: fixed; top: 0; left: 0; right: 0; height: 40px; z-index: 200; }
.last-update-badge { position: fixed; bottom: 12px; right: 16px; font-size: 11px; color: var(--text-dim); background: rgba(15,17,23,0.7); padding: 4px 10px; border-radius: var(--radius); pointer-events: none; z-index: 100; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 16px; }
.empty-sub { font-size: 12px; color: var(--text-dim); margin-top: 8px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) { .zbx-grid { grid-auto-rows: 38px; } .main-content { padding: 16px 12px; } .dash-title { font-size: 15px; } }
@media (max-width: 640px) {
    .zbx-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 44px; }
    .dash-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .dash-toolbar-right { width: 100%; justify-content: flex-start; }
    .toolbar-btn-fullscreen { margin-left: auto; }
    .navbar-user { display: none; }
    .dash-title { font-size: 14px; }
}
@media (min-width: 1920px) { .zbx-grid { grid-auto-rows: 58px; } .main-content { max-width: 100%; padding: 20px 32px; } }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
