/* ==========================================================================
   Digital Ocean Monitor - Marine & Oceanographic System
   Typography: Poppins (Google Fonts)
   Theme: Flat Modern Oceanic Blue / Dark Marine
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --font-main: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;

    /* Marine Ocean Palette */
    --ocean-primary: #0284c7;
    --ocean-primary-hover: #0369a1;
    --ocean-cyan: #06b6d4;
    --ocean-teal: #14b8a6;
    --ocean-deep: #0a192f;
    --ocean-navy: #0f2847;
    --ocean-wave: #38bdf8;
    --ocean-coral: #f43f5e;
    --ocean-amber: #f59e0b;
    --ocean-emerald: #10b981;

    /* Dark Marine Theme (Default) */
    --bg-body: #061120;
    --bg-surface: #0d1e38;
    --bg-surface-alt: #132747;
    --bg-sidebar: #06101e;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(56, 189, 248, 0.08);
    --sidebar-active-bg: linear-gradient(135deg, #0284c7, #06b6d4);
    --border-color: #1e3a63;
    --border-subtle: #142a4a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
    --card-shadow-hover: 0 12px 28px -4px rgba(2, 132, 199, 0.25);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

[data-bs-theme="light"] {
    --bg-body: #f0f6fc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f4f8fc;
    --bg-sidebar: #081d38;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: #0284c7;
    --border-color: #dbe4ef;
    --border-subtle: #edf3fa;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 10px 25px rgba(2, 132, 199, 0.12);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: -0.01em;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: var(--ocean-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--ocean-primary-hover);
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.12), transparent);
}

.sidebar-brand .brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.sidebar-brand .brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-brand .brand-badge {
    font-size: 0.65rem;
    background: rgba(6, 182, 212, 0.2);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.85rem;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.85rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.18s ease;
    margin-bottom: 3px;
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    color: #38bdf8;
    transition: color 0.18s ease;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.sidebar-link.active i {
    color: #ffffff;
}

.sidebar-link .badge-counter {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: #0f2847;
    border: 2px solid #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    font-size: 0.9rem;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 270px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navbar */
.app-navbar {
    height: 70px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.navbar-zone-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.95rem;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Content Container */
.app-content {
    padding: 1.75rem;
    flex: 1;
}

/* ==========================================================================
   Marine Cards & Gauges
   ========================================================================== */
.ocean-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.ocean-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(2, 132, 199, 0.4);
}

.ocean-card-header {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ocean-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.ocean-card-body {
    padding: 1.35rem;
}

/* Metric Stat Box */
.stat-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(6, 182, 212, 0.45);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stat-card-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-icon.blue { background: rgba(2, 132, 199, 0.15); color: #38bdf8; }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.stat-icon.coral { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.stat-card-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.35rem;
}

.stat-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Status Glowing Indicator Dots */
.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.live-dot.active, .live-dot.normal {
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

.live-dot.warning {
    background-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: pulse-amber 2s infinite;
}

.live-dot.critical {
    background-color: #f43f5e;
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-amber {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* ==========================================================================
   Badges, Pills & Tables
   ========================================================================== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-status.normal, .badge-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status.critical {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.zone-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.table-ocean {
    width: 100%;
    margin-bottom: 0;
    vertical-align: middle;
    color: var(--text-primary);
}

.table-ocean thead th {
    background-color: var(--bg-surface-alt);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
}

.table-ocean tbody td {
    padding: 0.95rem 1.15rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    background-color: transparent;
}

.table-ocean tbody tr:hover {
    background-color: var(--bg-surface-alt);
}

/* ==========================================================================
   Buttons & Flat Controls
   ========================================================================== */
.btn-ocean-primary {
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    color: #ffffff;
    border: none;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.18s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-ocean-primary:hover {
    background: linear-gradient(135deg, #0369a1, #0891b2);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.btn-ocean-secondary {
    background-color: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.18s ease;
}

.btn-ocean-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* Mini Progress Bar */
.mini-progress-wrapper {
    width: 100%;
    max-width: 110px;
}

.mini-progress-bar {
    height: 6px;
    background-color: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.mini-progress-fill.blue { background-color: #0284c7; }
.mini-progress-fill.cyan { background-color: #06b6d4; }
.mini-progress-fill.green { background-color: #10b981; }
.mini-progress-fill.amber { background-color: #f59e0b; }
.mini-progress-fill.coral { background-color: #f43f5e; }

/* Interactive Map Container */
.map-viewport {
    height: 480px;
    border-radius: var(--radius-lg);
    z-index: 1;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
}

.ocean-toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    min-width: 320px;
    animation: toast-slide 0.3s ease;
}

@keyframes toast-slide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}
