/* ATLAS Web Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --bg-color: #ecf0f1;
    --card-bg: #ffffff;
    --border-color: #bdc3c7;
    --text-color: #2c3e50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

header {
    text-align: center;
    padding: 15px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 15px;
}


.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.header-subtitle {
    font-size: 1.4em;
    opacity: 1;
    margin: 0;
    font-weight: 700;
    letter-spacing: 1.2px;
    font-family: 'Segoe UI', 'Roboto', 'Arial Black', sans-serif;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Main Content Layout - 3 Panel System */
.content {
    display: grid;
    grid-template-columns: 350px 1fr 350px;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Individual Panels */
.left-panel, .center-panel, .right-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Left Panel - Form */
.left-panel {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-section {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Center Panel - Map */
.center-panel {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-section {
    padding: 20px;
    overflow: hidden;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Right Panel - Results */
.right-panel {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-panel {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: none; /* Hidden by default */
    flex-direction: column;
}

.results-panel.active {
    display: flex;
}

/* Results Panel Header */
.results-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    flex-shrink: 0;
}

.results-panel-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2em;
}

.close-results-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-results-btn:hover {
    background: #f0f0f0;
}

.close-results-btn svg {
    width: 20px;
    height: 20px;
    stroke: #666;
}

.form-section h2, .map-section h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--secondary-color);
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"] {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Autocomplete styles */
.autocomplete-wrapper {
    position: relative;
}

.input-with-clear {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-clear input {
    flex: 1;
    padding-right: 40px;
}

.clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.clear-btn:hover {
    background-color: #f0f0f0;
}

.clear-btn svg {
    width: 20px;
    height: 20px;
    color: #7f8c8d;
}

.clear-btn:hover svg {
    color: var(--danger-color);
}

.input-with-clear input:not(:placeholder-shown) + .clear-btn {
    display: flex;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--secondary-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.autocomplete-suggestions.active {
    display: block;
}

.autocomplete-suggestion {
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.selected {
    background-color: #e8f4f8;
}

.autocomplete-suggestion strong {
    color: var(--secondary-color);
}

.autocomplete-no-results {
    padding: 10px;
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
}

/* Range slider styles */
.form-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, var(--secondary-color) 0%, var(--secondary-color) 44.44%, var(--border-color) 44.44%, var(--border-color) 100%);
    outline: none;
    padding: 0;
    margin: 10px 0;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
}

.form-group input[type="range"]::-moz-range-thumb:hover {
    background: #2980b9;
}

.slider-scale {
    position: relative;
    display: flex;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 5px;
    margin-bottom: 5px;
    height: 20px;
}

.slider-scale span {
    position: absolute;
    transform: translateX(-50%);
}

.slider-scale span:first-child {
    transform: translateX(0);
}

.slider-scale span:last-child {
    transform: translateX(-100%);
}

#buffer-value,
#load-value {
    font-weight: bold;
    color: var(--secondary-color);
}

/* Radio card styles */
.radio-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.radio-card {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 80px;
}

.radio-card input[type="radio"]:checked + .radio-card-content {
    background: linear-gradient(135deg, #e8f4f8, #d6eaf8);
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.radio-card:hover .radio-card-content {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.radio-card-icon {
    font-size: 2em;
    display: block;
}

.radio-card-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-color);
}

.radio-card-icon .truck-icon {
    width: 80px;
    object-fit: contain;
}

.radio-card input[type="radio"]:checked + .radio-card-content .radio-card-icon svg {
    color: var(--secondary-color);
}

.radio-card-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-color);
    display: block;
}

.radio-card input[type="radio"]:checked + .radio-card-content .radio-card-title {
    color: var(--secondary-color);
}

/* Add checkmark to selected card */
.radio-card input[type="radio"]:checked + .radio-card-content::after {
    content: "✓";
    position: absolute;
    top: 5px;
    right: 8px;
    background: var(--secondary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 0.9em;
}

.btn-calculate {
    width: 100%;
    padding: 15px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.btn-calculate:hover {
    background: #2980b9;
}

.btn-calculate:active {
    transform: scale(0.98);
}

.btn-calculate:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.btn-calculate img.ai-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
    margin-top: -2px;
}

/* Status notification bar (floating top-right) */
.status-notification {
    display: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: slideInRight 0.4s ease-out;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    align-items: center;
    max-width: 500px;
    min-width: 280px;
    width: auto;
}

.status-notification::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    vertical-align: middle;
    flex-shrink: 0;
}

.status-notification.info {
    display: flex;
    background: #d6eaf8;
    color: #1a5490;
    border: 2px solid #3498db;
}

.status-notification.info::before {
    content: 'ℹ️';
    font-size: 18px;
}

.status-notification.success {
    display: flex;
    background: #d5f4e6;
    color: #0d5c2e;
    border: 2px solid #27ae60;
}

.status-notification.success::before {
    content: '✓';
    background: #27ae60;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

.status-notification.error {
    display: flex;
    background: #fadbd8;
    color: #7a1e16;
    border: 2px solid #e74c3c;
}

.status-notification.error::before {
    content: '✕';
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
}

.status-notification.warning {
    display: flex;
    background: #fcf3cf;
    color: #7d6608;
    border: 2px solid #f39c12;
}

.status-notification.warning::before {
    content: '⚠';
    font-size: 18px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Legacy status message (remove if not used elsewhere) */
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    display: none;
}

.status-message.info {
    display: block;
    background: #d6eaf8;
    color: #21618c;
    border-left: 4px solid var(--secondary-color);
}

.status-message.success {
    display: block;
    background: #d5f4e6;
    color: #186a3b;
    border-left: 4px solid var(--success-color);
}

.status-message.error {
    display: block;
    background: #fadbd8;
    color: #922b21;
    border-left: 4px solid var(--danger-color);
}

.status-message.warning {
    display: block;
    background: #fcf3cf;
    color: #7d6608;
    border-left: 4px solid var(--warning-color);
    font-weight: 500;
}

.results h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.results h4 {
    margin: 20px 0 10px 0;
    color: var(--secondary-color);
    font-size: 1.1em;
}

.result-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.result-summary p {
    margin: 5px 0;
}

.route-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.route-card h5 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.route-card p {
    margin: 5px 0;
}

.route-card details {
    margin-top: 10px;
}

.route-card summary {
    cursor: pointer;
    color: var(--secondary-color);
    font-weight: 500;
    padding: 5px;
    border-radius: 4px;
}

.route-card summary:hover {
    background: #f8f9fa;
}

.route-card ul {
    margin: 10px 0 0 20px;
}

.route-card li {
    margin: 5px 0;
    font-size: 0.9em;
}

#map {
    flex: 1;
    min-height: 0;
    border-radius: 6px;
    border: 2px solid var(--border-color);
}

/* Map info panel */
.map-info {
    padding: 10px 15px;
    background: white;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--secondary-color);
    min-width: 200px;
}

.map-info h4 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
    font-size: 0.95em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.map-info b {
    color: var(--secondary-color);
    font-size: 1.05em;
}

/* Responsive design */
@media (max-width: 1024px) {
    body {
        overflow: auto;
        height: auto;
    }
    
    .container {
        height: auto;
        overflow: visible;
    }
    
    .content {
        grid-template-columns: 1fr;
        overflow: visible;
    }
    
    .form-section {
        overflow-y: visible;
    }
    
    #map {
        height: 70vh; /* 70% de la altura de la pantalla del dispositivo */
        flex: none;
    }
}

/* Mobile specific styles */
@media (max-width: 768px) {
    header {
        padding: 10px 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-top {
        width: 100%;
        justify-content: center;
    }
    
    .header-logo {
        height: 50px;
    }
    
    .header-subtitle {
        font-size: 0.9em;
        letter-spacing: 0.5px;
        text-align: center;
        width: 100%;
    }
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Route tooltip - remove default Leaflet styles */
.route-tooltip {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.route-tooltip::before {
    display: none !important;
}

.leaflet-tooltip-left.route-tooltip::before,
.leaflet-tooltip-right.route-tooltip::before {
    display: none !important;
}

/* ========================================
   LAYER CONTROL (inside map, top-right)
   ======================================== */
.layer-control-icons {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layer-icon-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.layer-icon-btn svg {
    width: 24px;
    height: 24px;
    color: #666;
    transition: color 0.3s ease;
}

.layer-icon-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(42%) sepia(0%) saturate(0%) hue-rotate(180deg) brightness(96%) contrast(87%);
    transition: filter 0.3s ease;
}

.layer-icon-btn:hover {
    transform: scale(1.05);
    border-color: var(--secondary-color);
}

.layer-icon-btn:hover svg {
    color: var(--secondary-color);
}

.layer-icon-btn:hover img {
    filter: brightness(0) saturate(100%) invert(52%) sepia(98%) saturate(1077%) hue-rotate(175deg) brightness(94%) contrast(86%);
}

.layer-icon-btn[data-active="true"] {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.layer-icon-btn[data-active="true"] svg {
    color: white;
}

.layer-icon-btn[data-active="true"] img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

/* Metric buttons start hidden */
.layer-icon-btn.metric-btn {
    display: none;
}

.layer-icon-btn.metric-btn.visible {
    display: flex;
}

/* Override Leaflet's default border style */
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
    border: none !important;
}

/* ========================================
   SIDE PANEL (right side, slides in/out)
   ======================================== */
.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    right: 0;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    border-bottom: 1px solid #ddd;
}

.side-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.details-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.details-section:last-child {
    border-bottom: none;
}

.details-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.details-section p {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

.details-section ol, .details-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.details-section li {
    margin: 5px 0;
    font-size: 14px;
}

/* ========================================
   POPUPS & TOOLTIPS
   ======================================== */
.popup-content h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #2c3e50;
}

.popup-content p {
    margin: 5px 0;
    font-size: 13px;
}

.popup-content ul {
    margin: 5px 0;
    padding-left: 20px;
}

.popup-content li {
    font-size: 12px;
    margin: 3px 0;
}

.tooltip-content {
    font-size: 12px;
    line-height: 1.4;
}

.tooltip-content strong {
    display: block;
    margin-bottom: 3px;
}

/* ========================================
   FLOATING FORM PANEL (top-left)
   ======================================== */
.floating-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 350px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
}

.panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    opacity: 0.8;
}

.panel-content {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    transition: max-height 0.3s ease;
}

.panel-content.collapsed {
    max-height: 0;
    padding: 0 16px;
    overflow: hidden;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.submit-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.results-stats {
    margin-top: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Route Legend - Styled like map-info */
.route-legend {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    border: 2px solid rgba(0,0,0,0.2);
    z-index: 999;
    font-size: 12px;
    line-height: 1.4;
}

.route-legend-title {
    display: none; /* Hide title */
}

.route-legend-items {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.route-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.route-legend-color {
    width: 20px;
    height: 3px;
    border-radius: 1px;
}

.route-legend-info {
    white-space: nowrap;
}

.route-legend-label {
    display: none; /* Hide "Ruta 1/2/3" labels */
}

.route-legend-stats {
    color: #333;
    font-size: 11px;
    font-weight: 500;
}

.route-legend-revenue {
    color: #059669; /* Green color for revenue */
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

/* Toggle Results Button */
.toggle-results-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toggle-results-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toggle-results-btn svg {
    width: 18px;
    height: 18px;
}

/* Toggle button active state */
.toggle-results-btn[data-active="true"] {
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.toggle-results-btn[data-active="true"]:hover {
    background: var(--primary-hover);
}

/* Desktop Layout - 2 Panels by default, 3 when results shown */
@media (min-width: 769px) {
    /* Default: Hide right panel, use 2-column layout */
    .content {
        grid-template-columns: 350px 1fr;
    }
    
    .right-panel {
        display: none;
    }
    
    .results-panel {
        display: none;
    }
    
    /* When results are active: Show 3 panels */
    .content.has-results {
        grid-template-columns: 350px 1fr 350px;
    }
    
    .content.has-results .right-panel {
        display: flex;
    }
    
    .content.has-results .results-panel {
        display: flex;
    }
    
    /* Show toggle button when results are available */
    .toggle-results-btn.available {
        display: flex;
    }
}

/* Mobile Layout - Stack panels vertically */
@media (max-width: 768px) {
    .content {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .left-panel, .center-panel, .right-panel {
        width: 100%;
        flex: none;
    }
    
    /* Form Section */
    .left-panel {
        order: 1;
    }
    
    .form-section {
        max-height: none;
        overflow-y: visible;
    }
    
    /* Map Section */
    .center-panel {
        order: 2;
        min-height: 500px; /* Aumentado de 400px para más espacio del mapa */
        margin-bottom: 5px; /* Espacio antes del panel de resultados */
    }
    
    .map-section {
        min-height: 450px; /* Aumentado de 350px para más espacio del mapa */
    }
    
    /* Results Section - Hidden by default */
    .right-panel {
        order: 3;
        display: none;
        margin-top: 10px; /* Margen entre mapa y resultados */
    }
    
    .right-panel.active {
        display: flex;
    }
    
    .results-panel {
        display: flex;
        max-height: 60vh;
        min-height: 200px;
    }
    
    .results-panel .results {
        overflow-y: auto;
    }
    
    /* Hide toggle button on mobile */
    .toggle-results-btn {
        display: none !important;
    }
    
    /* Responsive form elements */
    .radio-cards {
        flex-direction: column;
        gap: 10px;
    }
    
    .radio-card {
        flex: 1;
        min-width: auto;
    }
}

/* Candidates list in side panel */
.candidates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 4px;
}

.candidates-list::-webkit-scrollbar {
    width: 8px;
}

.candidates-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.candidates-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.candidates-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.candidate-item {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.candidate-name {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.candidate-metrics {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.candidate-metric {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.candidate-metric img,
.candidate-metric svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.candidate-metric span {
    font-weight: 500;
}

/* Candidate details view */
.candidate-details,
.route-details {
    padding: 8px 0;
}

.candidate-details h4,
.route-details h4 {
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.details-section {
    margin-bottom: 20px;
}

.details-section h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.details-section p {
    margin: 8px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.details-section ol {
    margin: 0;
    padding-left: 20px;
}

.details-section li {
    margin: 4px 0;
    font-size: 14px;
    color: #333;
}
