/* =========================================================
   RotaCam — FINAL UI (Light NOC / Security Center)
   - Full width dashboard
   - Rota gradients
   - Severity borders + pulse
   - Feed hover + new event flash
   ========================================================= */

/* ---------------------------
   TOKENS / PALETA
----------------------------*/
:root {
    /* Rota palette */
    --rota-blue: #132b5b;
    --rota-cyan: #2ea7ad;
    --rota-lime: #c8f66a;
    --rota-green: #7fd37c;
    --rota-yellow: #f4d000;
    --rota-red: #ff2d2d;

    /* UI light */
    --bg: #f6f8fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #0f172a;
    --muted: #64748b;

    /* Elevation */
    --shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    --shadow2: 0 6px 14px rgba(15, 23, 42, 0.06);

    /* Radius */
    --r12: 12px;
    --r14: 14px;
    --r18: 18px;

    /* Status */
    --sev-warning: #f4d000;
    --sev-critical: #ff2d2d;
    --sev-new: #2ea7ad;

    /* Motion */
    --t: 160ms;
}

/* ---------------------------
   BASE
----------------------------*/
html,
body {
    height: 100%;
}

body.app-body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(900px 420px at 80% 0%, rgba(46, 167, 173, 0.10), transparent 60%),
        radial-gradient(900px 420px at 10% 0%, rgba(200, 246, 106, 0.12), transparent 60%),
        var(--bg);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
}

/* full width dashboard */
.container-fluid {
    width: 100%;
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

main.container-fluid {
    margin-top: 12px;
}

/* ---------------------------
   TOPBAR (verde igual login)
----------------------------*/
.rota-topbar {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    background: linear-gradient(90deg,
            #7fd37c 0%,
            #2ea7ad 45%,
            #132b5b 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    position: sticky;
    top: 0;
    z-index: 50;
}

.rota-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
}

.rota-logo {
    height: 34px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.22));
}

.rota-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.rota-brand-title {
    font-weight: 900;
    color: white;
    letter-spacing: .2px;
    font-size: 16px;
}

.rota-brand-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
}

/* center nav */
.rota-nav {
    display: flex;
    gap: 10px;
    margin: auto;
    align-items: center;
}

.rota-link {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    border: 1px solid transparent;
    transition: transform var(--t), background var(--t), border-color var(--t);
}

.rota-link:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.rota-link.active {
    background: rgba(0, 0, 0, 0.16);
    border-color: rgba(255, 255, 255, 0.30);
}

/* right actions */
.rota-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rota-badge {
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.rota-btn {
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.14);
    color: white;
    transition: transform var(--t), background var(--t), border-color var(--t);
}

.rota-btn:hover {
    background: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.30);
    transform: translateY(-1px);
}

.rota-btn-logout {
    border-color: rgba(255, 45, 45, 0.45);
    background: rgba(255, 45, 45, 0.14);
}

.rota-btn-logout:hover {
    background: rgba(255, 45, 45, 0.20);
}

/* mobile: some nav */
@media (max-width: 1200px) {
    .rota-nav {
        display: none;
    }
}

/* ---------------------------
   CARDS / HEADERS
----------------------------*/
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r14);
    box-shadow: var(--shadow2);
    overflow: hidden;
}

.card-header {
    font-weight: 900;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg,
            rgba(46, 167, 173, 0.16),
            rgba(127, 211, 124, 0.14));
}

/* títulos pequenos mais fortes */
.card-header .fw-semibold,
.card-header .fw-bold {
    font-weight: 900 !important;
}

/* ---------------------------
   KPI STRIP
----------------------------*/
.kpi-strip {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: var(--r14);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow2);
}

.kpi-chip {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 5px solid var(--rota-cyan);
    border-radius: var(--r12);
    padding: 12px 16px;
    min-width: 120px;
}

.kpi-chip.kpi-warn {
    border-left-color: var(--rota-yellow);
}

.kpi-chip.kpi-crit {
    border-left-color: var(--rota-red);
}

.kpi-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
}

.kpi-value {
    font-size: 20px;
    font-weight: 1000;
    color: var(--rota-blue);
}

/* ---------------------------
   BOTÕES (bootstrap)
----------------------------*/
.btn {
    border-radius: 12px;
    font-weight: 900;
}

.btn-outline-primary {
    border-color: rgba(46, 167, 173, 0.85) !important;
    color: var(--rota-cyan) !important;
}

.btn-outline-primary:hover {
    background: rgba(46, 167, 173, 0.12) !important;
}

.btn-outline-secondary {
    border-color: rgba(100, 116, 139, 0.30) !important;
    color: rgba(30, 41, 59, 0.85) !important;
}

.btn-outline-secondary:hover {
    background: rgba(100, 116, 139, 0.10) !important;
}

/* ---------------------------
   SEVERITY (borda e estados)
   Use classes:
   - .sev-warning
   - .sev-critical
   - .sev-new
----------------------------*/
.sev-warning {
    border-left: 6px solid var(--sev-warning) !important;
}

.sev-critical {
    border-left: 6px solid var(--sev-critical) !important;
}

.sev-new {
    border-left: 6px solid var(--sev-new) !important;
}

/* chip / badge severity */
.badge {
    border-radius: 999px;
    font-weight: 900;
}

.badge-warning {
    background: var(--rota-yellow);
    color: #111;
}

.badge-critical {
    background: var(--rota-red);
    color: #fff;
}

.badge-new {
    background: var(--rota-cyan);
    color: #fff;
}

/* ---------------------------
   FEED (hover highlight + novo evento)
----------------------------*/
.feed-list {
    max-height: 640px;
    overflow: auto;
}

/* itens do feed (se você já monta via JS, use .feed-item) */
.feed-item {
    display: flex;
    gap: 10px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    transition: background var(--t), transform var(--t);
    position: relative;
}

.feed-item:hover {
    background: rgba(46, 167, 173, 0.08);
    transform: translateY(-1px);
}

/* thumb */
.feed-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: #0f172a;
    overflow: hidden;
    flex: 0 0 auto;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.10);
}

/* destaque de chegada (adicionar class is-new por 1.5s e remover) */
.feed-item.is-new {
    animation: feedFlash 1100ms ease-out 1;
}

@keyframes feedFlash {
    0% {
        background: rgba(46, 167, 173, 0.22);
    }

    55% {
        background: rgba(46, 167, 173, 0.10);
    }

    100% {
        background: transparent;
    }
}

/* pulse só quando crítico novo */
.feed-item.is-new.sev-critical::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 12px;
    border: 2px solid rgba(255, 45, 45, 0.35);
    animation: pulseCritical 900ms ease-out infinite;
    pointer-events: none;
}

@keyframes pulseCritical {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.04);
    }
}

/* ---------------------------
   DETALHE / VIDEO
----------------------------*/
.video-box {
    border-radius: var(--r14);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0b1220;
    box-shadow: var(--shadow2);
}

.video-box img {
    display: block;
    width: 100%;
}

/* overlay badges */
.video-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.video-box {
    position: relative;
}

/* ---------------------------
   LISTAS "mini" (Top placas/Top alarmes)
----------------------------*/
.mini-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mini-list .rowitem {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.mini-list .rowitem:hover {
    background: rgba(19, 43, 91, 0.04);
}

/* ---------------------------
   UTIL
----------------------------*/
.text-muted {
    color: var(--muted) !important;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* scrollbars (Chrome/Edge) */
.feed-list::-webkit-scrollbar {
    width: 10px;
}

.feed-list::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
}

.feed-list::-webkit-scrollbar-track {
    background: rgba(100, 116, 139, 0.12);
}


.feed-item.active {
    background: rgba(19, 43, 91, 0.06);
}

.feed-item.sev-warning {
    border-left: 6px solid var(--rota-yellow) !important;
}

.feed-item.sev-critical {
    border-left: 6px solid var(--rota-red) !important;
}

.feed-item.sev-new {
    border-left: 6px solid var(--rota-cyan) !important;
}


/* =========================
   DETAIL FIELDS (GRID)
   ========================= */
.grid-fields {
    display: grid;
    gap: 12px;
}

.grid-fields-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 0;
}

.field-wide {
    grid-column: span 3;
}

.field-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .2px;
    color: rgba(15, 23, 42, .65);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.field-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    word-break: break-word;
}

.field-value.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
}

/* responsivo: vira 1 coluna */
@media (max-width: 992px) {
    .grid-fields-3 {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }
}


/* =========================
   KPIs (colors by type)
   ========================= */
.kpi-strip {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(15, 23, 42, .08);
}

.kpi-chip {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .10);
    border-radius: 14px;
    padding: 10px 14px;
    min-width: 92px;
    position: relative;
    overflow: hidden;
}

.kpi-chip::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #2EA7AD;
    /* default rota teal */
}

.kpi-label {
    font-size: 12px;
    font-weight: 800;
    color: rgba(15, 23, 42, .65);
    margin-bottom: 2px;
}

.kpi-value {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
}

/* warning amarelo */
.kpi-chip[data-kpi="warning"]::before {
    background: #F2C200;
}

.kpi-chip[data-kpi="warning"] .kpi-value {
    color: #8A5B00;
}

/* critical vermelho */
.kpi-chip[data-kpi="critical"]::before {
    background: #FF2D2D;
}

.kpi-chip[data-kpi="critical"] .kpi-value {
    color: #B40000;
}

/* new verde-lima (opcional) */
.kpi-chip[data-kpi="new"]::before {
    background: #C8F66A;
}

.kpi-chip[data-kpi="new"] .kpi-value {
    color: #2a5d00;
}

#detailCard.sev-warning {
    box-shadow: 0 0 0 2px rgba(242, 194, 0, .35) inset;
}

#detailCard.sev-critical {
    box-shadow: 0 0 0 2px rgba(255, 45, 45, .35) inset;
}

#detailCard.sev-new {
    animation: pulseNew 1.2s ease-in-out infinite;
}

@keyframes pulseNew {

    0%,
    100% {
        filter: none;
    }

    50% {
        filter: saturate(1.15);
    }
}

/* =========================
   DETAIL COMPACT + MAP
   (reduz infos abaixo da imagem)
   ========================= */

.detail-compact {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1.3fr;
    gap: .75rem;
    padding: .75rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: var(--r14);
    background: #fff;
    box-shadow: var(--shadow2);
}

.dc-item {
    min-width: 0;
}

.dc-wide {
    min-width: 0;
}

.dc-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .2px;
    color: rgba(15, 23, 42, .65);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.dc-value {
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-wrap {
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: var(--r14);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow2);
}

.map-head {
    padding: .6rem .75rem;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
}

.map-box {
    height: 260px;
    /* pode ajustar */
}

/* Detalhes opcionais (accordion body) */
.detail-more .dm-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem 0;
    border-bottom: 1px dashed rgba(15, 23, 42, .12);
}

.detail-more .dm-row:last-child {
    border-bottom: 0;
}

.detail-more .k {
    opacity: .7;
    font-weight: 800;
}

.detail-more .v {
    font-weight: 900;
    text-align: right;
}

/* responsivo */
@media (max-width: 992px) {
    .detail-compact {
        grid-template-columns: 1fr 1fr;
    }
}