* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f8f9fa;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.navbar {
    background: #2f6530;
    color: white;
    padding: 0;
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.navbar-brand i {
    margin-right: 10px;
    color: white;
    font-size: 1.8rem;
}

.navbar-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    margin-left: 25px;
}

.nav-link {
    color: #e2e6e9;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    color: white;
}

.nav-link i {
    margin-right: 8px;
}

/* Container principal */
.main-container {
    display: flex;
    height: calc(100vh - 70px);
    transition: all 0.3s ease;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    flex-shrink: 0;
    z-index: 999;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2f6530;
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 0.9rem;
    color: #6c757d;
}

.sidebar-content {
    padding: 20px;
}

.control-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2f6530;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 8px;
    color: #2f6530;
    width: 16px;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2f6530;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #265227;
    transform: scale(1.1);
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:focus {
    outline: none;
    border-color: #2f6530;
    box-shadow: 0 0 0 2px rgba(47, 101, 48, 0.2);
}

.value-display {
    display: inline-block;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #2f6530;
    font-weight: 500;
    margin-left: 10px;
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.sidebar-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(248, 249, 250, 0.5);
    border: none;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 1.1rem;
    color: #2f6530;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(248, 249, 250, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Custom zoom controls positioning */
.leaflet-control-zoom {
    position: absolute !important;
    bottom: 80px !important;
    left: 20px !important;
    top: auto !important;
    right: auto !important;
}

.leaflet-top.leaflet-left {
    top: auto !important;
    bottom: 80px !important;
    left: 20px !important;
}

/* Disclaimer Footer */
.disclaimer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-top: 1px solid #dee2e6;
    font-size: 0.75rem;
    color: #495057;
    line-height: 1.3;
    z-index: 1000;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
}

.disclaimer-content {
    font-style: italic;
    max-width: none;
}

/* Layer Panel (QGIS Style) */
.layer-panel {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.panel-header {
    background: #f3f4f6;
    padding: 8px 12px;
    border-bottom: 1px solid #d1d5db;
    font-size: 0.85rem;
    color: #6b7280;
}

.layer-list {
    max-height: 300px;
    overflow-y: auto;
}

.layer-item {
    border-bottom: 1px solid #e5e7eb;
    background: white;
    transition: background-color 0.2s;
}

.layer-item:hover {
    background: #f9fafb;
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-item-content {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
}

.layer-checkbox-container {
    position: relative;
    display: flex;
    align-items: center;
}

.layer-panel-checkbox {
    display: none;
}

.layer-visibility-toggle {
    width: 16px;
    height: 16px;
    border: 2px solid #9ca3af;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    background: white;
    transition: all 0.2s;
}

.layer-panel-checkbox:checked + .layer-visibility-toggle {
    background: #2f6530;
    border-color: #2f6530;
}

.layer-panel-checkbox:checked + .layer-visibility-toggle::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: white;
}

.layer-info {
    flex: 1;
    min-width: 0;
}

.layer-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f2937;
    word-break: break-word;
    margin-bottom: 2px;
    white-space: normal;
    overflow: visible;
}

.layer-type {
    font-size: 0.75rem;
    color: #6b7280;
}

.layer-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layer-up,
.layer-down {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    padding: 4px 6px;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.layer-up:hover,
.layer-down:hover {
    background: #f3f4f6;
    border-color: #2f6530;
    color: #2f6530;
}

.legend-toggle-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    padding: 4px 6px;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
    transition: all 0.2s;
    margin-top: 2px;
}

.legend-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #2f6530;
    color: #2f6530;
}

.legend-toggle-btn.active {
    background: #2f6530;
    border-color: #2f6530;
    color: white;
}

/* Integrated Legend Styles */
.integrated-legend {
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    padding: 10px 12px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0 12px;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding: 10px 12px;
    }
}

.legend-header-small {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2f6530;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-items-small {
    display: grid;
    gap: 4px;
}

.legend-items-small .legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    gap: 8px;
}

.legend-items-small .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.legend-point {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
    flex-shrink: 0;
    position: relative;
}

.legend-line {
    width: 12px;
    height: 4px;
    display: inline-block;
    border-radius: 2px;
}

.legend-polygon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px dotted #204abe;
    box-sizing: border-box;
    vertical-align: middle;
}

.legend-polygon2 {
    display: inline-block;  
    width: 12px;
    height: 12px;
    background-color: #d4c22f;
    box-sizing: border-box;
    vertical-align: middle;
    border-radius: 2px;
}

.legend-text {
    color: #2f6530;
    font-weight: 400;
}

.layer-up:disabled,
.layer-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.layer-opacity-control {
    display: none;
    padding: 8px 12px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    align-items: center;
    gap: 10px;
}

.layer-item.active .layer-opacity-control {
    display: flex;
}

.layer-opacity-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    outline: none;
}

.layer-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2f6530;
    cursor: pointer;
}

.opacity-value {
    font-size: 0.8rem;
    color: #6b7280;
    min-width: 35px;
    text-align: right;
}

.wms-info {
    background: #e8f4e8;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #2f6530;
    border-left: 4px solid #2f6530;
}

.wms-info i {
    margin-right: 5px;
}

.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 997;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Popup Styles */
.custom-popup-content {
    font-family: 'Inter', sans-serif;
    min-width: 250px;
    max-width: 400px;
}

.popup-header {
    color: #2f6530;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.popup-header i {
    margin-right: 8px;
    font-size: 1.2rem;
}

.power-value-section {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #2f6530;
}

.power-label {
    font-weight: 600;
    color: #2f6530;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.power-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a472a;
}

.power-unit {
    font-size: 0.85rem;
    color: #6c757d;
    margin-left: 4px;
}

.additional-info {
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    margin-top: 10px;
    font-size: 0.85rem;
    max-height: 120px;
    overflow-y: auto;
}

/* Desktop sidebar behavior */
@media (min-width: 769px) {
    .sidebar.hide {
        transform: translateX(-100%);
        width: 0;
        overflow: hidden;
        border-right: none;
    }
    
    .main-container.sidebar-hidden .map-container {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -350px;
        z-index: 999;
        transition: left 0.3s ease;
        height: 100%;
    }

    .sidebar.show {
        left: 0;
    }

    .navbar-container {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .navbar-nav {
        display: none;
    }

    .leaflet-control-zoom {
        bottom: 90px !important;
        left: 10px !important;
    }

    .disclaimer-footer {
        font-size: 0.65rem;
        padding: 6px 10px;
    }
}