/* ========================================
   SENTINELA - Painel de Controle v5.0
   Dark Mode Profissional — Estilo Vercel/Linear
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-dark: #09090b;
    --bg-card: #111113;
    --bg-sidebar: #0c0c0e;
    --bg-input: #1c1c1f;
    --bg-hover: #27272a;
    --bg-elevated: #18181b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #52525b;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-glow: rgba(129, 140, 248, 0.15);
    --accent-soft: rgba(129, 140, 248, 0.08);
    --accent-solid: #4f46e5;
    --danger: #f87171;
    --danger-glow: rgba(248, 113, 113, 0.10);
    --success: #34d399;
    --success-glow: rgba(52, 211, 153, 0.10);
    --warning: #fbbf24;
    --warning-glow: rgba(251, 191, 36, 0.10);
    --border: #1e1e21;
    --border-light: #2e2e33;
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --glass: rgba(17, 17, 19, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ========== LOGIN ========== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(129, 140, 248, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        var(--bg-dark);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 44px 36px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03);
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header .logo {
    color: var(--accent);
    margin-bottom: 14px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-tertiary);
    font-size: 13px;
    margin-top: 8px;
    font-weight: 400;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(99, 102, 241, 0.06);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

/* ========== BUTTONS ========== */

.btn {
    padding: 10px 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent-solid);
    border-color: var(--accent-solid);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-danger {
    background: transparent;
    border-color: rgba(248, 113, 113, 0.2);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-glow);
    border-color: var(--danger);
}

.btn-full { width: 100%; justify-content: center; }

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-logout {
    width: 100%;
    padding: 11px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.05);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-top: 14px;
    text-align: center;
}

/* ========== SIDEBAR ========== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 22px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
}

.nav-menu {
    list-style: none;
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 22px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
}

.nav-item.active svg {
    color: var(--accent);
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid var(--border);
}

/* ========== MAIN ========== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

/* ========== DEVICE SELECTOR ========== */

.device-selector {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 340px;
}

.device-selector-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    user-select: none;
}

.device-selector-trigger:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.device-sel-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.device-sel-info {
    flex: 1;
    min-width: 0;
}

.device-sel-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-sel-meta,
.device-sel-status {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-sel-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.device-sel-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.device-sel-status-dot.offline {
    background: var(--text-tertiary);
}

.device-sel-chevron {
    color: var(--text-tertiary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.device-selector.open .device-sel-chevron {
    transform: rotate(180deg);
}

.device-selector.open .device-selector-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.device-selector-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 300px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    max-height: 320px;
    overflow-y: auto;
}

.device-selector.open .device-selector-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.device-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.device-dropdown-item:last-child {
    border-bottom: none;
}

.device-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.device-dropdown-item.active {
    background: var(--accent-soft);
}

.dd-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.device-dropdown-item.active .dd-icon {
    background: var(--accent-glow);
}

.dd-info {
    flex: 1;
    min-width: 0;
}

.dd-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dd-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.dd-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.dd-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.dd-status-dot.offline {
    background: var(--text-tertiary);
}

.device-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

.dd-remove-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 5px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.device-dropdown-item:hover .dd-remove-btn {
    opacity: 1;
}

.dd-remove-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
}

/* Device status in top-bar */
.device-status {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.offline { background: var(--text-tertiary); }

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(52, 211, 153, 0.4); }
    50% { box-shadow: 0 0 16px rgba(52, 211, 153, 0.8); }
}

/* ========== SECTIONS ========== */

.content-section {
    display: none;
    padding: 28px;
    animation: fadeIn 0.3s ease;
}

.content-section.active { display: block; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 14px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ========== OVERVIEW HERO ========== */

.overview-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background:
        linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.04) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.overview-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-device-info {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: 1;
}

.hero-device-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(129, 140, 248, 0.15);
}

.hero-device-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.hero-device-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.hero-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
}

.hero-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: background 0.3s;
}

.hero-status.online .hero-status-dot {
    background: var(--success);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.hero-status.online {
    color: var(--success);
}

.hero-status.offline .hero-status-dot {
    background: var(--text-tertiary);
}

.hero-seen {
    font-size: 12px;
    color: var(--text-tertiary);
}

.hero-right-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.hero-battery {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.battery-visual {
    display: flex;
    align-items: center;
    gap: 2px;
}

.battery-body {
    width: 42px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    padding: 2px;
    position: relative;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--success);
    transition: width 0.6s ease, background 0.4s;
    width: 0%;
}

.battery-fill.low { background: var(--danger); }
.battery-fill.medium { background: var(--warning); }

.battery-tip {
    width: 3px;
    height: 8px;
    background: var(--border-light);
    border-radius: 0 2px 2px 0;
}

.battery-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 40px;
    font-variant-numeric: tabular-nums;
}

/* ========== MONITORING TOGGLE ========== */

.monitoring-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--text-tertiary);
    border-radius: 26px;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-label.disabled-label {
    color: var(--danger);
}

/* ========== MAP ========== */

.map-full {
    height: 500px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ========== PULSATING MARKER ========== */

.pulsing-marker { position: relative; }

.pulsing-marker::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 14px; height: 14px;
    transform: translate(-50%, -50%);
    background: var(--accent);
    border: 2.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.7);
    z-index: 2;
}

.pulsing-marker::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 14px; height: 14px;
    transform: translate(-50%, -50%);
    background: rgba(129, 140, 248, 0.3);
    border-radius: 50%;
    z-index: 1;
    animation: markerPulse 2s ease-out infinite;
}

@keyframes markerPulse {
    0% { width: 14px; height: 14px; opacity: 0.6; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

/* ========== LOCATION INFO BAR ========== */

.location-info-container { margin-top: 14px; }

.location-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.info-pill svg { opacity: 0.4; }
.battery-pill { color: var(--success); }
.points-pill { color: var(--accent); }

/* ========== TABLES ========== */

.table-container { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th,
.data-table td {
    padding: 12px 18px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.6px;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table td code {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========== BADGES ========== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-incoming { background: var(--success-glow); color: var(--success); }
.badge-outgoing { background: var(--accent-soft); color: var(--accent); }
.badge-missed { background: var(--danger-glow); color: var(--danger); }

/* ========== CONTACTS ========== */

.contacts-count {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    font-weight: 500;
}

.contact-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.text-muted {
    color: var(--text-tertiary);
    opacity: 0.6;
}

/* ========== AUDIO ========== */

.audio-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
    transition: all var(--transition);
}

.audio-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.audio-card-body {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.audio-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-soft), rgba(129, 140, 248, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.audio-icon-wrap svg { color: var(--accent); }

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-info-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.audio-info-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}

.audio-info-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.audio-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.audio-btn-delete {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.15);
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    opacity: 0.6;
}

.audio-card:hover .audio-btn-delete { opacity: 1; }

.audio-btn-delete:hover {
    background: var(--danger-glow);
    border-color: rgba(248, 113, 113, 0.4);
    transform: scale(1.05);
}

.audio-btn-delete:active { transform: scale(0.95); }

.audio-player-wrap {
    padding: 0 20px 16px 20px;
}

.audio-player-wrap audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    outline: none;
    filter: invert(1) hue-rotate(180deg) brightness(0.9);
}

.audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    padding: 0 20px;
    margin-bottom: 4px;
}

.audio-waveform .bar {
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.12;
    transition: opacity 0.3s;
}

.audio-card:hover .audio-waveform .bar { opacity: 0.25; }

/* ========== SEARCH / SELECT ========== */

.search-input,
.select-input {
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder { color: var(--text-tertiary); }

.select-input {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.select-input option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========== EMPTY STATE ========== */

.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    margin-bottom: 14px;
    opacity: 0.15;
}

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

/* ========== MONITORING DISABLED MSG ========== */

.monitoring-disabled-msg {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========== TOAST ========== */

.toast-notification {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 13px 22px;
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* ========== CAMERA SECTION ========== */

.camera-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.camera-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.camera-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(129, 140, 248, 0.03);
}

.camera-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.camera-panel-title svg {
    opacity: 0.5;
    color: var(--accent);
}

.camera-panel-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.camera-panel-body {
    padding: 14px;
    min-height: 200px;
}

.camera-panel .photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

/* ========== PHOTO CARDS ========== */

.photo-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.photo-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.12);
    transform: translateY(-2px);
}

.photo-card.removing {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.3s, transform 0.3s;
}

.photo-thumb-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    cursor: pointer;
    overflow: hidden;
    background: var(--bg-dark);
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.photo-card:hover .photo-thumb {
    transform: scale(1.06);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
}

.photo-card:hover .photo-overlay {
    opacity: 1;
}

.photo-card-footer {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.photo-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.photo-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.photo-size {
    font-size: 11px;
    color: var(--text-tertiary);
}

.photo-delete-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    opacity: 0;
}

.photo-card:hover .photo-delete-btn { opacity: 1; }

.photo-delete-btn:hover {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

/* Photo Modal */
.photo-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(8px);
}

.photo-modal-overlay.show {
    opacity: 1;
}

.photo-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.photo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.photo-modal-actions {
    display: flex;
    gap: 6px;
}

.photo-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.photo-modal-btn:hover {
    background: rgba(129, 140, 248, 0.12);
    color: var(--accent);
}

.photo-modal-body {
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.photo-modal-body img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    object-fit: contain;
    border-radius: 8px;
}

/* ========== CAMERA SEGMENTED CONTROL ========== */

.camera-seg-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.cam-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.cam-seg-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.cam-seg-btn.active {
    background: var(--accent-solid);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.cam-seg-btn svg { flex-shrink: 0; }

/* ========== BOTÃO ACORDAR CÂMERA ========== */

.btn-wake {
    background: transparent;
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--success);
}

.btn-wake:hover {
    background: var(--success-glow);
    border-color: var(--success);
    box-shadow: 0 2px 12px var(--success-glow);
}

/* ========== BANNER WAKE-UP ========== */

.camera-wake-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
    color: var(--success);
    font-size: 13px;
    line-height: 1.5;
}

.camera-wake-banner svg { flex-shrink: 0; margin-top: 1px; }

.camera-wake-banner-text {
    flex: 1;
    color: var(--text-secondary);
}

.camera-wake-banner-text strong { color: var(--text-primary); }
.camera-wake-banner-text em { font-style: normal; font-weight: 600; color: var(--success); }

.camera-wake-banner-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

.camera-wake-banner-close:hover { color: var(--text-primary); }

/* ========== LEAFLET OVERRIDES ========== */

.leaflet-control-layers {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--text-primary) !important;
    padding: 8px 14px !important;
}

.leaflet-control-layers-expanded { padding: 12px 16px !important; }

.leaflet-control-layers label {
    color: var(--text-primary) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
}

.leaflet-control-layers-toggle { width: 36px !important; height: 36px !important; }

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom a:hover { background: var(--bg-input) !important; }

.leaflet-control-zoom {
    border-radius: 10px !important;
    overflow: hidden;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border);
}

.leaflet-popup-tip { background: var(--bg-card) !important; }
.leaflet-popup-close-button { color: var(--text-secondary) !important; }
.leaflet-bar { border: none !important; box-shadow: var(--shadow-sm) !important; }

/* ========== SIDEBAR OVERLAY (mobile) ========== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); z-index: 200; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .overview-hero { flex-direction: column; align-items: flex-start; padding: 22px; }
    .hero-right-controls { flex-direction: row; gap: 16px; width: 100%; justify-content: space-between; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .map-full { height: 350px; }
    .audio-card-body { flex-wrap: wrap; gap: 12px; }
    .audio-info { min-width: calc(100% - 62px); }
    .camera-panels { grid-template-columns: 1fr; }
    .device-selector { max-width: 100%; flex: 1; }
    .device-selector-dropdown { min-width: 100%; }
    .photo-modal { max-width: 95vw; max-height: 95vh; }
    .top-bar { padding: 10px 16px; }
    .content-section { padding: 18px; }
}

@media (max-width: 480px) {
    .content-section { padding: 14px; }
    .audio-info-meta { flex-wrap: wrap; gap: 8px; }
    .hero-device-text h2 { font-size: 15px; }
    .camera-panel .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .photo-thumb-wrap { height: 120px; }
    .device-sel-name { font-size: 12px; }
}

/* ========== SCROLLBAR ========== */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ========== ANIMATIONS ========== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading { animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.audio-card.removing {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.3s, transform 0.3s;
}

/* ========== SIDEBAR USER BLOCK ========== */

.sidebar-user-block {
    padding: 12px 22px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.sidebar-user-label {
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 3px;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-tertiary);
    word-break: break-all;
    line-height: 1.4;
}

/* ========== PAIRING MODAL STYLES ========== */

.pair-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); opacity: 0.3;
    animation: pairPulse 1.2s ease-in-out infinite;
}

.pair-dot:nth-child(2) { animation-delay: 0.2s; }
.pair-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pairPulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

.u-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); opacity: 0.3;
    animation: pairPulse 1.2s ease-in-out infinite;
}

.u-dot:nth-child(2) { animation-delay: 0.2s; }
.u-dot:nth-child(3) { animation-delay: 0.4s; }

/* ========== WAKE READY BANNER ========== */

.wake-ready-banner {
    display: none;
    align-items: center;
    gap: 12px;
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 14px;
    animation: fadeSlideIn .35s ease;
}

.wake-ready-banner.show { display: flex; }
.wake-ready-banner svg { color: var(--success); flex-shrink: 0; }
.wake-ready-banner-text { flex: 1; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.wake-ready-banner-text strong { color: var(--success); }
.wake-ready-banner-close { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 18px; padding: 0 4px; line-height: 1; }

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== DEVICE OFFLINE OVERLAY ========== */

.device-offline-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.04);
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
}
