/* ==========================================================================
   ACTIVE AOI REGION SWITCH & FLOATING BASEMAP HUD CHIP
   ========================================================================== */
.aoi-active-tab-btn {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.22), rgba(168, 85, 247, 0.22)) !important;
    border: 1px solid rgba(0, 242, 254, 0.6) !important;
    color: #00f2fe !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    animation: aoiPulseGlow 2.5s infinite alternate ease-in-out;
}

@keyframes aoiPulseGlow {
    0% { box-shadow: 0 0 8px rgba(0, 242, 254, 0.2); }
    100% { box-shadow: 0 0 18px rgba(0, 242, 254, 0.55); }
}

.aoi-tab-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 10px;
    font-weight: 800;
    margin-left: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.aoi-tab-clear-btn:hover {
    background: #ef4444;
    color: #ffffff;
    transform: scale(1.2);
}

/* Floating AOI HUD Chip on Base Map */
.map-aoi-hud-chip {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(8, 14, 26, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 242, 254, 0.5);
    border-radius: 24px;
    padding: 6px 14px 6px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 22px rgba(0, 242, 254, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.map-aoi-hud-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-aoi-hud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00f2fe;
    box-shadow: 0 0 8px #00f2fe;
    animation: aoiDotPulse 1.5s infinite alternate;
}

@keyframes aoiDotPulse {
    0% { opacity: 0.4; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

.map-aoi-hud-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
    font-family: var(--font-sans, 'Outfit', 'Cairo', sans-serif);
    letter-spacing: 0.3px;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-aoi-hud-badge {
    font-size: 0.68rem;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-weight: 700;
    color: #00f2fe;
    background: rgba(0, 242, 254, 0.12);
    padding: 2px 7px;
    border-radius: 12px;
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.map-aoi-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #f87171;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-aoi-clear-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

/* Tool Button in Map Rail */
#tool-aoi-lab.active {
    background: rgba(0, 242, 254, 0.25);
    border-color: #00f2fe;
    color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

@keyframes aoi-pulse-glow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px #00f2fe); }
    50% { transform: scale(1.12); filter: drop-shadow(0 0 8px #00f2fe); }
}

/* ==========================================================================
   AOI RESEARCH LAB DRAWER / WORKSPACE
   ========================================================================== */
.aoi-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 7, 18, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.aoi-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.aoi-lab-drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    max-width: 95vw;
    height: 100vh;
    background: rgba(11, 19, 43, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(0, 242, 254, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    color: #f8fafc;
    overflow: hidden;
}

[data-lang="ar"] .aoi-lab-drawer {
    right: auto;
    left: -520px;
    border-left: none;
    border-right: 1px solid rgba(0, 242, 254, 0.25);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.aoi-lab-drawer.active {
    right: 0;
}

[data-lang="ar"] .aoi-lab-drawer.active {
    left: 0;
}

/* Header */
.aoi-drawer-header {
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.aoi-badge-copernicus {
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    border: 1px solid rgba(0, 242, 254, 0.35);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aoi-drawer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.aoi-drawer-subtitle {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

.aoi-drawer-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aoi-drawer-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* Nav Tabs */
.aoi-tabs-bar {
    display: flex;
    background: rgba(13, 22, 45, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 8px;
    gap: 4px;
    overflow-x: auto;
}

.aoi-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.aoi-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.aoi-tab-btn.active {
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    border: 1px solid rgba(0, 242, 254, 0.3);
}

/* Content Area */
.aoi-drawer-body {
    padding: 18px 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Vector Dropzone */
.aoi-dropzone {
    border: 2px dashed rgba(0, 242, 254, 0.35);
    background: rgba(8, 14, 26, 0.6);
    border-radius: 10px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.aoi-dropzone:hover,
.aoi-dropzone.dragover {
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.08);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
}

.aoi-dropzone-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.aoi-dropzone-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.aoi-dropzone-hint {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* Drawing Toolbar */
.aoi-draw-tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.aoi-draw-btn {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.aoi-draw-btn:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: rgba(0, 242, 254, 0.4);
    color: #00f2fe;
}

.aoi-draw-btn.active {
    background: rgba(0, 242, 254, 0.2);
    border-color: #00f2fe;
    color: #00f2fe;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

/* Egyptian Preset Chips */
.aoi-presets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aoi-preset-chip {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.aoi-preset-chip:hover {
    background: rgba(0, 242, 254, 0.12);
    border-color: rgba(0, 242, 254, 0.35);
    color: #00f2fe;
}

/* Live AOI Status Card */
.aoi-active-card {
    background: rgba(8, 14, 26, 0.8);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.aoi-active-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.aoi-meta-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 10px;
}

.aoi-meta-box-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 700;
}

.aoi-meta-box-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #00f2fe;
    font-family: var(--font-mono, monospace);
    margin-top: 2px;
}

/* Primary Action Button (Analyze My Area) */
.btn-analyze-aoi {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #00f2fe 0%, #2563eb 100%);
    border: none;
    border-radius: 8px;
    color: #030712;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-analyze-aoi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0, 242, 254, 0.6);
    color: #000000;
}

/* Results & Metrics */
.aoi-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.aoi-metric-stat {
    background: rgba(8, 14, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.aoi-metric-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #00f2fe;
}

.aoi-metric-stat.eesi::before {
    background: #f59e0b;
}

.aoi-metric-stat.rain::before {
    background: #3b82f6;
}

.aoi-metric-stat.ndvi::before {
    background: #10b981;
}

.aoi-stat-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 700;
}

.aoi-stat-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-mono, monospace);
    margin: 4px 0 2px 0;
}

.aoi-stat-unit {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* EESI Environmental Stress Badge */
.aoi-eesi-badge {
    padding: 14px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aoi-eesi-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
}

.aoi-eesi-class {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    margin-top: 2px;
}

.aoi-eesi-score {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fbbf24;
    font-family: var(--font-mono, monospace);
}

/* Multi-Polygon Zonal Table */
.aoi-table-wrap {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(8, 14, 26, 0.8);
}

.aoi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    text-align: left;
}

[data-lang="ar"] .aoi-table {
    text-align: right;
}

.aoi-table th {
    background: rgba(15, 23, 42, 0.95);
    color: #00f2fe;
    padding: 8px 10px;
    font-weight: 700;
    position: sticky;
    top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.aoi-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    font-family: var(--font-mono, monospace);
}

.aoi-table tr:hover td {
    background: rgba(0, 242, 254, 0.08);
    color: #ffffff;
}

/* Project Sessions Manager */
.aoi-projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aoi-project-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.aoi-project-card:hover {
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.08);
}

.aoi-project-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
}

.aoi-project-meta {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Export Buttons */
.aoi-exports-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-aoi-export {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-aoi-export:hover {
    background: rgba(0, 242, 254, 0.15);
    border-color: #00f2fe;
    color: #00f2fe;
}
