/* ==========================================================================
   LATAM Akash Status — Design responsivo (inspirado no AppDashboard)
   ========================================================================== */

:root {
    --latam-cyan: #00d1ff;
    --latam-cyan-soft: #e0f7ff;
    --latam-purple: #6f42c1;
    --latam-dark: #0d1117;
    --latam-darker: #161b22;
    --latam-gray: #30363d;
    --latam-border: #e5e7eb;
    --latam-bg: #f5f7fa;
    --latam-text: #1f2937;
    --latam-text-muted: #6b7280;

    --status-ok: #10b981;
    --status-warn: #f59e0b;
    --status-fail: #ef4444;
    --status-info: #3b82f6;

    --topbar-h: 60px;
    --sidebar-w: 260px;
    --radius: 0.75rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--latam-text);
    background: var(--latam-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--latam-cyan); text-decoration: none; }
a:hover { color: #0096bf; }

/* ==========================================================================
   APP SHELL — topbar + sidebar + main
   ========================================================================== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--latam-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0;
}

.app-topbar .navbar-brand {
    color: var(--latam-dark);
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 1.05rem;
}
.app-topbar .navbar-brand .accent { color: var(--latam-cyan); }

.brand-mark {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--latam-cyan) 0%, #0096bf 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.6rem;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 209, 255, 0.3);
}
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.brand-sub { font-size: 0.7rem; color: var(--latam-text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.btn-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--latam-border);
    background: #fff;
    color: var(--latam-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
}
.btn-icon:hover { background: var(--latam-bg); border-color: #d1d5db; }
.btn-lang { width: auto; padding: 0 0.6rem; }

.btn-avatar {
    padding: 2px;
    border: 0;
    background: transparent;
}
.avatar-initials {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--latam-purple) 0%, var(--latam-cyan) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: #ecfdf5;
    color: #065f46;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.live-indicator .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--status-ok);
    animation: pulse-success 1.6s infinite;
}
.live-indicator.offline { background: #fee2e2; color: #991b1b; }
.live-indicator.offline .dot { background: var(--status-fail); animation: none; }

/* ==========================================================================
   SHELL BODY — sidebar + main grid
   ========================================================================== */
.app-shell-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
}

@media (min-width: 992px) {
    .app-shell-body {
        grid-template-columns: var(--sidebar-w) 1fr;
    }
}

.app-sidebar {
    background: #fff;
    border-right: 1px solid var(--latam-border);
    width: var(--sidebar-w);
    max-width: 85vw;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: var(--topbar-h);
        height: calc(100vh - var(--topbar-h));
        visibility: visible !important;
        transform: none !important;
        border-right: 1px solid var(--latam-border);
    }
    .app-sidebar .offcanvas-header { display: none; }
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-workspace {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--latam-border);
}
.workspace-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--latam-text-muted);
    font-weight: 600;
    letter-spacing: 0.6px;
}
.workspace-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--latam-dark);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    overflow-y: auto;
}
.sidebar-nav .nav-link {
    color: var(--latam-text);
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: all 0.12s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; color: var(--latam-text-muted); }
.sidebar-nav .nav-link:hover { background: var(--latam-bg); color: var(--latam-dark); }
.sidebar-nav .nav-link:hover i { color: var(--latam-cyan); }
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--latam-cyan-soft), #f0f9ff);
    color: var(--latam-dark);
    font-weight: 600;
}
.sidebar-nav .nav-link.active i { color: var(--latam-cyan); }

.sidebar-section {
    padding: 1rem 0.85rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--latam-text-muted);
    font-weight: 700;
    letter-spacing: 0.6px;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--status-ok);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.status-dot.degraded { background: var(--status-warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.status-dot.outage { background: var(--status-fail); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

.sidebar-footer { border-top: 1px solid var(--latam-border); padding: 0.5rem 0; }

.app-main {
    min-width: 0; /* permite shrink dentro do grid */
    background: var(--latam-bg);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
    background: var(--latam-dark);
    color: #c9d1d9;
    padding: 2rem 0 1.25rem;
    border-top: 3px solid var(--latam-cyan);
}
.app-footer .accent { color: var(--latam-cyan); }
.app-footer a { color: var(--latam-cyan); }
.app-footer a:hover { color: #66e7ff; }
.footer-hr { border-color: #21262d; opacity: 1; }
.footer-copy { color: #8b949e; }

/* ==========================================================================
   STATUS PILLS
   ========================================================================== */
.status-pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-pill.operational { background: #d1fae5; color: #065f46; }
.status-pill.operational .dot { background: var(--status-ok); box-shadow: 0 0 0 0 var(--status-ok); animation: pulse-success 2s infinite; }
.status-pill.degraded, .status-pill.partial_outage { background: #fef3c7; color: #92400e; }
.status-pill.degraded .dot, .status-pill.partial_outage .dot { background: var(--status-warn); }
.status-pill.major_outage, .status-pill.outage { background: #fee2e2; color: #991b1b; }
.status-pill.major_outage .dot, .status-pill.outage .dot { background: var(--status-fail); animation: pulse-danger 1.5s infinite; }
.status-pill.maintenance { background: #dbeafe; color: #1e40af; }
.status-pill.maintenance .dot { background: var(--status-info); }
.status-pill.investigating { background: #fee2e2; color: #991b1b; }
.status-pill.identified { background: #fef3c7; color: #92400e; }
.status-pill.monitoring { background: #dbeafe; color: #1e40af; }
.status-pill.resolved { background: #d1fae5; color: #065f46; }
.status-pill.investigating .dot { background: var(--status-fail); }
.status-pill.identified .dot { background: var(--status-warn); }
.status-pill.monitoring .dot { background: var(--status-info); }
.status-pill.resolved .dot { background: var(--status-ok); }

@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulse-danger {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   HERO BANNER
   ========================================================================== */
.hero-banner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: var(--radius);
    color: #fff;
    padding: 2.25rem 1.75rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero-banner.degraded { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.hero-banner.partial_outage { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.hero-banner.major_outage { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.hero-banner.maintenance { background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%); }
.hero-banner h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    position: relative;
}
.hero-banner .lead-text {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
    position: relative;
}
.hero-banner .hero-meta {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.85rem;
    opacity: 0.95;
    position: relative;
}
.hero-banner .hero-meta span i { margin-right: 4px; }

@media (max-width: 575.98px) {
    .hero-banner { padding: 1.5rem 1.25rem; }
    .hero-banner h1 { font-size: 1.3rem; }
}

/* ==========================================================================
   KPI CARDS
   ========================================================================== */
.kpi-card {
    background: #fff;
    border: 1px solid var(--latam-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
    height: 100%;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.kpi-icon.ok { background: #d1fae5; color: #065f46; }
.kpi-icon.warn { background: #fef3c7; color: #92400e; }
.kpi-icon.fail { background: #fee2e2; color: #991b1b; }
.kpi-icon.info { background: #dbeafe; color: #1e40af; }
.kpi-icon.purple { background: #ede9fe; color: #5b21b6; }
.kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--latam-text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--latam-dark);
    line-height: 1.1;
    margin: 2px 0 0;
    font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 0.78rem; color: var(--latam-text-muted); margin-top: 2px; }

/* ==========================================================================
   SERVICE CARDS
   ========================================================================== */
.card-service {
    background: #fff;
    border: 1px solid var(--latam-border);
    border-radius: var(--radius);
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
    height: 100%;
}
.card-service:hover { box-shadow: var(--shadow-md); }
.card-service.outage { border-left: 4px solid var(--status-fail); }
.card-service.degraded { border-left: 4px solid var(--status-warn); }
.card-service.partial_outage { border-left: 4px solid #f97316; }
.card-service.operational { border-left: 4px solid var(--status-ok); }
.card-service.maintenance { border-left: 4px solid var(--status-info); }
.card-service .card-body { padding: 1.15rem 1.25rem; }

.card-service .card-title { font-size: 1rem; font-weight: 600; color: var(--latam-dark); }

.metric-tile {
    background: #f9fafb;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    border: 1px solid #f3f4f6;
}
.metric-tile .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--latam-text-muted);
    letter-spacing: 0.4px;
    font-weight: 600;
}
.metric-tile .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--latam-dark);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    margin-top: 2px;
}
.metric-tile .unit { font-size: 0.8rem; color: var(--latam-text-muted); font-weight: 500; }

/* ==========================================================================
   PTERODACTYL NODES / LOCATIONS
   ========================================================================== */
.location-card {
    background: #fff;
    border: 1px solid var(--latam-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    height: 100%;
}
.location-header {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--latam-border);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: linear-gradient(180deg, #f9fafb, #fff);
}
.location-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--latam-cyan), #0096bf);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.location-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--latam-dark);
    line-height: 1.2;
}
.location-desc { font-size: 0.75rem; color: var(--latam-text-muted); }
.location-body { padding: 0.5rem 0; }

.node-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.15rem;
    border-top: 1px solid #f3f4f6;
    transition: background 0.1s;
}
.node-row:hover { background: var(--latam-bg); }
.node-row:first-child { border-top: 0; }
.node-name {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--latam-dark);
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}
.node-name small { display: block; font-size: 0.7rem; color: var(--latam-text-muted); font-weight: 400; }
.node-meter {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}
.node-meter small { font-size: 0.65rem; color: var(--latam-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.node-meter .bar { height: 5px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.node-meter .bar-fill { height: 100%; background: var(--status-ok); transition: width 0.3s; }
.node-meter .bar-fill.warn { background: var(--status-warn); }
.node-meter .bar-fill.fail { background: var(--status-fail); }

.location-empty {
    padding: 0.75rem 1.15rem;
    color: var(--latam-text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.timeline-update {
    border-left: 2px solid var(--latam-border);
    padding-left: 1rem;
    padding-bottom: 1rem;
    position: relative;
}
.timeline-update::before {
    content: '';
    position: absolute;
    left: -6px; top: 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--latam-text-muted);
}
.timeline-update.investigating::before { background: var(--status-fail); }
.timeline-update.identified::before { background: var(--status-warn); }
.timeline-update.monitoring::before { background: var(--status-info); }
.timeline-update.resolved::before { background: var(--status-ok); }

/* ==========================================================================
   ALERTS / CARDS base
   ========================================================================== */
.app-card {
    background: #fff;
    border: 1px solid var(--latam-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.app-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--latam-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.app-card-title { font-size: 1rem; font-weight: 600; color: var(--latam-dark); margin: 0; }
.app-card-body { padding: 1.15rem 1.25rem; }

/* ==========================================================================
   SCROLLBAR (sidebar)
   ========================================================================== */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   UTILITÁRIOS RESPONSIVOS
   ========================================================================== */
@media (max-width: 575.98px) {
    .brand-sub { display: none; }
    .app-topbar .navbar-brand { font-size: 0.95rem; }
    .kpi-value { font-size: 1.35rem; }
    .kpi-icon { width: 40px; height: 40px; font-size: 1.2rem; }
}

@media (max-width: 991.98px) {
    .app-shell-body { display: block; }
    .app-main { padding-top: 0; }
}

.text-accent { color: var(--latam-cyan) !important; }
.bg-soft { background: #f9fafb; }

/* esconde a topbar admin em mobile ao rolar (mantém padrão simples) */
