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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: slideDown 0.6s ease-out;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

main {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    animation: slideUp 0.6s ease-out;
}

.search-section {
    margin-bottom: 40px;
}

.search-input-group {
    margin-bottom: 30px;
}

.search-input-group label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.extra-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
}

.extra-filters label {
    font-weight: 600;
    color: #333;
}

.fuel-select {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.95rem;
    color: #333;
    background: white;
}

#use-location-btn {
    background: #34a853;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: 0.25s ease;
}

#use-location-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(52, 168, 83, 0.3);
}

.location-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.location-status.activado {
    color: #34a853;
}

.location-status.error {
    color: #e74c3c;
}

#city-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 18px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

#city-input:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#city-input::placeholder {
    color: #999;
}

.btn-primary {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.suggestions {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.suggestions-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.city-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.city-btn {
    padding: 8px 16px;
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.city-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.city-btn:active {
    transform: translateY(0);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background-color: #f0f2f5;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    margin-top: 30px;
    flex-wrap: wrap;
}

.sort-options.hidden {
    display: none;
}

.sort-label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sort-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 8px 16px;
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sort-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.sort-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.results-container {
    margin-top: 30px;
}

.map {
    width: 100%;
    height: 300px;
    border-radius: 15px;
    margin-top: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.map.hidden {
    display: none;
    height: 0;
    margin: 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.pagination.hidden {
    display: none;
}

.page-btn {
    padding: 8px 14px;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: .2s ease;
}

.page-btn:hover {
    background-color: #667eea;
    color: white;
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-info {
    font-weight: 700;
    color: #333;
}


.station-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    animation: fadeIn 0.5s ease-out;
}

.station-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.station-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
}

.favorite-btn {
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: #ccc;
    cursor: pointer;
}

.favorite-btn.favorito {
    color: #ffb800;
}

.station-card {
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    animation: fadeIn 0.5s ease-out;
}

.station-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.station-address {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.price-group {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.price-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.price-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #667eea;
    font-weight: 600;
}

.error-message {
    background-color: #fee;
    border: 2px solid #f88;
    border-radius: 8px;
    padding: 15px 20px;
    color: #c33;
    margin-top: 20px;
    font-weight: 500;
}

.error-message.hidden {
    display: none;
}

.filter-banner {
    background: linear-gradient(90deg, #0078d7, #00b4d8);
    color: #fff;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
    box-shadow: 0 1px 8px rgba(0,0,0,0.18);
}

.filter-banner.hidden {
    display: none;
}

/* ===== ESTILOS PARA LA LISTA DE GASOLINERAS ===== */

.stations-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 8px;
}

@media (max-width: 768px) {
    .stations-list {
        grid-template-columns: 1fr;
    }
}

.station-list-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    position: relative;
}

.station-list-item:hover {
    background: linear-gradient(135deg, #f0f2f5 0%, #e8eaed 100%);
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.station-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.station-list-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    flex: 1;
    margin-right: 10px;
}

.station-list-price {
    font-weight: 700;
    color: #2e7d32;
    font-size: 1rem;
    background: rgba(46, 125, 50, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.station-list-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
}

.station-list-address {
    flex: 1;
    margin-right: 10px;
}

.station-list-distance {
    color: #1976d2;
    font-weight: 500;
}

/* ===== ESTILOS PARA EL MODAL DE DETALLES ===== */

.station-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.station-detail-modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.station-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.station-detail-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-detail-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-detail-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.station-detail-content {
    padding: 20px 24px;
}

.station-card-detail {
    margin: 0;
    box-shadow: none;
    border: none;
    animation: none;
}

.station-actions {
    margin-top: 20px;
    text-align: center;
}

.center-map-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.center-map-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.center-map-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== ANIMACIONES ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Animaciones */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 25px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    #city-input {
        min-width: 100%;
    }

    .results-container {
        /* Sin restricciones de grid para permitir que .stations-list controle el layout */
    }

    .city-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 15px;
        border-radius: 10px;
    }

    .extra-filters {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
    }

    /* Grupo del combustible: label y select en la misma línea, centrados */
    .extra-filters label {
        display: inline-block;
        font-weight: 600;
        color: #333;
        margin-right: 8px;
        margin-bottom: 0;
        vertical-align: middle;
    }

    .extra-filters .fuel-select {
        display: inline-block;
        margin: 0;
        max-width: 150px;
        vertical-align: middle;
    }

    /* Centrar el grupo de combustible */
    .extra-filters > label + .fuel-select {
        display: inline-block;
    }

    /* Para centrar el grupo completo */
    .extra-filters {
        text-align: center;
    }

    /* Botón de ubicación centrado */
    .extra-filters #use-location-btn {
        display: block;
        margin: 0 auto;
        width: auto;
        min-width: 180px;
    }

    /* Status de ubicación centrado */
    .extra-filters .location-status {
        display: block;
        text-align: center;
        margin-top: 8px;
        font-size: 0.85rem;
        width: 100%;
    }

    .city-buttons {
        flex-direction: column;
    }

    .city-btn {
        width: 100%;
        text-align: center;
    }
}
