:root {
    --bg-dark: #0a0b10;
    --bg-card: #15171f;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --sos-red: #ef4444;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --sidebar-width: 280px;
    --glass: rgba(21, 23, 31, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

.hidden { display: none !important; }

/* Overlay Screens */
.overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.demo-hint {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

/* Dashboard Layout */
#main-dashboard {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: relative;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.pulse {
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s 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 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sidebar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

nav ul {
    list-style: none;
}

nav li {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav li i { width: 20px; }

nav li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

nav li.active {
    background: var(--accent);
    color: white;
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 16px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.info { flex: 1; }
.info .name { display: block; font-size: 0.9rem; font-weight: 600; }
.info .role { display: block; font-size: 0.75rem; color: var(--text-dim); }

#logout-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
}

/* Content Area */
.content {
    flex: 1;
    position: relative;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to map */
}

.view-panel {
    display: none;
    height: 100%;
    padding: 2.5rem;
    overflow-y: auto;
    pointer-events: auto; /* Re-enable clicks for actual panels */
    position: relative;
    z-index: 20;
}

.view-panel.active {
    display: block;
}

#map-container {
    position: fixed;
    inset: 0;
    padding: 0;
    z-index: 1;
    pointer-events: auto;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

.map-overlay-info {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 180px;
}

.stat-card .label { display: block; color: var(--text-dim); font-size: 0.8rem; margin-bottom: 0.25rem; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; }

.stat-card.alert {
    border-color: rgba(239, 68, 68, 0.3);
}
.stat-card.alert .value { color: var(--sos-red); }

/* SOS List */
.alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.sos-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    border-left: 6px solid var(--sos-red);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    animation: slide-in 0.5s ease-out;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.sos-card header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sos-card .badge {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sos-red);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.sos-card .time { color: var(--text-dim); font-size: 0.8rem; }

.sos-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.sos-card .location { font-size: 0.9rem; color: var(--text-dim); display: flex; align-items: center; gap: 0.5rem; }

/* SDK Section */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.doc-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s;
}

.doc-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.doc-card h3 { margin-bottom: 1rem; }
.doc-card p { color: var(--text-dim); line-height: 1.6; margin-bottom: 1.5rem; }

.btn-text {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Custom Leaflet Dark Theme */
.leaflet-container {
    background: #111 !important;
}

.leaflet-tile-pane {
    filter: brightness(0.6) invert(100%) contrast(90%) hue-rotate(180deg) brightness(0.9);
}

.leaflet-control-zoom {
    border: none !important;
    margin-right: 2rem !important;
    margin-top: 15rem !important;
}

.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    background: var(--bg-card) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
}

/* SOS Flash Overlay */
#sos-flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 100px 20px rgba(239, 68, 68, 0.8);
    animation: flash-red 1s infinite alternate;
}

@keyframes flash-red {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Battery Warning */
.battery-warning {
    color: var(--sos-red) !important;
    font-weight: bold;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Glassmorphism & New Panels */
.glass-panel {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    margin: 2rem;
    height: calc(100% - 4rem);
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-card {
    background: rgba(0,0,0,0.3);
    padding: 1.5rem;
    border-radius: 16px;
}

.msg-form-card {
    background: rgba(0,0,0,0.3);
    padding: 2rem;
    border-radius: 16px;
    max-width: 600px;
    margin-top: 2rem;
}

.form-select {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    outline: none;
    margin-bottom: 1rem;
    font-size: 1rem;
}

textarea {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    outline: none;
    resize: vertical;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
}

/* Radar Log (Audit Trail) */
#radar-log {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    height: 250px;
    background: rgba(0, 20, 10, 0.7);
    border: 1px solid #10b981;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.log-header {
    background: #10b981;
    color: black;
    padding: 0.5rem;
    font-weight: bold;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

#log-list {
    list-style: none;
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
    color: #10b981;
}

#log-list li {
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(16, 185, 129, 0.2);
    padding-bottom: 0.25rem;
}

#log-list .time {
    opacity: 0.7;
    margin-right: 0.5rem;
}

/* Live Panel */
.live-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.video-feed {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #334155;
    background: black;
}

.video-feed video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.8rem;
    z-index: 2;
    animation: pulse-red 2s infinite;
}

.video-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 2;
}

.video-controls button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.radio-feed {
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.radio-status {
    color: #10b981;
    margin: 1rem 0 2rem 0;
    font-family: monospace;
}

.ptt-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #3b82f6;
    border: 4px solid #1e3a8a;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ptt-button:active, .ptt-button.active {
    transform: scale(0.95);
    background: #ef4444;
    border-color: #991b1b;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
}

.ptt-hint {
    margin-top: 1.5rem;
    color: var(--text-dim);
}

/* Çizim Kontrolleri */
#drawing-controls {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.draw-panel {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.draw-panel span {
    font-weight: 600;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.draw-panel button {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.draw-panel button:hover {
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}


