/* Core Design System for Detective Zentrale */
:root {
    --bg-dark: #060913;
    --bg-panel: rgba(13, 20, 38, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f3f9;
    --text-secondary: #8a99ad;
    
    /* Neon accents */
    --accent-blue: #0072ff;
    --accent-cyan: #00f0ff;
    --accent-green: #00ff66;
    --accent-red: #ff3366;
    --accent-glow-blue: rgba(0, 114, 255, 0.35);
    --accent-glow-green: rgba(0, 255, 102, 0.25);
    --accent-glow-red: rgba(255, 51, 102, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: radial-gradient(circle at 50% 30%, #101a36 0%, var(--bg-dark) 70%);
    position: relative;
}

/* Background Stars effect */
.stars-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px);
    background-size: 550px 550px, 350px 350px;
    background-position: 0 0, 40px 60px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header Styling */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-logo {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
}

.title-meta h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 0%, #a5b9e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.font-mono {
    font-family: 'Share Tech Mono', monospace;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel Design (Glassmorphism) */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.panel-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-accent {
    color: var(--accent-cyan);
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.panel-body {
    padding: 1.5rem;
    flex-grow: 1;
    min-height: 350px;
}

/* No devices placeholder */
.no-devices {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
    min-height: 300px;
}

.scan-icon {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.no-devices p {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.no-devices span {
    font-size: 0.8rem;
    max-width: 250px;
}

/* Bug Devices List */
.device-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.device-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.device-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 240, 255, 0.05);
}

.device-card.active-listen {
    border-color: var(--accent-green);
    background: rgba(0, 255, 102, 0.02);
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.05);
}

.device-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-icon-container {
    width: 48px;
    height: 48px;
    background: rgba(0, 240, 255, 0.08);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-cyan);
    font-size: 1.25rem;
    border: 1px solid rgba(0, 240, 255, 0.15);
}

.device-card.active-listen .device-icon-container {
    background: rgba(0, 255, 102, 0.08);
    color: var(--accent-green);
    border-color: rgba(0, 255, 102, 0.15);
    animation: pulse-green 2s infinite;
}

.device-details h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.device-details p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Status Tags */
.status-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.status-tag.idle {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.status-tag.listening {
    background: rgba(0, 255, 102, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 102, 0.3);
    animation: flash 1.5s infinite;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0052cc 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.3);
}

.btn-primary:not(:disabled):hover {
    box-shadow: 0 4px 20px rgba(0, 114, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-red {
    background: linear-gradient(135deg, var(--accent-red) 0%, #cc0033 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
}

.btn-red:not(:disabled):hover {
    box-shadow: 0 4px 20px rgba(255, 51, 102, 0.5);
}

/* Player Body and Visualizer */
.player-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: space-between;
}

.live-meta {
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-item .value {
    font-size: 0.9rem;
    font-weight: 600;
}

.visualizer-container {
    background: #03060c;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.visualizer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 6, 12, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    transition: opacity 0.3s ease;
}

.visualizer-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.visualizer-icon {
    font-size: 1.75rem;
    opacity: 0.5;
}

.visualizer-overlay p {
    font-size: 0.8rem;
}

/* Audio Wave Visualizer Bars */
.audio-wave-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 80px;
}

.audio-wave-bars .bar {
    width: 6px;
    height: 8px;
    background: linear-gradient(to top, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    border-radius: 10px;
    transition: height 0.05s ease;
}

.audio-wave-bars.listening .bar {
    animation: bounce 1s ease-in-out infinite alternate;
}

/* Wave Bar Delays */
.audio-wave-bars.listening .bar:nth-child(1) { animation-delay: 0.1s; }
.audio-wave-bars.listening .bar:nth-child(2) { animation-delay: 0.3s; }
.audio-wave-bars.listening .bar:nth-child(3) { animation-delay: 0.6s; }
.audio-wave-bars.listening .bar:nth-child(4) { animation-delay: 0.2s; }
.audio-wave-bars.listening .bar:nth-child(5) { animation-delay: 0.8s; }
.audio-wave-bars.listening .bar:nth-child(6) { animation-delay: 0.5s; }
.audio-wave-bars.listening .bar:nth-child(7) { animation-delay: 0.1s; }
.audio-wave-bars.listening .bar:nth-child(8) { animation-delay: 0.4s; }
.audio-wave-bars.listening .bar:nth-child(9) { animation-delay: 0.7s; }
.audio-wave-bars.listening .bar:nth-child(10) { animation-delay: 0.3s; }
.audio-wave-bars.listening .bar:nth-child(11) { animation-delay: 0.9s; }
.audio-wave-bars.listening .bar:nth-child(12) { animation-delay: 0.2s; }
.audio-wave-bars.listening .bar:nth-child(13) { animation-delay: 0.6s; }
.audio-wave-bars.listening .bar:nth-child(14) { animation-delay: 0.4s; }
.audio-wave-bars.listening .bar:nth-child(15) { animation-delay: 0.1s; }

/* Volume Slider styling */
.player-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.01);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.vol-icon {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#volume-slider {
    flex-grow: 1;
    height: 4px;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    cursor: pointer;
}

.volume-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 35px;
    text-align: right;
}

.control-actions {
    display: flex;
    justify-content: flex-end;
}

/* System Log / Console */
.system-log {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.log-content {
    font-size: 0.75rem;
    color: #4af626; /* Matrix Green */
    height: 80px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    scroll-behavior: smooth;
}

.log-entry {
    line-height: 1.4;
    word-break: break-all;
}

/* Leaflet Custom Styling */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(13, 20, 38, 0.95) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    border-radius: 8px !important;
}

.leaflet-popup-content {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
    line-height: 1.4;
}

.leaflet-popup-content strong {
    color: var(--accent-cyan);
}

.leaflet-container {
    font-family: 'Inter', sans-serif !important;
}

/* Zoom controls dark override */
.leaflet-bar a {
    background-color: rgba(13, 20, 38, 0.8) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}

.leaflet-bar a:hover {
    background-color: rgba(0, 114, 255, 0.3) !important;
}

/* Archive Styling */
.panel-archive {
    margin-top: 2rem;
}

.archive-body {
    min-height: 200px;
    padding: 0;
}

.table-container {
    overflow-x: auto;
}

.archive-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.archive-table th, 
.archive-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.archive-table th {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.01);
}

.archive-table td {
    font-size: 0.9rem;
}

.archive-table tbody tr {
    transition: background 0.2s ease;
}

.archive-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

.empty-table {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem !important;
}

/* Keyframes Animations */
@keyframes bounce {
    0% { height: 8px; }
    100% { height: 75px; }
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 255, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0); }
}

/* Security Passcode Gateway Overlay */
.security-gateway-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 9, 19, 0.94);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.security-gateway-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.security-gateway-card {
    background: rgba(13, 20, 38, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.05);
    backdrop-filter: blur(10px);
}

.security-gateway-logo {
    font-size: 3.5rem;
    color: var(--accent-cyan);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.4));
}

.security-gateway-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #fff 0%, #a5b9e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.security-gateway-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.4;
}

.security-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#security-passcode-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

#security-passcode-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.security-error-msg {
    color: var(--accent-red);
    font-size: 0.8rem;
    font-weight: 600;
    display: none;
    margin-top: 0.5rem;
    animation: flash 1s infinite alternate;
}

/* Canvas Oscilloscope Visualizer */
.visualizer-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Dashboard Lock/Logout Button */
.btn-lock {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.75rem;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.btn-lock:hover {
    color: var(--accent-red);
    background: rgba(255, 51, 102, 0.08);
    box-shadow: 0 0 8px rgba(255, 51, 102, 0.2);
}

/* Persistent Archive Player */
.archive-player-container {
    background: rgba(3, 6, 12, 0.7);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s ease;
}

.archive-player-container.hide {
    display: none !important;
}

.archive-player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    max-width: 40%;
}

.archive-player-info i {
    color: var(--accent-cyan);
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.4));
}

#archive-playing-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-player-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
    max-width: 50%;
    justify-content: flex-end;
}

.btn-player-action {
    background: rgba(255, 255, 255, 0.02);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.btn-player-action:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.player-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

#archive-player-seekbar {
    flex-grow: 1;
    height: 4px;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    min-width: 100px;
}

#archive-player-seekbar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 5px var(--accent-cyan);
    cursor: pointer;
}

/* General Hide Utility */
.hide {
    display: none !important;
}

