/* ArchiSymphonyNo5 — Geo Command Center Dashboard
 * Glassmorphism floating panels over full-screen map
 * Phase B / MS 1100-63
 */

/* ========================================
   Map Container (full-screen behind panels)
   ======================================== */
.as-geo-map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background: var(--as-bg-secondary, #f8fafc);
}

/* Content wrapper — full height, no padding */
.as-geo-wrap {
    position: relative;
    height: calc(100vh - var(--as-header-height, 48px) - var(--as-page-title-height, 110px));
    overflow: hidden;
}

/* ========================================
   Glassmorphism Panel Base
   ======================================== */
.as-geo-panel {
    position: absolute;
    z-index: 10;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(27, 58, 75, 0.12),
        0 2px 8px rgba(27, 58, 75, 0.06);
    padding: 1rem;
    overflow-y: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.as-geo-panel::-webkit-scrollbar {
    width: 4px;
}
.as-geo-panel::-webkit-scrollbar-thumb {
    background: rgba(61, 139, 147, 0.3);
    border-radius: 2px;
}

/* ========================================
   Left Panel — Role-Based Widgets
   ======================================== */
.as-geo-panel--left {
    top: 1rem;
    left: 1rem;
    width: 320px;
    max-height: calc(100% - 2rem);
}

/* ========================================
   Top-Right Panel — Fleet + Alerts (unified)
   ======================================== */
.as-geo-panel--summary {
    top: 1rem;
    right: 1rem;
    width: 300px;
    max-height: calc(100% - 2rem);
}

/* ========================================
   Tab Bar inside Summary Panel
   ======================================== */
.as-geo-tab-bar {
    display: flex;
    gap: 4px;
    padding: 3px;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    background: rgba(27, 58, 75, 0.06);
}

.as-geo-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.45rem 0.5rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--as-text-muted, #64748b);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.03em;
    position: relative;
}

.as-geo-tab:hover {
    color: var(--as-navy, #1B3A4B);
}

.as-geo-tab.as-active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--as-teal, #3D8B93);
    box-shadow:
        0 1px 3px rgba(27, 58, 75, 0.1),
        0 1px 2px rgba(27, 58, 75, 0.06);
}

.as-geo-tab i {
    font-size: 0.95rem;
    transition: transform 0.2s ease;
}

.as-geo-tab.as-active i {
    transform: scale(1.1);
}

.as-geo-tab-badge {
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    border-radius: 8.5px;
    font-size: 0.58rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.35);
    animation: as-badge-pulse 2s ease-in-out infinite;
}

@keyframes as-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Tab content visibility */
.as-geo-tab-content {
    display: none;
    animation: as-tab-fade-in 0.2s ease-out;
}

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

@keyframes as-tab-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Panel Header
   ======================================== */
.as-geo-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(61, 139, 147, 0.15);
}

.as-geo-panel-header i {
    color: var(--as-teal, #3D8B93);
    font-size: 1.25rem;
}

.as-geo-panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--as-navy, #1B3A4B);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ========================================
   Vehicle Summary Stat Grid
   ======================================== */
.as-geo-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.as-geo-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0.25rem;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.7);
}

.as-geo-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--as-navy, #1B3A4B);
    line-height: 1;
}

.as-geo-stat-label {
    font-size: 0.65rem;
    color: var(--as-text-muted, #64748b);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.as-geo-stat--available .as-geo-stat-value { color: var(--as-success, #10b981); }
.as-geo-stat--in-use .as-geo-stat-value { color: var(--as-teal, #3D8B93); }
.as-geo-stat--maintenance .as-geo-stat-value { color: var(--as-warning, #f59e0b); }

/* ========================================
   Alert List
   ======================================== */
.as-geo-alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.as-geo-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(248, 250, 252, 0.6);
    font-size: 0.8rem;
    color: var(--as-text, #1e293b);
}

.as-geo-alert-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.as-geo-alert-icon--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--as-warning, #f59e0b);
}
.as-geo-alert-icon--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--as-error, #ef4444);
}
.as-geo-alert-icon--info {
    background: rgba(61, 139, 147, 0.15);
    color: var(--as-teal, #3D8B93);
}

.as-geo-alert-text {
    flex: 1;
    line-height: 1.3;
}

.as-geo-alert-date {
    font-size: 0.7rem;
    color: var(--as-text-muted, #64748b);
}

/* ========================================
   Role Widget Cards (Left Panel)
   ======================================== */
.as-geo-widget {
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.6);
    margin-bottom: 0.5rem;
}

.as-geo-widget:last-child {
    margin-bottom: 0;
}

.as-geo-widget-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-teal, #3D8B93);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.as-geo-widget-body {
    font-size: 0.8rem;
    color: var(--as-text, #1e293b);
}

.as-geo-kpi-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.as-geo-kpi-row:last-child {
    border-bottom: none;
}

.as-geo-kpi-label {
    font-size: 0.75rem;
    color: var(--as-text-muted, #64748b);
}

.as-geo-kpi-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--as-navy, #1B3A4B);
}

/* ========================================
   Compliance Badges
   ======================================== */
.as-geo-compliance-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

.as-geo-compliance-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 6px;
}

.as-geo-compliance-badge--ok {
    background: rgba(16, 185, 129, 0.12);
    color: var(--as-success, #10b981);
}

.as-geo-compliance-badge--warn {
    background: rgba(245, 158, 11, 0.15);
    color: var(--as-warning, #f59e0b);
}

.as-geo-compliance-badge--danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--as-error, #ef4444);
}

/* ========================================
   KPI Growth Indicator
   ======================================== */
.as-geo-kpi-value-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.as-geo-kpi-growth {
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.as-geo-kpi-growth--up {
    color: var(--as-success, #10b981);
}

.as-geo-kpi-growth--down {
    color: var(--as-error, #ef4444);
}

/* ========================================
   Project Pipeline Grid (PM/BIM)
   ======================================== */
.as-geo-pipeline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}

.as-geo-pipeline-stat {
    text-align: center;
    padding: 0.4rem 0.25rem;
    border-radius: 6px;
    background: rgba(248, 250, 252, 0.8);
}

.as-geo-pipeline-count {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--as-navy, #1B3A4B);
}

.as-geo-pipeline-label {
    font-size: 0.6rem;
    color: var(--as-text-muted, #64748b);
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.as-geo-pipeline--plan .as-geo-pipeline-count { color: var(--as-text-muted, #64748b); }
.as-geo-pipeline--active .as-geo-pipeline-count { color: var(--as-teal, #3D8B93); }
.as-geo-pipeline--done .as-geo-pipeline-count { color: var(--as-success, #10b981); }
.as-geo-pipeline--hold .as-geo-pipeline-count { color: var(--as-warning, #f59e0b); }

/* ========================================
   Dispatch Items (Field Operator)
   ======================================== */
.as-geo-dispatch-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.as-geo-dispatch-item:last-child {
    border-bottom: none;
}

.as-geo-dispatch-detail {
    flex: 1;
    min-width: 0;
}

.as-geo-dispatch-vehicle {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--as-navy, #1B3A4B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-geo-dispatch-dest {
    font-size: 0.65rem;
    color: var(--as-text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-geo-dispatch-time {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--as-teal, #3D8B93);
    white-space: nowrap;
}

/* ========================================
   Progress Bar (SUT)
   ======================================== */
.as-geo-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-geo-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.as-geo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--as-teal, #3D8B93), var(--as-cyan-light, #4EBDC4));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.as-geo-progress-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--as-teal, #3D8B93);
    min-width: 36px;
    text-align: right;
}

/* ========================================
   Approval Summary (Back Office)
   ======================================== */
.as-geo-approval-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.8rem;
}

/* ========================================
   Small Empty State
   ======================================== */
.as-geo-empty-sm {
    text-align: center;
    padding: 0.75rem;
    color: var(--as-text-muted, #64748b);
    font-size: 0.75rem;
}

.as-geo-empty-sm i {
    margin-right: 0.25rem;
}

/* ========================================
   Map Controls Toolbar
   ======================================== */
.as-geo-toolbar {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    padding: 0.35rem;
    box-shadow: 0 2px 12px rgba(27, 58, 75, 0.1);
}

.as-geo-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--as-text, #1e293b);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.as-geo-toolbar-btn:hover {
    background: rgba(61, 139, 147, 0.1);
    color: var(--as-teal, #3D8B93);
}

.as-geo-toolbar-btn.as-active {
    background: var(--as-teal, #3D8B93);
    color: #fff;
}

/* ========================================
   Empty/Loading States
   ======================================== */
.as-geo-empty {
    text-align: center;
    padding: 1.5rem 0.5rem;
    color: var(--as-text-muted, #64748b);
    font-size: 0.8rem;
}

.as-geo-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

/* ========================================
   Responsive — collapse panels on mobile
   ======================================== */
@media (max-width: 768px) {
    .as-geo-panel--left {
        position: static;
        width: 100%;
        max-height: none;
        border-radius: 0;
        margin-bottom: 0.5rem;
    }

    .as-geo-panel--summary {
        position: static;
        width: 100%;
        max-height: none;
        border-radius: 0;
        margin-bottom: 0.5rem;
    }

    .as-geo-wrap {
        height: auto;
        min-height: calc(100vh - var(--as-header-height, 48px) - var(--as-page-title-height, 110px));
        overflow: visible;
    }

    .as-geo-map {
        position: relative;
        height: 300px;
    }

    .as-geo-toolbar {
        position: static;
        transform: none;
        margin: 0.5rem;
        justify-content: center;
    }
}

/* ========================================
   Dark Map Tiles (CartoDB Dark Matter)
   ======================================== */
.as-geo-map--dark .leaflet-tile-pane {
    filter: brightness(0.85) contrast(1.15) saturate(0.9);
}

/* ========================================
   Vehicle Marker — Pulse Animation
   ======================================== */
.as-geo-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    color: #fff;
    transition: transform 0.2s ease;
}

.as-geo-marker-vehicle {
    background: var(--as-gray, #94a3b8);
}

.as-geo-marker--active {
    background: var(--as-info, #3b82f6);
    animation: as-pulse-active 2s ease-in-out infinite;
}

.as-geo-marker--maint {
    background: var(--as-error, #ef4444);
    animation: as-pulse-alert 1.5s ease-in-out infinite;
}

.as-geo-marker--moving {
    background: var(--as-teal, #3D8B93);
    animation: as-pulse-active 2s ease-in-out infinite;
}

@keyframes as-pulse-active {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
}

@keyframes as-pulse-alert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* ========================================
   Site Marker (Construction)
   ======================================== */
.as-geo-marker-site {
    background: var(--as-warning, #f59e0b);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.as-geo-marker-site i {
    font-size: 0.9rem;
}

/* ========================================
   Site InfoWindow Popup
   ======================================== */
.as-geo-popup {
    font-family: var(--as-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 0.8rem;
    min-width: 200px;
    max-width: 280px;
}

.as-geo-popup strong {
    color: var(--as-navy, #1B3A4B);
    font-size: 0.9rem;
}

.as-geo-popup-site {
    min-width: 240px;
}

.as-geo-popup-site-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.as-geo-popup-site-header i {
    color: var(--as-warning, #f59e0b);
    font-size: 1.2rem;
}

.as-geo-popup-site-title {
    font-weight: 700;
    color: var(--as-navy, #1B3A4B);
    font-size: 0.9rem;
}

.as-geo-popup-site-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.as-geo-popup-site-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.as-geo-popup-site-label {
    color: var(--as-text-muted, #64748b);
}

.as-geo-popup-site-value {
    font-weight: 600;
    color: var(--as-navy, #1B3A4B);
}

.as-geo-popup-site-progress {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.as-geo-popup-site-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--as-teal, #3D8B93), var(--as-cyan-light, #4EBDC4));
    border-radius: 3px;
}

.as-geo-popup-site-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 0.35rem;
    background: var(--as-bg-secondary, #f8fafc);
}

/* ========================================
   Step Bar / Pipeline UI
   ======================================== */
.as-geo-stepbar {
    display: flex;
    gap: 2px;
    margin: 0.5rem 0;
}

.as-geo-step {
    flex: 1;
    text-align: center;
    padding: 0.3rem 0.15rem;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s;
}

.as-geo-step--complete {
    background: var(--as-success, #10b981);
    color: #fff;
}

.as-geo-step--active {
    background: var(--as-teal, #3D8B93);
    color: #fff;
}

.as-geo-step--pending {
    background: rgba(0, 0, 0, 0.06);
    color: var(--as-text-muted, #64748b);
}

.as-geo-step-label {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.5rem;
    font-weight: 400;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Heatmap Widget (Motivation)
   ======================================== */
.as-geo-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
}

.as-geo-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 600;
    color: #fff;
}

.as-geo-heatmap-cell--high { background: var(--as-success, #10b981); }
.as-geo-heatmap-cell--mid { background: var(--as-warning, #f59e0b); }
.as-geo-heatmap-cell--low { background: var(--as-error, #ef4444); }
.as-geo-heatmap-cell--none { background: rgba(0, 0, 0, 0.06); color: var(--as-text-muted); }

.as-geo-heatmap-legend {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.35rem;
    font-size: 0.6rem;
    color: var(--as-text-muted, #64748b);
}

.as-geo-heatmap-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
    margin-right: 0.2rem;
    vertical-align: middle;
}

/* ========================================
   Search/Filter Bar in Toolbar
   ======================================== */
.as-geo-search-input {
    padding: 0.35rem 0.6rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--as-text, #1e293b);
    min-width: 140px;
    outline: none;
    transition: border-color 0.15s;
}

.as-geo-search-input:focus {
    border-color: var(--as-teal, #3D8B93);
}

.as-geo-search-input::placeholder {
    color: var(--as-text-muted, #64748b);
    opacity: 0.7;
}

/* ========================================
   Kanban-style Pipeline Cards
   ======================================== */
.as-geo-pipeline-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    background: rgba(248, 250, 252, 0.8);
    margin-bottom: 0.35rem;
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.as-geo-pipeline-card:last-child {
    margin-bottom: 0;
}

.as-geo-pipeline-card--urgent {
    border-left-color: var(--as-error, #ef4444);
}

.as-geo-pipeline-card--warning {
    border-left-color: var(--as-warning, #f59e0b);
}

.as-geo-pipeline-card--ok {
    border-left-color: var(--as-success, #10b981);
}

.as-geo-pipeline-card-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: rgba(61, 139, 147, 0.1);
    color: var(--as-teal, #3D8B93);
}

.as-geo-pipeline-card-body {
    flex: 1;
    min-width: 0;
}

.as-geo-pipeline-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--as-navy, #1B3A4B);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-geo-pipeline-card-sub {
    font-size: 0.6rem;
    color: var(--as-text-muted, #64748b);
}

.as-geo-pipeline-card-badge {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
}
