:root {
    --lime: #059669;
    --cyan: #0284c7;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --muted: #64748b;
    --accent-red: #dc2626;
    --accent-amber: #d97706;
}

body {
    background-color: var(--bg-dark);
    color: #0f172a;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

.code-font {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Enterprise Management Panels */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

.glass-panel-glow {
    border-color: #0284c7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Radar Pulse Animation */
@keyframes radar-pulse {
    0% { transform: scale(0.95); opacity: 0.9; }
    50% { transform: scale(1.15); opacity: 0.4; }
    100% { transform: scale(0.95); opacity: 0.9; }
}

.radar-dot {
    animation: radar-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Active Nav Indicator (HMI Capacitive Touch Tile - Light Theme) */
.nav-btn.active,
.nav-btn.hmi-tile.active {
    background: #ffffff;
    border: 2.5px solid #2ab396;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(42, 179, 150, 0.14);
}

.nav-btn.hmi-tile.active .hmi-tile-badge {
    background: #d1fae5 !important;
    color: #047857 !important;
}

/* Touch-Friendly Zoom Controls on Leaflet Map */
.leaflet-touch .leaflet-bar {
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-touch .leaflet-bar a,
.leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 30px !important;
    font-size: 18px !important;
    color: #475569 !important;
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

.leaflet-control-zoom a:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

/* Map Markers */
.map-marker {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid white;
    background: #0284c7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.map-marker:hover {
    transform: rotate(-45deg) scale(1.15);
}

.map-marker span {
    display: block;
    transform: rotate(45deg);
    font-size: 9px;
    text-align: center;
    line-height: 20px;
    color: #ffffff;
    font-weight: 800;
}

.map-marker.alert {
    background: #ef4444;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.map-marker.selected {
    background: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
}

/* Solar Meter Gauge Bar */
.solar-meter {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

#solar-meter-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #10b981);
    border-radius: 99px;
    transition: width 0.8s ease-out;
}

/* Leaflet Container - Soft Mediterranean Azure Sea & Warm Sicily Terrain */
.leaflet-container {
    background: #badcf2 !important;
}

.leaflet-tile-pane {
    filter: sepia(0.26) saturate(1.45) hue-rotate(-10deg) brightness(0.99) contrast(1.02);
}

.leaflet-popup-content-wrapper {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.leaflet-popup-tip {
    background: #ffffff !important;
}

/* 3D Scene Viewport Light Blueprint */
.scene-wrap {
    height: 480px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(180deg, #e0f2fe 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    cursor: grab;
}

.scene-wrap:active {
    cursor: grabbing;
}

#solar-scene {
    width: 100%;
    height: 100%;
    display: block;
}

.scene-label {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 1.2px;
    color: #334155;
    pointer-events: none;
    z-index: 5;
}

.scene-readout {
    position: absolute;
    right: 16px;
    top: 16px;
    text-align: right;
    pointer-events: none;
    z-index: 5;
}

.scene-hint {
    position: absolute;
    bottom: 16px;
    right: 16px;
    font-size: 9px;
    letter-spacing: 1px;
    color: #64748b;
    pointer-events: none;
    z-index: 5;
}

.gps-readout {
    position: absolute;
    z-index: 5;
    left: 16px;
    bottom: 16px;
    max-width: 280px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

.gps-readout span {
    display: block;
    color: #0284c7;
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 700;
}

.gps-readout strong {
    display: block;
    color: #0f172a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin: 3px 0;
}

.gps-readout small {
    color: #64748b;
    font-size: 9px;
}

/* GPS Pins Grid */
.gps-pins {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.gps-pin {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gps-pin:hover, .gps-pin.selected {
    border-color: #0284c7;
    background: #f0f9ff;
    transform: translateY(-1px);
}

/* Module Chips Matrix */
.module-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.module-chip {
    width: 36px;
    height: 28px;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    background: #ecfdf5;
    color: #065f46;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.module-chip:hover, .module-chip.selected {
    outline: 2px solid #0284c7;
    outline-offset: 1px;
    transform: scale(1.08);
}

.module-chip.warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.module-chip.fault {
    border-color: #fecdd3;
    background: #fff1f2;
    color: #9f1239;
    box-shadow: 0 0 8px rgba(225, 29, 72, 0.3);
    animation: faultPulse 1.7s infinite;
}

@keyframes faultPulse {
    0% { box-shadow: 0 0 4px rgba(225, 29, 72, 0.2); }
    50% { box-shadow: 0 0 10px rgba(225, 29, 72, 0.5); }
    100% { box-shadow: 0 0 4px rgba(225, 29, 72, 0.2); }
}

.panel-detail-box {
    border-left: 3px solid #0284c7;
    background: #f8fafc;
}

/* Plant SVG Schematics */
.plant-svg {
    width: 100%;
    height: auto;
    min-width: 560px;
    display: block;
}

.plant-svg-wrap {
    overflow-x: auto;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.plant-svg text {
    font-family: 'Inter', system-ui, sans-serif;
    fill: #1e293b;
}

.plant-svg .sub {
    fill: #64748b;
    font-size: 10px;
}

.plant-svg .tag {
    fill: #0284c7;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.plant-svg .panel {
    fill: #e0f2fe;
    stroke: #38bdf8;
    stroke-width: 1;
}

.plant-svg .node {
    fill: #f8fafc;
    stroke: #0284c7;
    stroke-width: 1.2;
}

.plant-svg .cabinet {
    fill: #fef3c7;
    stroke: #f59e0b;
    stroke-width: 1.2;
}

.plant-svg .wire {
    stroke: #0284c7;
    stroke-width: 2;
    fill: none;
}

.plant-svg .wire-ac {
    stroke: #10b981;
    stroke-width: 2;
    fill: none;
}

.plant-svg .demo {
    fill: #d97706;
    font-size: 8px;
    letter-spacing: 0.8px;
}
