/* === الأساسيات === */
body { margin: 0; padding: 0; font-family: 'Tajawal', sans-serif; background: #f3f4f6; overflow: hidden; }
#map { height: 100vh; width: 100%; z-index: 1; }
.disable-polygons .leaflet-pane.leaflet-polygonsPane-pane path { pointer-events: none !important; }
body.sim-mode-active .leaflet-interactive { cursor: crosshair !important; }

/* === زر الإغلاق الحديث === */
.leaflet-popup-content-wrapper { border-radius: 12px; padding: 0; border: none; overflow: visible !important; }
.leaflet-popup-content { margin: 0; width: 300px !important; font-family: 'Tajawal', sans-serif !important; }
.leaflet-popup-close-button {
    width: 32px !important; height: 32px !important;
    background-color: #c0392b !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important; background-position: center !important; background-size: 16px !important;
    border-radius: 50% !important; top: -12px !important; right: -12px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important; border: 3px solid #fff !important;
    opacity: 1 !important; color: transparent !important; text-indent: -9999px !important; z-index: 10000 !important;
}
.leaflet-popup-close-button span { display: none !important; }
.leaflet-popup-close-button:hover { background-color: #e74c3c !important; transform: scale(1.1); }

/* === Modern Toasts === */
#toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast-modern { 
    background: white; min-width: 300px; padding: 12px 16px; border-radius: 12px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 12px; 
    animation: slideUpFade 0.4s ease-out forwards; pointer-events: auto; position: relative; overflow: hidden;
}
.toast-modern::after { content: ''; position: absolute; bottom: 0; left: 0; height: 3px; background: currentColor; width: 100%; animation: timeProgress 6s linear forwards; }
@keyframes slideUpFade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes timeProgress { from { width: 100%; } to { width: 0%; } }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 800; font-size: 13px; color: #333; display: block; }
.toast-msg { font-size: 11px; color: #666; display: block; margin-top: 2px; }
.toast-success .toast-icon { background: #dcfce7; color: #166534; } .toast-success { border-left: 4px solid #166534; }
.toast-error .toast-icon { background: #fee2e2; color: #b91c1c; } .toast-error { border-left: 4px solid #b91c1c; }
.toast-info .toast-icon { background: #eff6ff; color: #1d4ed8; } .toast-info { border-left: 4px solid #1d4ed8; }
.toast-loading .toast-icon { background: #f3e8ff; color: #7e22ce; } .toast-loading { border-left: 4px solid #7e22ce; }
.toast-loading::after { animation: none; width: 0; }

/* === Scan Overlay === */
#scanOverlay { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index:10000; display:flex; justify-content:center; align-items:center; backdrop-filter: blur(4px); }
.scan-loader-box { background:white; padding:30px; border-radius:16px; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,0.4); width: 320px; }
.scan-spinner { border: 4px solid #f3f3f3; border-top: 4px solid #c0392b; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 15px; }
.scan-text { font-weight:bold; color:#333; margin-bottom:5px; font-size:14px; }
.scan-progress { font-size:24px; font-weight:800; color:#c0392b; margin-bottom: 15px; display:block;}
.btn-stop-scan { width: 100%; padding: 10px; background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 8px; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-stop-scan:hover { background: #fecaca; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === Popup Stats Grid === */
.pop-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pop-stat-item { background: #f8fafc; padding: 8px; border-radius: 8px; border: 1px solid #e2e8f0; text-align: center; }
.pop-stat-val { display: block; font-weight: 800; font-size: 16px; color: #333; }
.pop-stat-lbl { display: block; font-size: 10px; color: #64748b; margin-top: 2px; }

/* === القوائم المتعددة === */
.filter-group { margin-top: 15px; }
.filter-label { font-size: 11px; font-weight: bold; color: #64748b; margin-bottom: 6px; display: block; margin-top: 10px; }
.custom-select { display: none; }

.multi-select-wrapper { position: relative; width: 100%; font-family: 'Tajawal'; box-sizing: border-box; margin-bottom: 5px; }
.multi-select-trigger {
    background: #fff; border: 1px solid #e2e8f0; padding: 10px 12px; border-radius: 8px;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: #333; font-weight: bold; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); user-select: none;
}
.multi-select-trigger:hover { background: #f8fafc; border-color: #cbd5e1; }
.multi-select-trigger::after { content: '\f078'; font-family: "Font Awesome 6 Free"; font-weight: 900; color: #94a3b8; font-size: 10px; }
.multi-select-dropdown {
    position: absolute; top: 105%; left: 0; right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 9999; max-height: 0; overflow: hidden; opacity: 0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.multi-select-wrapper.open .multi-select-dropdown { max-height: 500px; opacity: 1; overflow-y: auto; padding: 5px; }
.multi-item { display: flex; align-items: center; padding: 8px; cursor: pointer; font-size: 11px; color: #475569; border-radius: 6px; }
.multi-item:hover { background: #f1f5f9; color: #2d5da1; }
.multi-item input { width: 14px; height: 14px; margin-left: 8px; accent-color: #2d5da1; cursor: pointer; }
.selected-count-badge { background: #2d5da1; color: white; padding: 2px 6px; border-radius: 10px; font-size: 10px; }

/* === الستايلات الأساسية === */
.pen-cursor { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23CE2E26' stroke='white' stroke-width='1.5'><path d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/></svg>") 0 24, auto !important; }
#sidebar { position: absolute; top: 20px; right: 20px; width: 360px; background: rgba(255, 255, 255, 0.98); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: 900; max-height: 90vh; display: flex; flex-direction: column; border: 1px solid rgba(255,255,255,0.5); backdrop-filter: blur(5px); transition: 0.3s; }
#sidebar.collapsed { transform: translateX(120%); opacity: 0; pointer-events: none; }
#btnShowSidebar { position: absolute; top: 20px; right: 20px; background: #CE2E26; color: white; width: 50px; height: 50px; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; z-index: 899; }
.sidebar-header { padding: 20px; background: #CE2E26; color: white; border-radius: 16px 16px 0 0; display: flex; justify-content: space-between; align-items: center; }
.btn-collapse-sidebar { background: rgba(255,255,255,0.2); border: none; color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.toolbar-grid { padding: 15px; display: flex; flex-direction: column; gap: 10px; background: #f9fafb; border-bottom: 1px solid #eee; }
.tool-row { display: flex; gap: 10px; }
.btn-tool { flex: 1; padding: 12px; border: none; border-radius: 10px; font-family: 'Tajawal'; font-size: 12px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.03); }
.btn-upload { background: #eef5ff; color: #2563eb; } .btn-import { background: #fff7ed; color: #ea580c; }
.btn-auto-load { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; } .btn-auto-load:hover { background: #e9d5ff; }
.btn-analyze { background: #f0fdf4; color: #166534; } .btn-save { background: #f8fafc; color: #475569; } .btn-reset { background: #fef2f2; color: #dc2626; }
#routeInfoBox { position: absolute; bottom: 30px; left: 20px; background: white; padding: 0; width: 340px; border-radius: 12px; box-shadow: 0 10px 50px rgba(0,0,0,0.4); z-index: 3000; display: none; overflow: hidden; border-right: 6px solid #2d5da1; transition: height 0.3s ease; }
#areaReportCard { position: absolute; top: 90px; left: 20px; background: rgba(255, 255, 255, 0.98); width: 340px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); z-index: 2500; display: none; overflow: hidden; border-top: 6px solid #27ae60; animation: slideRight 0.3s ease-out; }
.report-header { padding: 15px; background: #f0fdf4; border-bottom: 1px solid #dcfce7; display: flex; justify-content: space-between; align-items: center; color: #166534; font-weight: 800; }
.report-body { padding: 15px; max-height: 450px; overflow-y: auto; }
.geo-info-box { background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0; margin-bottom: 15px; }
.geo-label { font-size: 10px; color: #64748b; font-weight: bold; display: block; margin-bottom: 2px; }
.geo-value { font-size: 13px; color: #334155; font-weight: 800; display: block; line-height: 1.4; }
.report-stat-big { font-size: 32px; font-weight: 800; color: #166534; text-align: center; margin-bottom: 5px; }
.report-stat-desc { text-align: center; font-size: 12px; color: #64748b; margin-bottom: 15px; display: block; }
.btn-clear-challenges { width: 100%; background: #2d5da1; color: white; border: none; padding: 8px; border-radius: 6px; font-family: 'Tajawal'; font-size: 11px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nearest-unit-item { background: #fff; border: 1px solid #f1f5f9; padding: 12px; border-radius: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; border-right: 4px solid #f59e0b; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.nearest-unit-item.mode-est { background: #fffbeb; } .nearest-unit-item.mode-road { background: #f0fdf4; border-right-color: #22c55e; }
.nearest-unit-name { font-weight: bold; font-size: 12px; color: #333; display: flex; align-items: center; justify-content: space-between; }
.status-badge { font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: bold; display: flex; align-items: center; gap: 4px; }
.badge-est { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.badge-road { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.nearest-unit-meta { display: flex; justify-content: space-between; font-size: 11px; color: #666; align-items: center; margin-top: 4px; }
.loading-pulse { width: 8px; height: 8px; background: #ccc; border-radius: 50%; display: inline-block; animation: pulse-dot 1s infinite alternate; }
@keyframes pulse-dot { from { opacity: 0.3; } to { opacity: 1; } }
.nearest-val { font-weight: 800; color: #000; }
#analysisPanel { position: absolute; bottom: 30px; right: 420px; background: white; padding: 0; width: 320px; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); z-index: 900; display: none; overflow: hidden; transition: 0.3s; }
#analysisPanel.minimized { width: 200px; height: 50px; bottom: 20px; right: 20px; border-radius: 30px; cursor: pointer; }
#analysisPanel.minimized .analysis-content, #analysisPanel.minimized .stat-card-container { display: none; }
#analysisPanel.minimized .analysis-header { background: #2d5da1; color: white; border: none; padding: 12px 20px; }
#analysisPanel.minimized .analysis-header span { font-size: 13px; }
.analysis-header { padding: 15px; background: #fff; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: #333; }
.btn-minimize-panel { width: 24px; height: 24px; background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.stat-card-container { padding: 20px; background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%); text-align: center; }
.stat-card { background: linear-gradient(135deg, #CE2E26 0%, #b91c1c 100%); color: white; padding: 20px; border-radius: 12px; box-shadow: 0 8px 20px rgba(206, 46, 38, 0.3); position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; top: -50%; right: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%); pointer-events: none; }
.stat-number { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 5px; position: relative; z-index: 1; }
.stat-label { font-size: 12px; opacity: 0.9; font-weight: 500; position: relative; z-index: 1; }
.stat-icon-bg { position: absolute; left: 10px; bottom: 10px; font-size: 50px; opacity: 0.15; color: white; }
.analysis-content { padding: 0 20px 20px 20px; }
.view-toggles { display: flex; gap: 5px; margin-top: 15px; background: #f1f5f9; padding: 4px; border-radius: 8px; }
.view-btn { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 6px; font-family: 'Tajawal'; font-size: 11px; font-weight: bold; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); color: #64748b; display: flex; align-items: center; justify-content: center; gap: 6px; }
.view-btn.active { background: #fff; color: #0f172a; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.import-details { font-size: 10px; color: #94a3b8; text-align: center; margin-top: 10px; border-top: 1px dashed #e2e8f0; padding-top: 8px; }
#drawToolbar { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); background: white; padding: 8px; border-radius: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 2000; display: none; gap: 8px; align-items: center; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { transform: translate(-50%, -20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.draw-btn { background: #f8fafc; border: 1px solid #e2e8f0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: #475569; display: flex; align-items: center; justify-content: center; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 14px; }
.draw-btn:hover, .draw-btn.active { background: #CE2E26; color: white; border-color: #CE2E26; }
.draw-divider { width: 1px; height: 20px; background: #e2e8f0; }
#confirmModal, #scanResultModal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; display: none; justify-content: center; align-items: center; backdrop-filter: blur(3px); }
.modal-content { background: white; padding: 25px; border-radius: 16px; width: 320px; text-align: center; box-shadow: 0 15px 50px rgba(0,0,0,0.3); animation: scaleUp 0.2s ease-out; }
.modal-icon { font-size: 40px; color: #c0392b; margin-bottom: 15px; }
.modal-title { font-size: 18px; font-weight: 800; color: #333; margin-bottom: 10px; }
.modal-desc { font-size: 13px; color: #666; margin-bottom: 20px; line-height: 1.6; }
.modal-btns { display: flex; gap: 10px; justify-content: center; }
.btn-modal { flex: 1; padding: 10px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; font-family: 'Tajawal'; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-confirm { background: #c0392b; color: white; }
.btn-cancel { background: #f0f0f0; color: #333; }
.route-box-header { padding: 15px; background: #f8f9fa; border-bottom: 1px solid #eee; font-weight: 800; color: #2d5da1; display: flex; justify-content: space-between; align-items: center; }
.route-units-list { max-height: 300px; overflow-y: auto; padding: 10px 15px; }
.route-footer { padding: 10px 15px 15px; border-top: 1px solid #eee; background: #fff; }
.unit-result-item-sim { background: #fff; border: 1px solid #eee; border-radius: 8px; padding: 12px; margin-bottom: 8px; border-right: 5px solid #ccc; display: flex; flex-direction: column; gap: 8px; }
.unit-header-row { display: flex; align-items: center; gap: 8px; }
.unit-icon-display { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: #f9f9f9; border-radius: 50%; font-size: 14px; border: 1px solid #eee; }
.unit-result-title { font-size: 13px; font-weight: bold; color: #333; flex: 1; }
.btn-remove-unit { background: none; border: none; color: #999; cursor: pointer; padding: 5px; font-size: 14px; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.unit-stats-row { display: flex; justify-content: space-between; align-items: center; background: #fcfcfc; padding: 6px; border-radius: 6px; border: 1px dashed #eee; }
.stat-group { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.dist-tag { color: #555; } .time-tag { color: #c0392b; }
#layers-container { flex: 1; overflow-y: auto; padding: 15px; }
.folder-group { margin-bottom: 10px; border: 1px solid #f0f0f0; border-radius: 10px; background: #fff; overflow: hidden; }
.folder-header { padding: 12px 15px; background: #fff; display: flex; align-items: center; font-size: 13px; font-weight: 700; color: #444; cursor: pointer; }
.folder-toggle-icon { margin-left: 12px; color: #aaa; font-size: 10px; transition: transform 0.3s; }
.folder-toggle-icon.collapsed { transform: rotate(90deg); }
.folder-content { display: block; padding: 5px 0; border-top: 1px solid #f7f7f7; background: #fcfcfc; }
.folder-content.hidden { display: none; }
.layer-item { padding: 8px 15px 8px 45px; display: flex; align-items: center; font-size: 12px; color: #666; border-bottom: 1px dashed #f0f0f0; }
.custom-checkbox { width: 16px; height: 16px; margin-left: 10px; accent-color: #CE2E26; cursor: pointer; }
.zoom-btn { background: none; border: none; color: #ccc; cursor: pointer; padding: 5px; } .zoom-btn:hover { color: #CE2E26; }
.btn-google-maps { background: #4285F4; color: white; width: 100%; padding: 10px; border: none; border-radius: 6px; font-weight: bold; font-size:12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 5px; }
.btn-end-trip { background: #fee2e2; color: #b91c1c; width: 100%; padding: 10px; border: 1px solid #fecaca; border-radius: 6px; font-weight: bold; font-size: 12px; cursor: pointer; }
.btn-action-main { width: 100%; background: #2d5da1; color: white; padding: 10px; border-radius: 6px; border: none; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-action-join { display: none; width: 100%; background: #f59e0b; color: white; padding: 10px; border-radius: 6px; border: none; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; align-items: center; justify-content: center; gap: 8px; }
body.sim-mode-active .btn-action-join { display: flex !important; }
.btn-action-radius { width: 100%; background: #fff0f0; color: #c62828; padding: 10px; border-radius: 6px; border: 1px solid #ffcdd2; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-scan-challenge { width: 100%; background: #2c3e50; color: white; padding: 10px; border-radius: 6px; border: none; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition:0.2s; }
.btn-scan-challenge:hover { background: #1a252f; }
.popup-actions { margin-top: 15px; display: flex; flex-direction: column; gap: 8px; }
.integrated-marker-container { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; pointer-events: none; }
.integrated-label { background-color: white; color: white; padding: 2px 10px; border-radius: 4px; font-family: 'Tajawal'; font-weight: 800; font-size: 11px; white-space: nowrap; box-shadow: 0 4px 8px rgba(0,0,0,0.2); position: relative; pointer-events: auto; margin-bottom: -1px; z-index: 10; }
.integrated-label::after { content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); border-width: 5px 5px 0; border-style: solid; border-color: inherit; border-left-color: transparent !important; border-right-color: transparent !important; border-bottom-color: transparent !important; }
.integrated-pin { font-size: 32px; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.3)); line-height: 1; pointer-events: auto; margin-top: -2px; z-index: 5; }
.modern-popup-header { color: white; padding: 15px 20px; display: flex; align-items: center; gap: 10px; border-radius: 12px 12px 0 0; }
.modern-popup-title { font-weight: 800; font-size: 15px; }
.modern-popup-body { padding: 15px 20px; background: #fff; border-radius: 0 0 12px 12px; }
.custom-div-icon { background: white; border: 2px solid #fff; border-radius: 50%; text-align: center; line-height: 26px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.icon-hospital { color: #2d5da1; border-color: #2d5da1; font-size: 14px; }
.icon-ems { color: #c62828; border-color: #c62828; font-size: 13px; }
.icon-standby { color: #e65100; border-color: #e65100; font-size: 13px; }
#radiusStatusBar { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, 0.95); padding: 8px 20px; border-radius: 50px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); z-index: 2000; display: none; align-items: center; gap: 15px; border: 1px solid #eee; backdrop-filter: blur(5px); }
.radius-status-text { font-size: 13px; font-weight: 700; color: #333; display: flex; align-items: center; gap: 8px; }
.radius-status-text i { color: #CE2E26; }
.btn-cancel-radius { background: #fee2e2; color: #b91c1c; border: none; padding: 6px 15px; border-radius: 20px; font-family: 'Tajawal'; font-size: 12px; font-weight: bold; cursor: pointer; }
.radius-controls-panel { display: none; margin-top: 10px; padding: 10px; background: #fafafa; border-radius: 8px; border: 1px dashed #ddd; }
input[type=range] { width: 100%; accent-color: #CE2E26; cursor: pointer; height: 4px; margin-top: 5px; }
.coverage-circle { animation: pulse-ring 2s infinite; border: 2px solid rgba(206, 46, 38, 0.8) !important; pointer-events: none; }
@keyframes pulse-ring { 0% { stroke-width: 2px; fill-opacity: 0.1; } 50% { stroke-width: 4px; fill-opacity: 0.25; } 100% { stroke-width: 2px; fill-opacity: 0.1; } }
.crosshair-cursor { cursor: crosshair !important; }
.edit-handle { width: 12px; height: 12px; background: white; border: 2px solid #333; border-radius: 50%; cursor: pointer; box-shadow: 0 0 5px rgba(0,0,0,0.5); }
.btn-minimize { background: none; border: none; color: #fff; cursor: pointer; font-size: 14px; margin-left: 10px; opacity: 0.7; }
.btn-minimize:hover { opacity: 1; }
.content-collapsed { display: none !important; }
.handle-center { width: 24px; height: 24px; background: white; border: 2px solid #166534; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.3); color: #166534; font-size: 12px; cursor: move; }
.handle-resize { width: 20px; height: 20px; background: white; border: 2px solid #CE2E26; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.3); color: #CE2E26; font-size: 10px; cursor: nwse-resize; }
.btn-search-units { width: 100%; background: #3b82f6; color: white; border: none; padding: 12px; border-radius: 8px; font-family: 'Tajawal'; font-weight: bold; cursor: pointer; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-search-units:hover { background: #2563eb; }
input[type="file"] { display: none; }
/* --- New Radar Styles (Added by Update V1) --- */
.radar-blip { position: relative; width: 30px; height: 30px; display: flex; justify-content: center; align-items: center; }
.radar-core { width: 10px; height: 10px; background: var(--radar-color, #e74c3c); border-radius: 50%; z-index: 2; box-shadow: 0 0 15px var(--radar-color, #e74c3c); }
.radar-ring { position: absolute; width: 100%; height: 100%; border: 2px solid var(--radar-color, #e74c3c); border-radius: 50%; opacity: 0; animation: radarPulse 1.5s infinite ease-out; z-index: 1; box-sizing: border-box; }
@keyframes radarPulse { 0% { transform: scale(0.1); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

/* --- V3: Dynamic RGB Radar --- */
@keyframes radarColorCycle {
    0% { border-color: #e74c3c; box-shadow: 0 0 10px #e74c3c; }
    25% { border-color: #f39c12; box-shadow: 0 0 10px #f39c12; }
    50% { border-color: #f1c40f; box-shadow: 0 0 10px #f1c40f; }
    75% { border-color: #8e44ad; box-shadow: 0 0 10px #8e44ad; }
    100% { border-color: #e74c3c; box-shadow: 0 0 10px #e74c3c; }
}

@keyframes coreColorCycle {
    0% { background: #e74c3c; }
    25% { background: #f39c12; }
    50% { background: #f1c40f; }
    75% { background: #8e44ad; }
    100% { background: #e74c3c; }
}

.radar-blip .radar-ring {
    animation: radarPulse 1.5s infinite ease-out, radarColorCycle 3s infinite linear !important;
    border-width: 3px !important;
}

.radar-blip .radar-core {
    animation: coreColorCycle 3s infinite linear !important;
}

/* --- V4: Live Navigation Dashboard --- */
#navDashboard {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
    z-index: 6000; /* أعلى من كل شيء */
    display: none;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    border: 1px solid rgba(0,0,0,0.05);
    animation: slideUpNav 0.4s ease-out;
}
@keyframes slideUpNav { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }

.nav-header {
    background: linear-gradient(90deg, #2d5da1, #3B4A82);
    color: white;
    padding: 12px 20px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}
.nav-status-pulse {
    width: 10px; height: 10px; background: #2ecc71; border-radius: 50%;
    box-shadow: 0 0 10px #2ecc71; animation: blinkNav 1s infinite;
}
@keyframes blinkNav { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

.nav-body {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}
.nav-stat-box { text-align: center; flex: 1; position: relative; }
.nav-stat-box:not(:last-child)::after {
    content: ''; position: absolute; left: 0; top: 10%; height: 80%; width: 1px; background: #eee;
}
.nav-val { font-size: 22px; font-weight: 800; color: #333; display: block; line-height: 1.2; }
.nav-lbl { font-size: 11px; color: #888; font-weight: bold; }

.nav-progress-container { height: 6px; background: #f0f0f0; width: 100%; }
.nav-progress-bar { height: 100%; background: #27ae60; width: 0%; transition: width 0.1s linear; }

.nav-footer {
    padding: 10px; background: #f9f9f9; border-top: 1px solid #eee;
    text-align: center; font-size: 11px; color: #666;
    display: flex; justify-content: center; gap: 15px;
}
.btn-stop-nav {
    background: #fee2e2; color: #c0392b; border: 1px solid #fecaca;
    padding: 5px 15px; border-radius: 20px; cursor: pointer; font-weight: bold;
}
.btn-stop-nav:hover { background: #fecaca; }

/* --- V5: Matching RouteInfoBox Design --- */
#navDashboard {
    position: absolute; /* تغيير من fixed ليتناسق مع العناصر الأخرى */
    bottom: 30px;
    left: 20px; /* محاذاة لليسار مثل routeInfoBox */
    width: 340px; /* نفس العرض */
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
    z-index: 6000;
    display: none;
    overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    border-right: 6px solid #2d5da1; /* الشريط الأزرق المميز */
    transform: none; /* إلغاء التوسيط القديم */
    animation: slideRight 0.3s ease-out;
}
@keyframes slideRight { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }

/* تعديل الهيدر ليطابق ستايل المشروع (route-box-header) */
.nav-header {
    background: #f8f9fa !important; /* رمادي فاتح جداً */
    border-bottom: 1px solid #eee;
    color: #2d5da1 !important; /* لون النص أزرق */
    padding: 15px !important;
    font-size: 14px;
    font-weight: 800;
}

/* تحسين شكل الأرقام */
.nav-body { padding: 15px 10px; }
.nav-val { font-size: 24px; color: #2d5da1; }
.nav-lbl { font-size: 10px; color: #7f8c8d; }

/* شريط التقدم */
.nav-progress-container { height: 4px; background: #eee; margin: 0 15px 15px 15px; border-radius: 2px; overflow: hidden; }
.nav-progress-bar { background: #2d5da1; }

/* الفوتر */
.nav-footer { background: white; border-top: none; padding-bottom: 15px; }
.btn-stop-nav {
    background: #fff; color: #c0392b; border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-stop-nav:hover { background: #c0392b; color: white; border-color: #c0392b; }

/* === START UPDATE V1 (Ambulance & Scan Fixes) === */
/* إلغاء الضبابية والخلفية المعتمة أثناء الفحص */
#scanOverlay {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: none !important;
    pointer-events: none; /* يسمح برؤية الخريطة بوضوح */
}
.scan-card-modern {
    pointer-events: auto; /* إعادة التفاعل للبطاقة فقط */
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid #e2e8f0;
}

/* تنسيقات نافذة المحاكاة الجديدة */
.nav-header {
    background: #c0392b !important; /* أحمر للإسعاف */
    color: white !important;
}
.nav-unit-badge {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    margin-right: 8px;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}
.nav-original-stats {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: normal;
}
.btn-stop-nav {
    color: #c0392b !important;
    border-color: #eee !important;
}
.btn-stop-nav:hover {
    background: #c0392b !important;
    color: white !important;
}
/* === END UPDATE V1 === */
/* === تم التحديث بواسطة V1 Force Update === */
body { margin: 0; padding: 0; font-family: 'Tajawal', sans-serif; background: #f3f4f6; overflow: hidden; }
#map { height: 100vh; width: 100%; z-index: 1; }

/* إصلاح مشكلة الضبابية في الفحص */
#scanOverlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.05) !important; /* شفافية عالية */
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: none !important; /* إلغاء التغبيش */
    pointer-events: none; /* السماح بالنقر على الخريطة */
}
.scan-card-modern {
    pointer-events: auto; /* تفعيل النقر على البطاقة فقط */
    background: rgba(255, 255, 255, 0.98);
    padding: 30px 50px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    min-width: 320px;
    border: 1px solid #e2e8f0;
}

/* تنسيقات نافذة المحاكاة (الإسعاف الأحمر) */
#navDashboard {
    position: absolute; bottom: 30px; left: 20px; width: 340px;
    background: white; border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.4);
    z-index: 6000; display: none; overflow: hidden;
    font-family: 'Tajawal', sans-serif;
    border-right: 6px solid #c0392b; /* أحمر */
    animation: slideRight 0.3s ease-out;
}
.nav-header {
    background: #c0392b !important; color: white !important;
    padding: 15px; font-size: 14px; font-weight: 800;
    display: flex; justify-content: space-between; align-items: center;
}
.nav-unit-badge {
    background: rgba(255,255,255,0.2); padding: 2px 8px;
    border-radius: 6px; font-size: 11px; margin-right: 8px;
    color: #fff; border: 1px solid rgba(255,255,255,0.3);
}
.nav-body { padding: 15px 10px; display: flex; justify-content: space-between; }
.nav-stat-box { text-align: center; flex: 1; position: relative; }
.nav-val { font-size: 24px; color: #c0392b; font-weight: 800; display: block; }
.nav-lbl { font-size: 10px; color: #7f8c8d; font-weight: bold; }
.nav-original-stats {
    display: block; font-size: 10px; color: #94a3b8;
    margin-top: 4px; font-weight: normal;
}
.nav-progress-container { height: 4px; background: #eee; margin: 0 15px 15px 15px; border-radius: 2px; overflow: hidden; }
.nav-progress-bar { background: #c0392b; height: 100%; width: 0%; transition: width 0.1s linear; }
.nav-footer { background: white; padding-bottom: 15px; text-align: center; }
.btn-stop-nav {
    background: #fff; color: #c0392b; border: 1px solid #eee;
    padding: 8px 20px; border-radius: 20px; cursor: pointer; font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-stop-nav:hover { background: #c0392b; color: white; border-color: #c0392b; }

/* بقية التنسيقات الأساسية */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.toast-modern { z-index: 100001; }
.radar-spinner {
    width: 60px; height: 60px; border: 4px solid #f3f3f3;
    border-top: 4px solid #c0392b; border-radius: 50%;
    margin: 0 auto 20px auto; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
/* --- Update V1: Hide Button Style --- */


/* --- V2 Smart Toggle Button Design --- */




/* النقطة المضيئة */
.toggle-dot {
    width: 8px;
    height: 8px;
    background-color: #16a34a; /* أخضر */
    border-radius: 50%;
    box-shadow: 0 0 8px #16a34a;
    transition: all 0.3s ease;
}

.toggle-text {
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #166534;
    transition: color 0.3s;
}

/* --- حالة الإخفاء (Inactive) --- */








/* تأثير النقر */







/* --- V4 Modern Toggle Button --- */
.modern-toggle-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.modern-toggle-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* تصميم الزر نفسه (Switch) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; /* لون رمادي عند الإخفاء */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* حالة التفعيل (الوحدة ظاهرة) */
input:checked + .slider {
    background-color: #10b981; /* أخضر جميل */
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* حالة الإخفاء (تغيير مظهر الحاوية) */
.modern-toggle-container.is-hidden {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.modern-toggle-container.is-hidden .modern-toggle-label {
    color: #ef4444;
}
/* --- V6 Sector Hide Button --- */
.btn-hide-sector {
    width: 100%;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #4b5563;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-hide-sector:hover {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #9ca3af;
}
.btn-hide-sector i {
    color: #6b7280;
}
/* --- V7 Floating Clear Dock --- */
.floating-clear-dock {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(150px); /* مخفي للأسفل */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 15px 10px 25px;
    border-radius: 50px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10000;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* تأثير ارتدادي */
    border: 1px solid rgba(255,255,255,0.8);
    min-width: 280px;
    justify-content: space-between;
}

.floating-clear-dock.visible {
    transform: translateX(-50%) translateY(0);
}

.dock-info {
    display: flex;
    flex-direction: column;
}

.dock-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #881337;
}

.dock-subtitle {
    font-family: 'Tajawal', sans-serif;
    font-size: 11px;
    color: #9f1239;
    opacity: 0.8;
}

.btn-dock-clear {
    background: #ffe4e6;
    color: #e11d48;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.1);
}

.btn-dock-clear:hover {
    background: #e11d48;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(225, 29, 72, 0.3);
}

.btn-dock-clear:active {
    transform: scale(0.95);
}
/* --- V8 Virtual Unit Button --- */
.btn-add-virtual {
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.2);
}
.btn-add-virtual:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(139, 92, 246, 0.3);
}
.virtual-unit-badge {
    background: #8b5cf6;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-bottom: 5px;
    display: inline-block;
}

/* === Capsule Accordion & Chip Grid Styles (New Update) === */
.capsule-container {
    margin: 10px 0;
    width: 100%;
    position: relative;
    z-index: 100;
}

/* نمط الكبسولة العائمة (Trigger) */
.search-capsule {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50px; /* شكل الكبسولة */
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* ظل خفيف للإيحاء بالطفو */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    color: #334155;
    font-weight: bold;
}

.search-capsule:hover {
    border-color: #3B4A82;
    box-shadow: 0 6px 15px rgba(59, 74, 130, 0.15);
    transform: translateY(-1px);
}

.search-capsule.active-state {
    border-color: #3B4A82;
    background: #f8fafc;
}

.capsule-label-text {
    flex: 1;
    margin: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.capsule-badge {
    background: #3B4A82;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* جسم الأكورديون (المحتوى المخفي) */
.capsule-accordion-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    border-radius: 16px;
    margin-top: 0;
    border: 1px solid transparent;
}

/* حالة التمدد (Expanded) */
.capsule-container.expanded .capsule-accordion-body {
    max-height: 400px; /* ارتفاع كافٍ للمحتوى */
    opacity: 1;
    transform: translateY(0);
    padding: 15px;
    margin-top: 8px;
    border-color: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    overflow-y: auto;
}

.capsule-container.expanded .search-capsule {
    border-color: #3B4A82;
    background: #f0f4f8;
}

/* شبكة الرقائق (Chip Grid) */
.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* عنصر الرقيقة (Chip/Tag) */
.chip-item {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.chip-item:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.chip-item.selected {
    background: #3B4A82;
    color: white;
    border-color: #3B4A82;
    box-shadow: 0 3px 8px rgba(59, 74, 130, 0.3);
}

.chip-item.chip-all {
    font-weight: 800;
}

/* === Creative Capsule UI (V2 Update) === */

/* حاوية الكبسولة: عائمة مع ترتيب طبقات */
.capsule-container {
    margin: 12px 0;
    width: 100%;
    position: relative;
    z-index: 200;
    font-family: 'Tajawal', sans-serif;
}

/* 1. تصميم الكبسولة (الزر الرئيسي) */
.search-capsule {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px; /* زوايا ناعمة حديثة */
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05), 
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); /* تأثير نابض */
}

.search-capsule:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 25px -5px rgba(59, 74, 130, 0.15);
    border-color: rgba(59, 74, 130, 0.3);
}

.search-capsule.active-state {
    background: #fff;
    border-color: #3B4A82;
    box-shadow: 0 0 0 3px rgba(59, 74, 130, 0.1);
}

.capsule-icon-box {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3B4A82;
    margin-left: 12px;
    font-size: 14px;
    transition: 0.3s;
}

.search-capsule:hover .capsule-icon-box {
    background: #3B4A82;
    color: white;
    transform: rotate(-10deg);
}

.capsule-label-text {
    flex: 1;
    font-weight: 700;
    color: #1e293b;
    font-size: 13px;
    letter-spacing: -0.01em;
}

/* 2. الأكورديون (القائمة المنسدلة) */
.capsule-accordion-body {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px); /* زجاج قوي */
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    margin-top: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.capsule-container.expanded .capsule-accordion-body {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0) scale(1);
    margin-top: 10px;
    padding: 15px;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
    overflow-y: auto;
}

/* 3. الرقائق (Chips) */
.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 5px; /* لمساحة السكرول */
}

/* سكرول بار مخصص ونحيف */
.capsule-accordion-body::-webkit-scrollbar { width: 4px; }
.capsule-accordion-body::-webkit-scrollbar-track { background: transparent; }
.capsule-accordion-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.chip-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
    user-select: none;
}

/* تأثير اللمعان عند التحويم */
.chip-item::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
    transform: translateX(-100%);
    transition: 0.4s;
}
.chip-item:hover::after { transform: translateX(100%); }

.chip-item:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    color: #334155;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.chip-item:active { transform: scale(0.95); }

/* الحالة النشطة (Selected) */
.chip-item.selected {
    background: linear-gradient(135deg, #3B4A82 0%, #2d5da1 100%); /* تدرج أزرق */
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 74, 130, 0.3); /* توهج أزرق */
}

.chip-item.chip-all.selected {
    background: linear-gradient(135deg, #CE2E26 0%, #b91c1c 100%); /* تدرج أحمر للكل */
    box-shadow: 0 4px 12px rgba(206, 46, 38, 0.3); /* توهج أحمر */
}

.chip-check-icon {
    display: inline-block;
    width: 0;
    overflow: hidden;
    transition: 0.2s;
    margin-left: 0;
}
.chip-item.selected .chip-check-icon {
    width: 14px;
    margin-left: 4px;
}

.capsule-badge-count {
    background: #CE2E26;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(206, 46, 38, 0.4);
    margin-right: auto;
}

/* --- Modern Toast Notification (V69.9) --- */
.toast-notification {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    top: 30px;
    transform: translateX(-50%);
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.5s, top 0.5s;
    backdrop-filter: blur(5px);
    background: rgba(40, 44, 52, 0.9);
    border: 1px solid rgba(255,255,255,0.1);
}

.toast-notification.show {
    visibility: visible;
    opacity: 1;
    top: 50px;
}

.toast-success { border-left: 5px solid #28a745; }
.toast-error { border-left: 5px solid #dc3545; }

/* زر حذف النقطة */
.btn-remove-point {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    width: 100%;
    transition: 0.3s;
}
.btn-remove-point:hover {
    background-color: #c82333;
}


/* --- V2 Hotfix: Modern Popup & Button --- */
.popup-success-card {
    text-align: center;
    padding: 5px;
}
.popup-success-icon {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin: 0 auto 10px auto;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.popup-success-text {
    font-size: 13px; color: #374151; margin-bottom: 15px; line-height: 1.6; font-weight: 500;
}
.btn-delete-modern {
    background: rgba(254, 226, 226, 0.6); /* أحمر فاتح شفاف */
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 10px 15px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 800;
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 12px;
}
.btn-delete-modern:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}
.btn-delete-modern:active {
    transform: scale(0.95);
}


/* --- V3 Creative UI Styles --- */
.creative-popup-card {
    font-family: 'Tajawal', sans-serif;
    text-align: center;
    overflow: hidden;
}
.creative-popup-header {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    color: white;
    position: relative;
}
.creative-popup-icon {
    font-size: 30px;
    margin-bottom: 5px;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes bounceIn { 0% { transform: scale(0); } 80% { transform: scale(1.2); } 100% { transform: scale(1); } }

.creative-popup-body {
    padding: 20px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}
.creative-popup-title {
    font-weight: 800;
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 5px;
}
.creative-popup-desc {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* زر الحذف الإبداعي */
.btn-creative-delete {
    background: white;
    color: #ef4444;
    border: 2px solid #fee2e2;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.btn-creative-delete::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 0%; height: 100%;
    background: #ef4444;
    transition: 0.3s;
    z-index: 0;
}

.btn-creative-delete:hover {
    border-color: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.2);
}

.btn-creative-delete:hover::before {
    width: 100%;
}

.btn-creative-delete span, .btn-creative-delete i {
    position: relative;
    z-index: 1;
}

/* --- MCI System V70 Styles --- */
.mci-float-btn {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
    background: white; color: #c0392b; border: 2px solid #c0392b;
    padding: 10px 30px; border-radius: 50px; font-family: 'Tajawal', sans-serif;
    font-weight: bold; cursor: pointer; z-index: 99999;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); transition: 0.3s;
    display: flex; align-items: center; gap: 8px;
}
.mci-float-btn:hover { background: #c0392b; color: white; transform: translateX(-50%) scale(1.1); }
.mci-float-btn.active { background: #c0392b; color: white; animation: mciPulse 1.5s infinite; }

@keyframes mciPulse { 0% {box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7);} 70% {box-shadow: 0 0 0 10px rgba(192, 57, 43, 0);} 100% {box-shadow: 0 0 0 0 rgba(192, 57, 43, 0);} }

.mci-pulse-icon {
    width: 50px; height: 50px; background: rgba(192, 57, 43, 0.2);
    border: 2px solid #c0392b; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: #c0392b;
    font-size: 24px; animation: mciSpin 5s linear infinite;
    box-shadow: 0 0 20px #c0392b; background: radial-gradient(circle, #c0392b 20%, transparent 70%);
}
@keyframes mciSpin { 100% { transform: rotate(360deg); } }

.mci-popup { text-align: center; font-family: 'Tajawal'; width: 200px; }
.mci-head { font-weight: bold; margin-bottom: 8px; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.btn-lvl { width: 100%; margin: 4px 0; padding: 8px; border: none; border-radius: 4px; color: white; cursor: pointer; font-size: 12px; font-weight: bold; text-align: right; }
.l1 { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.l2 { background: linear-gradient(90deg, #e67e22, #d35400); }
.l3 { background: linear-gradient(90deg, #f1c40f, #f39c12); color: #333; }

#mciPanel {
    position: absolute; top: 80px; left: 20px; width: 320px;
    background: white; border-radius: 8px; overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 99999;
    display: none; font-family: 'Tajawal'; border: 1px solid #ddd;
}
.mci-panel-head { padding: 12px; color: white; font-weight: bold; display: flex; justify-content: space-between; }
.mci-close { cursor: pointer; }
.mci-panel-info { padding: 10px; background: #f9f9f9; font-size: 13px; text-align: center; border-bottom: 1px solid #eee; }
.mci-units-list { max-height: 250px; overflow-y: auto; padding: 0; }
.mci-unit-row { padding: 8px 15px; border-bottom: 1px solid #eee; font-size: 13px; display: flex; justify-content: space-between; }
.mci-panel-action { padding: 10px; background: #f0f0f0; }
.mci-panel-action button { width: 100%; padding: 10px; border: none; border-radius: 4px; color: white; font-weight: bold; cursor: pointer; }
/* --- MCI V71: Embedded Button Styles --- */
/* الزر الجديد داخل التبويب */
.mci-tab-btn {
    width: 95%; /* يملأ العرض */
    margin: 10px auto;
    display: block;
    background: #fff;
    color: #c0392b;
    border: 2px dashed #c0392b; /* حدود متقطعة لتمييزه */
    padding: 12px;
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}
.mci-tab-btn:hover {
    background: #c0392b;
    color: white;
    transform: scale(1.02);
}
.mci-tab-btn.active {
    background: #c0392b;
    color: white;
    border-style: solid;
    animation: pulseBorder 2s infinite;
}
.mci-tab-btn i { margin-left: 8px; }

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

/* باقي التنسيقات كما هي */
.mci-pulse-icon { width: 50px; height: 50px; background: rgba(192,57,43,0.2); border: 2px solid #c0392b; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #c0392b; font-size: 24px; animation: mciSpin 5s linear infinite; box-shadow: 0 0 20px #c0392b; background: radial-gradient(circle, #c0392b 20%, transparent 70%); }
@keyframes mciSpin { 100% { transform: rotate(360deg); } }
.mci-popup { text-align: center; font-family: 'Tajawal'; width: 200px; }
.mci-head { font-weight: bold; margin-bottom: 8px; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.btn-lvl { width: 100%; margin: 4px 0; padding: 8px; border: none; border-radius: 4px; color: white; cursor: pointer; font-size: 12px; font-weight: bold; text-align: right; }
.l1 { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.l2 { background: linear-gradient(90deg, #e67e22, #d35400); }
.l3 { background: linear-gradient(90deg, #f1c40f, #f39c12); color: #333; }
#mciPanel { position: absolute; top: 80px; left: 20px; width: 320px; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 99999; display: none; font-family: 'Tajawal'; border: 1px solid #ddd; }
.mci-panel-head { padding: 12px; color: white; font-weight: bold; display: flex; justify-content: space-between; }
.mci-close { cursor: pointer; }
.mci-panel-info { padding: 10px; background: #f9f9f9; font-size: 13px; text-align: center; border-bottom: 1px solid #eee; }
.mci-units-list { max-height: 250px; overflow-y: auto; padding: 0; }
.mci-unit-row { padding: 8px 15px; border-bottom: 1px solid #eee; font-size: 13px; display: flex; justify-content: space-between; }
.mci-panel-action { padding: 10px; background: #f0f0f0; }
.mci-panel-action button { width: 100%; padding: 10px; border: none; border-radius: 4px; color: white; font-weight: bold; cursor: pointer; }
/* --- MCI V76 Creative Styles --- */

/* 1. The Red Alert Card */
.mci-commander-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 5px solid #ff004c;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}
.mci-commander-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 0, 76, 0.15);
}
.mci-commander-card.active-mode {
    background: #ff004c;
    border-left-color: #fff;
}
.mci-commander-card.active-mode .mci-card-title, 
.mci-commander-card.active-mode .mci-card-subtitle,
.mci-commander-card.active-mode .mci-card-icon {
    color: white;
}
.mci-commander-card.active-mode button {
    background: white;
    color: #ff004c;
}

.mci-card-icon {
    font-size: 24px;
    color: #ff004c;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 0, 76, 0.1);
    border-radius: 50%;
}
.mci-card-content { flex: 1; }
.mci-card-title { font-family: 'Tajawal'; font-weight: 800; font-size: 14px; color: #2d3436; }
.mci-card-subtitle { font-size: 10px; color: #636e72; text-transform: uppercase; letter-spacing: 0.5px; }
.mci-card-action button {
    background: #ff004c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Tajawal';
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
}
.mci-status-dot {
    position: absolute; top: 10px; right: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #ccc;
}
.mci-commander-card.active-mode .mci-status-dot {
    background: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}

/* 2. Tactical Cursor */
.tactical-cursor .leaflet-container {
    cursor: crosshair !important;
}

/* 3. Ground Zero Marker */
.mci-ground-zero { pointer-events: none; }
.gz-core {
    width: 10px; height: 10px; background: #ff004c;
    border-radius: 50%; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #ff004c;
}
.gz-ring {
    width: 60px; height: 60px; border: 2px solid #ff004c;
    border-radius: 50%; position: absolute;
    top: 0; left: 0;
    animation: gzPulse 2s infinite;
    opacity: 0;
}
@keyframes gzPulse {
    0% { transform: scale(0.1); opacity: 1; border-width: 5px; }
    100% { transform: scale(1); opacity: 0; border-width: 0px; }
}

/* 4. Commander Panel (Floating) */
#mciCommanderPanel {
    position: absolute; bottom: 30px; left: 50%;
    transform: translateX(-50%);
    width: 350px;
    background: rgba(20, 20, 20, 0.95); /* Dark Glass */
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 99999;
    color: white;
    font-family: 'Tajawal';
    border: 1px solid rgba(255,255,255,0.1);
    display: none;
    overflow: hidden;
}
.slide-up { animation: slideUpPanel 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes slideUpPanel { from { transform: translate(-50%, 100%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.cmd-header {
    padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: bold; display: flex; justify-content: space-between; align-items: center;
    background: rgba(255, 0, 76, 0.1);
    color: #ff004c;
}
.cmd-close { background: none; border: none; color: #666; cursor: pointer; font-size: 16px; }
.cmd-close:hover { color: white; }

.cmd-body { padding: 20px; }

.cmd-control-group { margin-bottom: 20px; }
.cmd-control-group label { display: block; font-size: 11px; color: #888; margin-bottom: 8px; text-transform: uppercase; }

.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-wrap input { flex: 1; accent-color: #ff004c; }
.range-wrap span { font-weight: bold; color: #ff004c; min-width: 40px; }

.level-selector { display: flex; gap: 10px; }
.lvl-btn {
    flex: 1; text-align: center; padding: 10px;
    background: rgba(255,255,255,0.05); border-radius: 8px;
    cursor: pointer; font-weight: bold; font-size: 13px;
    transition: 0.2s; border: 1px solid transparent;
}
.lvl-btn:hover { background: rgba(255,255,255,0.1); }
.lvl-btn:active, .lvl-btn.selected { border-color: #ff004c; color: #ff004c; }
.l1:hover { color: #f1c40f; border-color: #f1c40f; }
.l2:hover { color: #e67e22; border-color: #e67e22; }
.l3:hover { color: #ff004c; border-color: #ff004c; }

.cmd-stats {
    background: rgba(0,0,0,0.3); padding: 10px; border-radius: 8px;
    margin-bottom: 15px; font-size: 12px;
}
.stat-row { display: flex; justify-content: space-between; margin-bottom: 4px; }

.cmd-action-btn {
    width: 100%; padding: 12px; border: none; border-radius: 8px;
    background: linear-gradient(90deg, #ff004c, #ff4b2b);
    color: white; font-weight: bold; font-family: 'Tajawal';
    cursor: pointer; font-size: 14px;
    box-shadow: 0 5px 15px rgba(255, 0, 76, 0.4);
    transition: 0.3s;
}
.cmd-action-btn:hover { transform: scale(1.02); box-shadow: 0 8px 20px rgba(255, 0, 76, 0.6); }

/* Animation for Dashed Lines */
.anim-dash { animation: dashMove 1s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -20; } }

/* --- V77 Commander Pro Styles --- */

/* Mission Log List */
.cmd-mission-log {
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
    max-height: 400px;
    display: flex; flex-direction: column;
}
.mission-header {
    padding: 12px 20px;
    font-size: 13px; font-weight: bold; color: #fff;
    background: rgba(255, 0, 76, 0.15);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mission-list-scroll {
    overflow-y: auto;
    max-height: 300px;
    padding: 10px;
}
.mission-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 10px; margin-bottom: 5px;
    border-radius: 6px;
    border-left: 3px solid #ff004c;
    transition: 0.2s;
}
.mission-row:hover { background: rgba(255,255,255,0.1); }

.m-icon {
    width: 24px; height: 24px; background: #ff004c; color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}
.m-info { flex: 1; }
.m-name { font-size: 12px; font-weight: bold; color: #fff; }
.m-status { font-size: 10px; color: #aaa; margin-top: 2px; }
.m-meta { font-size: 11px; font-weight: bold; color: #ff004c; }

.cmd-close-mission {
    width: 100%; padding: 12px; background: #333; color: #aaa;
    border: none; border-top: 1px solid rgba(255,255,255,0.1);
    cursor: pointer; font-family: 'Tajawal'; font-size: 12px;
}
.cmd-close-mission:hover { background: #444; color: white; }

/* تحديث عرض اللوحة */
#mciCommanderPanel {
    width: 380px; /* أوسع قليلاً للقائمة */
}
/* --- MCI V78 Light Theme Styles --- */

/* Commander Panel (Light Glass) */
#mciCommanderPanel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    color: #333;
    border-radius: 16px;
    /* Override Previous Dark Styles */
}

.cmd-header {
    background: #f8f9fa;
    color: #c0392b;
    border-bottom: 1px solid #eee;
}
.cmd-close { color: #999; }
.cmd-close:hover { color: #c0392b; }

.cmd-control-group label { color: #555; font-weight: bold; }
.range-wrap span { color: #c0392b; }

.lvl-btn {
    background: #f1f2f6; 
    color: #555;
    border: 1px solid #ddd;
}
.lvl-btn:hover { background: #e0e0e0; }
.l1:hover { border-color: #f1c40f; color: #f1c40f; background: #fff; }
.l2:hover { border-color: #e67e22; color: #e67e22; background: #fff; }
.l3:hover { border-color: #c0392b; color: #c0392b; background: #fff; }

.cmd-stats {
    background: #f8f9fa;
    color: #333;
    border: 1px dashed #ddd;
}

.cmd-action-btn {
    background: #c0392b; /* أحمر داكن رسمي */
    color: white;
    box-shadow: 0 4px 10px rgba(192, 57, 43, 0.3);
}
.cmd-action-btn:hover { background: #a93226; transform: translateY(-1px); }

/* Mission List (Light) */
.cmd-mission-log {
    background: #fff;
    border-top: 1px solid #eee;
}
.mission-header {
    background: #fcfcfc;
    color: #333;
    border-bottom: 1px solid #eee;
}
.mission-row {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-left: 3px solid #c0392b;
    margin-bottom: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.mission-row:hover { background: #fdfdfd; }

.m-name { color: #2c3e50; font-size: 13px; }
.m-status { font-size: 11px; }
.m-icon { background: #fbeae9; color: #c0392b; }

.cmd-close-mission {
    background: #f8f9fa;
    color: #555;
    border-top: 1px solid #eee;
}
.cmd-close-mission:hover { background: #eee; color: #333; }

/* بطاقة التفعيل في التبويب */
.mci-commander-card {
    background: white;
    border: 1px solid #eee;
    border-left: 4px solid #c0392b;
}
.mci-card-title { color: #333; }
.mci-card-icon { background: #fbeae9; color: #c0392b; }
.mci-card-action button { background: #c0392b; }

/* --- V80 Hazmat Styles --- */

/* Zone Rows */
.zone-row {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
}
.red-zone { background: #fff5f5; border-left: 4px solid #c0392b; }
.yellow-zone { background: #fef9e7; border-left: 4px solid #f39c12; }
.green-zone { background: #f0fdf4; border-left: 4px solid #27ae60; }

.zone-title {
    font-weight: bold; font-size: 13px; margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.red-zone .zone-title { color: #c0392b; }
.yellow-zone .zone-title { color: #d35400; }
.green-zone .zone-title { color: #166534; }

.zone-controls {
    display: flex; gap: 10px;
}
.control-item {
    flex: 1;
}
.control-item label {
    display: block; font-size: 10px; color: #666; margin-bottom: 2px;
}
.control-item input {
    width: 100%; height: 4px;
}
.control-item span {
    display: block; font-size: 11px; font-weight: bold; text-align: left;
}

/* Live Stats Table */
.live-stats-table {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    font-size: 12px;
}
.stat-grid-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    background: #f8f9fa;
    padding: 8px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
}
.stat-grid-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    padding: 6px 8px;
    border-bottom: 1px dashed #f0f0f0;
}
.row-red { color: #c0392b; }
.row-yellow { color: #d35400; }
.row-green { color: #166534; }

.stat-grid-footer {
    display: flex; justify-content: space-between;
    padding: 8px; background: #f1f2f6; font-weight: bold;
    color: #333;
}

/* Adjust Panel Width */
#mciCommanderPanel { width: 400px; max-height: 80vh; overflow-y: auto; }

/* --- V81 Styles --- */
#mciCommanderPanel {
    /* تمكين التحريك */
    position: absolute;
    top: 100px; left: 100px; /* موقع ابتدائي */
    transform: none; /* إلغاء التمركز */
    cursor: default;
    width: 420px;
}

#cmdHeaderDrag {
    cursor: move; /* مؤشر التحريك */
}

/* تعديل عرض الجدول ليتناسب مع الإحصائيات الدائمة */
.live-stats-table {
    margin-top: 15px;
    border: 2px solid #eee;
}

/* --- V82 FX Styles --- */

/* 1. Fire & Smoke Animation (Pure CSS) */
.fx-container {
    position: relative; width: 80px; height: 80px;
}
.fx-center {
    position: absolute; bottom: 10px; left: 40px; transform: translateX(-50%);
    width: 20px; height: 5px; background: #000; border-radius: 50%; opacity: 0.5;
    box-shadow: 0 0 10px #000;
}
.fx-fire {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 20px; background: linear-gradient(to top, #ff4500, #ff8c00);
    border-radius: 50% 50% 50% 0;
    opacity: 0.8; mix-blend-mode: screen;
    animation: fireFlicker 1s infinite alternate;
}
.f1 { animation-delay: 0s; width: 25px; height: 30px; bottom: 8px; }
.f2 { animation-delay: 0.2s; width: 15px; height: 20px; left: 40%; }
.f3 { animation-delay: 0.4s; width: 15px; height: 25px; left: 60%; }

@keyframes fireFlicker {
    0% { transform: translateX(-50%) scale(1) rotate(-5deg); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(1.1) rotate(5deg); opacity: 1; }
}

.fx-smoke {
    position: absolute; bottom: 20px; left: 50%;
    width: 15px; height: 15px; background: #555;
    border-radius: 50%; opacity: 0;
    animation: smokeRise 3s infinite;
}
.s1 { animation-delay: 0s; left: 45%; }
.s2 { animation-delay: 1s; left: 55%; }
.s3 { animation-delay: 2s; left: 50%; }

@keyframes smokeRise {
    0% { bottom: 20px; opacity: 0.6; transform: scale(1); }
    100% { bottom: 70px; opacity: 0; transform: scale(3); }
}

/* 2. Action Buttons Grid */
.action-buttons-grid {
    display: flex; gap: 10px; margin-top: 15px;
}
.cmd-action-btn {
    flex: 1;
    padding: 12px;
    border: none; border-radius: 8px;
    font-family: 'Tajawal'; font-weight: bold; font-size: 13px;
    cursor: pointer; color: white; transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-start {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(46, 204, 113, 0.4); }

.btn-stop {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
}
.btn-stop:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4); }

/* تحسين شكل الهيدر */
#cmdHeaderDrag { cursor: grab; }
#cmdHeaderDrag:active { cursor: grabbing; }

/* --- V83 RealFX Styles --- */

/* 1. حاوية التأثيرات */
.real-fx-container {
    position: relative; width: 100px; height: 100px;
    pointer-events: none; /* عشان النقر يجي عالماركر */
}

/* 2. الموجة الصادمة (Shockwave) */
.shockwave {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: shockwaveExpand 2s infinite;
    box-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
}
@keyframes shockwaveExpand {
    0% { width: 10px; height: 5px; opacity: 1; border-width: 3px; }
    100% { width: 150px; height: 60px; opacity: 0; border-width: 0px; }
}

/* 3. القلب المتوهج (Core Glow) */
.core-glow {
    position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 15px;
    background: radial-gradient(circle, #fff, #ffae00, transparent);
    border-radius: 50%;
    opacity: 0.8;
    mix-blend-mode: screen;
    animation: corePulse 0.5s infinite alternate;
}
@keyframes corePulse { from { opacity: 0.6; transform: translateX(-50%) scale(0.9); } to { opacity: 1; transform: translateX(-50%) scale(1.1); } }

/* 4. جزيئات النار (Fire Particles) */
.fire-layer .f-p {
    position: absolute; bottom: 20px; left: 50%;
    background: radial-gradient(circle, #ffeb3b, #ff5722, transparent);
    border-radius: 50%; mix-blend-mode: screen;
    opacity: 0;
    animation: fireRise 1.5s infinite;
}
.f1 { width: 30px; height: 30px; animation-delay: 0s; margin-left: -15px; }
.f2 { width: 20px; height: 20px; animation-delay: 0.3s; margin-left: -25px; }
.f3 { width: 25px; height: 25px; animation-delay: 0.6s; margin-left: 5px; }

@keyframes fireRise {
    0% { bottom: 15px; transform: scale(0.5); opacity: 0; }
    20% { opacity: 0.9; }
    100% { bottom: 80px; transform: scale(1.5); opacity: 0; }
}

/* 5. جزيئات الدخان (Smoke Particles) */
.smoke-layer .s-p {
    position: absolute; bottom: 30px; left: 50%;
    background: radial-gradient(circle, #333, #000, transparent);
    border-radius: 50%; opacity: 0;
    filter: blur(5px);
    animation: smokeBillow 4s infinite;
}
.s1 { width: 40px; height: 40px; animation-delay: 0s; margin-left: -20px; }
.s2 { width: 30px; height: 30px; animation-delay: 1.2s; margin-left: -35px; }
.s3 { width: 35px; height: 35px; animation-delay: 2.4s; margin-left: 10px; }
.s4 { width: 45px; height: 45px; animation-delay: 0.8s; margin-left: -10px; }
.s5 { width: 25px; height: 25px; animation-delay: 1.8s; margin-left: 15px; }

@keyframes smokeBillow {
    0% { bottom: 30px; transform: scale(0.5); opacity: 0; }
    20% { opacity: 0.6; }
    100% { bottom: 150px; transform: scale(3); opacity: 0; }
}

/* تحسين زر حالة الموجة */
#waveStatus {
    font-size: 14px; font-weight: bold; text-align: center;
    background: #fff; padding: 5px; border-radius: 4px;
    border: 1px dashed #ccc; margin-bottom: 5px;
}
