/* Transporte Page Specific Styles */

html,
body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.page-transporte {
    display: flex;
    flex-direction: column;
    background-color: #f4f6f8;
}

/* Main Layout Container */
.container-fluid {
    width: 100%;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

/* Top Controls Section */
.top-controls {
    width: 90%;
    max-width: 1200px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
}

.section-title {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
    border-bottom: 2px solid #eef2f7;
    padding-bottom: 10px;
}

.search-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
    font-size: 1rem;
}

.search-box input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.button-group {
    display: flex;
    gap: 15px;
}

/* Enhanced Button Styles */
.btn-action {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #4f46e5;
    /* Indigo primary */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-action:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.btn-action.btn-secondary {
    background-color: #ffffff;
    color: #64748b;
    border: 1px solid #cbd5e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-action.btn-secondary:hover {
    background-color: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

/* Route List */
.route-list {
    width: 90%;
    max-width: 1200px;
    height: 275px;
    min-height: 150px;
    overflow-y: auto;
    border: 1px solid #eef2f7;
    background: #ffffff;
    margin-bottom: 20px;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f5f9;
}

.route-list::-webkit-scrollbar {
    width: 8px;
}

.route-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.route-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 4px;
}

/* Map Container */
.map-container {
    width: 90%;
    max-width: 1200px;
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    background: #e2e8f0;
}

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

/* Controls Row */
.controls-row {
    width: 90%;
    max-width: 1200px;
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.gradient-legend-control {
    background: #ffffff;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    flex: 1;
    min-width: 250px;
    animation: fadeIn 0.3s ease;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Thickness Control Styling */
.thickness-control,
.map-switcher {
    background: #ffffff;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    flex: 1;
}

.thickness-control input[type="range"],
.map-switcher select {
    width: 100%;
    max-width: 300px;
    cursor: pointer;
}

.map-switcher select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    font-family: inherit;
    font-size: 0.95rem;
    color: #1e293b;
    background: #f8fafc;
}

.thickness-control label,
.map-switcher label {
    font-weight: 600;
    color: #475569;
    font-size: 1rem;
}

/* Date Filter Styling */
.date-filter-control {
    width: 90%;
    max-width: 1200px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #eef2f7;
    padding-bottom: 8px;
}

.date-inputs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.date-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
}

.date-group input[type="date"] {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.date-group input[type="date"]:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.date-group input[type="date"]:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: #ffffff;
}

/* Calendar icon styling for webkit browsers */
.date-group input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.date-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Info Panel Styling (Bottom) */
.info-panel {
    width: 90%;
    max-width: 1200px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-sizing: border-box;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.info-panel h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.info_item {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #475569;
    display: flex;
    justify-content: space-between;
}

.info_label {
    font-weight: 600;
    color: #64748b;
}

.info_value {
    font-weight: 500;
    color: #1e293b;
    text-align: right;
}

.average-warning {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #b45309;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Route Items Aesthetics */
.route-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.route-item:hover {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.route-item.active {
    background-color: #eef2ff;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.route-item input[type="checkbox"] {
    display: none;
}

.route-color-indicator {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.route-item label {
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #334155;
    font-weight: 600;
    flex: 1;
}

.route-item.active label {
    color: #4f46e5;
}

.route-item label div {
    font-weight: normal;
    margin-top: 2px;
    font-size: 0.8rem;
    font-style: italic;
    color: #64748b;
}

/* Horizontal Stats in Info Panel */
.horizontal-stats-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 5px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.stat-val {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
}

.stat-lab {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
    margin-top: 2px;
}

/* Share URL Text */
.url-display-text {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #94a3b8;
    font-style: italic;
    font-family: 'Segoe UI', serif;
    /* Fallback to serif for slight diff if needed, but requested slant */
    text-align: center;
    word-break: break-all;
    transform: skewX(-5deg);
    /* "inclinado a la derecha" extra emphasis */
}

/* Numeralia Section */
.numeralia-section {
    width: 100%;
    background: #ffffff;
    border-top: 1px solid #eef2f7;
    padding: 30px 0;
    margin-top: 20px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.numeralia-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.numeralia-title {
    text-align: center;
    color: #334155;
    font-size: 1.4rem;
    margin-bottom: 25px;
    font-weight: 700;
}

.numeralia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    text-align: center;
}

.numeralia-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.numeralia-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: #4f46e5;
    margin-bottom: 5px;
}

.numeralia-label {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* Footer handling */
.main-footer {
    margin-top: auto;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px 0;
        align-items: flex-start;
        /* Align left */
    }

    .top-controls,
    .route-list,
    .map-container,
    .thickness-control,
    .date-filter-control,
    .info-panel,
    .controls-row {
        width: 90%;
        margin-left: 15px;
        /* Fixed small margin from left */
        margin-right: auto;
        /* Space on right */
    }

    /* Stack controls on mobile */
    .controls-row {
        flex-direction: column;
    }

    /* Order: Legend (if visible), then Thickness, then Map Switcher */
    .gradient-legend-control {
        order: -1;
        /* "arriba de Grosor de línea" */
        width: 100%;
    }


    .search-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .button-group {
        flex-direction: row;
    }

    .button-group .btn-action {
        flex: 1;
        /* Equal width buttons on mobile if row */
        text-align: center;
    }

    .map-container {
        height: 50vh;
        min-height: 400px;
    }

    .route-list {
        height: 225px;
    }
}

/* Refresh Cache Button */
.refresh-cache-container {
    text-align: right;
    width: 100%;
    margin-top: 15px;
    padding-bottom: 5px;
}

.btn-refresh-cache {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.7rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.6;
    transition: all 0.2s ease;
    font-style: italic;
    font-family: 'Segoe UI', serif;
    display: inline-block;
    transform: skewX(-5deg);
    /* "inclinado a la derecha" */
}

.btn-refresh-cache:hover {
    opacity: 1;
    color: #64748b;
    transform: skewX(-5deg) translateY(-1px);
}