:root {
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(56, 189, 248, 0.25);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #0ea5e9;
    --accent-cyan: #06b6d4;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.35);
    --warning: #f59e0b;
    --success: #10b981;
    --purple: #8b5cf6;
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-ar);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(239, 68, 68, 0.06) 0%, transparent 40%);
}

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: border-color 0.3s ease;
}

/* Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(10, 15, 30, 0.85);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.radar-pulse {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.6);
    position: relative;
}

.radar-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-cyan);
    animation: pulseRing 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(90deg, #fff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text .sub-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-en);
    display: block;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 16px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-label {
    color: var(--text-secondary);
}

.pill-value {
    font-weight: 700;
    font-family: var(--font-en);
}

.text-accent { color: var(--accent-blue); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--danger-glow);
}

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

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

.btn-sm {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-sm:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* Dashboard Grid */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
}

/* Map Card */
.map-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title h2 {
    font-size: 1rem;
    font-weight: 700;
}

.card-title i {
    color: var(--accent-blue);
}

.badge-live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot-blink {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: blinker 1.4s infinite;
}

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

.map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #0b1120;
    z-index: 1;
}

/* Map Legend */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 18px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.alert-monitoring { background: #10b981; box-shadow: 0 0 10px #10b981; }
.alert-missile { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.alert-drone { background: #f97316; box-shadow: 0 0 10px #f97316; }

/* Sidebar */
.sidebar-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    background: rgba(14, 165, 233, 0.05);
}

.tab-content {
    flex: 1;
    display: none;
    overflow-y: auto;
    padding: 12px;
}

.tab-content.active {
    display: block;
}

/* Feed Container */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Alert Item Card */
.alert-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease-out;
}

.alert-card:hover {
    border-color: var(--danger);
    transform: translateX(-3px);
    background: rgba(239, 68, 68, 0.06);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--danger);
}

.alert-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sound-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fca5a5;
}

.time-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-en);
}

.alert-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-row i {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.confidence-bar {
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.08);
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--danger));
    border-radius: 3px;
}

/* Device Item Card */
.device-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.device-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.device-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-en);
}

.device-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Integration Guide Tab */
.integration-guide {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 6px;
}

.integration-guide h3 {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.code-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-en);
    font-size: 0.8rem;
}

.code-method {
    background: #16a34a;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.7rem;
}

.code-url {
    color: #38bdf8;
    overflow-x: auto;
}

.guide-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide-note code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    color: #facc15;
    font-family: var(--font-en);
}

.sample-json {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 10px;
    font-family: var(--font-en);
    font-size: 0.75rem;
    color: #93c5fd;
    border: 1px solid var(--border-color);
}

/* Custom Leaflet Map styling for Dark Theme */
.leaflet-container {
    background: #090e1a !important;
}

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

/* Fix Leaflet default div icon white box */
.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

/* Device Marker (الهاتف الراصد المستمع) */
.device-marker-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent !important;
    border: none !important;
}

.device-marker-core {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #090e1a;
    border: 2px solid #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    font-size: 13px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
    z-index: 3;
    transition: all 0.3s ease;
}

.device-marker-icon.alerting .device-marker-core {
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.65);
}

.device-marker-pulse {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    animation: deviceRadarPulse 2.4s infinite cubic-bezier(0.2, 0.6, 0.4, 1);
    z-index: 1;
    pointer-events: none;
}

.device-marker-icon.alerting .device-marker-pulse {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.15);
}

@keyframes deviceRadarPulse {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Alert Threat Pin (نقطة التهديد الصوتي) */
.threat-pin-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent !important;
    border: none !important;
}

.threat-pin-core {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 18px currentColor;
    z-index: 3;
    position: relative;
    transition: transform 0.2s ease;
}

.threat-pin-core:hover {
    transform: scale(1.15);
}

.threat-pin-wave {
    position: absolute;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    animation: threatWave 1.6s infinite ease-out;
    z-index: 1;
    pointer-events: none;
}

@keyframes threatWave {
    0% { transform: scale(0.4); opacity: 0.85; }
    100% { transform: scale(1.7); opacity: 0; }
}

@media (max-width: 900px) {
    .dashboard-grid {
            grid-template-columns: 1fr;
            height: auto;
        }
        .top-nav {
            flex-direction: column;
            gap: 12px;
            align-items: flex-start;
        }
    }
}

/* ========================================================
   TDOA ACOUSTIC TRIANGULATION & TRAJECTORY HUD STYLES
   ======================================================== */

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    color: #fff;
    border: 1px solid rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
    font-weight: 700;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24, #f97316);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.75);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
}

.mt-2 {
    margin-top: 10px;
}

/* Floating Tactical HUD on Top of Map */
.tactical-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    max-width: 960px;
    margin: 0 auto;
    background: rgba(11, 15, 25, 0.94);
    border: 1.5px solid rgba(239, 68, 68, 0.55);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 25px rgba(239, 68, 68, 0.25);
    backdrop-filter: blur(16px);
    border-radius: 14px;
    padding: 12px 18px;
    z-index: 500;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: hudGlow 3s infinite alternate;
}

@keyframes hudGlow {
    0% { border-color: rgba(239, 68, 68, 0.45); box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }
    100% { border-color: rgba(239, 68, 68, 0.9); box-shadow: 0 0 32px rgba(239, 68, 68, 0.4); }
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.hud-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hud-title-text {
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    letter-spacing: -0.2px;
}

.radar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    animation: blinkDot 1s infinite;
}

.hud-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.hud-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.hud-icon-btn.hud-close:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.6);
}

.hud-body {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

.hud-body.collapsed {
    display: none;
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    .hud-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.hud-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-label {
    font-size: 0.76rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-label i {
    font-size: 0.8rem;
    color: #64748b;
}

.hud-value {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-en), var(--font-ar);
    white-space: nowrap;
}

.hud-heading-val {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.hud-compass-icon {
    font-size: 1rem;
    color: #10b981;
    transition: transform 0.4s ease;
    display: inline-block;
}

.text-white {
    color: #fff;
}

/* Timeline Acoustic Delays */
.hud-delays {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    overflow-x: auto;
}

.delays-title {
    color: #94a3b8;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.delays-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    direction: ltr; /* Ensure progression flows naturally from phone 1 -> 4 */
}

.delay-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #bae6fd;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.delay-pill.earliest {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    font-weight: 700;
}

.delay-pill .tag-first {
    background: #10b981;
    color: #0b0f19;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 2px;
}

.delay-arrow {
    color: #475569;
    font-size: 0.7rem;
}

/* Map Legend Indicator for TDOA */
.alert-tdoa-target {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

/* Custom Tactical Target Marker on Leaflet */
.tdoa-reticle-marker {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reticle-ring {
    position: absolute;
    width: 46px;
    height: 46px;
    border: 2px dashed #ef4444;
    border-radius: 50%;
    animation: rotateReticle 4s linear infinite;
}

.reticle-pulse {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.35);
    animation: markerWave 1.4s infinite ease-out;
}

.reticle-core {
    width: 22px;
    height: 22px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    z-index: 5;
    box-shadow: 0 0 15px #ef4444;
}

@keyframes rotateReticle {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* TDOA Card in Sidebar Feed */
.tdoa-card {
    background: rgba(239, 68, 68, 0.08);
    border: 1.5px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: alertSlideIn 0.3s ease-out;
}

.tdoa-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tdoa-card-title {
    font-weight: 800;
    font-size: 1rem;
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tdoa-telemetry-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px;
    border-radius: 8px;
}

.tdoa-telemetry-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tdoa-telemetry-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tdoa-telemetry-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

/* ========================================================
   DEVICE CARD ACTION BUTTONS & COMMAND MESSAGING MODAL
   ======================================================== */

.device-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.device-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.device-card-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: 4px;
}

.btn-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-locate-device {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

.btn-locate-device:hover {
    background: rgba(14, 165, 233, 0.25);
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.btn-msg-device {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.btn-msg-device:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    transform: translateY(-1px);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInModal 0.25s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(14, 165, 233, 0.2);
    overflow: hidden;
    animation: slideUpModal 0.25s ease-out;
}

@keyframes slideUpModal {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border-color);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title-group h3 {
    font-size: 1.05rem;
    color: #f8fafc;
    margin: 0;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.target-device-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.7);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.target-device-pill .label {
    color: var(--text-muted);
}

.target-device-pill .val-name {
    color: #38bdf8;
}

.target-device-pill .val-id {
    background: #1e293b;
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: monospace;
}

.form-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

#msgTextInput {
    width: 100%;
    background: #161f30;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #ffffff;
    padding: 12px;
    font-size: 0.92rem;
    font-family: var(--font-ar);
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

#msgTextInput:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.25);
}

.quick-chips-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chips-title {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(10, 15, 30, 0.8);
    border-top: 1px solid var(--border-color);
}

