/* Home page specific styles */
:root {
    --home-bg: #f5f7fb;
    --home-primary: #2563eb;
    --home-primary-dark: #1d4ed8;
    --home-accent: #facc15;
    --home-text: #1f2937;
    --home-muted: #6b7280;
    --home-border: #e5e7eb;
}

.home {
    background: var(--home-bg);
    color: var(--home-text);
    padding-bottom: 48px;
}

/* Buscador destacado unificado - Diseño limpio y profesional */
.home-featured-search {
    background: #ffffff;
    padding: 60px 24px 48px;
    margin-bottom: 0;
}

.home-featured-search__container {
    max-width: 1200px;
    margin: 0 auto;
}

.home-featured-search__title {
    text-align: center;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 40px 0;
    line-height: 1.2;
}

.home-featured-search__form {
    max-width: 1100px;
    margin: 0 auto;
}

.home-featured-search__wrapper {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    min-height: 64px;
}

.home-featured-search__field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: #ffffff;
    position: relative;
    min-height: 64px;
}

.home-featured-search__field:first-child {
    flex: 1.4;
}

.home-featured-search__field:not(:last-child):not(.home-featured-search__submit) {
    border-right: 1px solid #e0e0e0;
}

.home-featured-search__field i:first-child {
    color: #757575;
    font-size: 1rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.home-featured-search__field input,
.home-featured-search__field select {
    flex: 1;
    border: none;
    background: transparent;
    color: #1a1a1a;
    font-size: 1rem;
    padding: 0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 0;
    font-weight: 400;
}

.home-featured-search__field input::placeholder {
    color: #9e9e9e;
}

.home-featured-search__field--select {
    position: relative;
    cursor: pointer;
}

.home-featured-search__field--select select {
    cursor: pointer;
    padding-right: 32px;
    color: #1a1a1a;
    background-image: none;
}

.home-featured-search__field--select select:focus {
    outline: none;
}

.home-featured-search__field--select select {
    cursor: pointer;
    padding-right: 32px;
    color: #1a1a1a;
}

.home-featured-search__field--select select:invalid {
    color: #9e9e9e;
}

.home-featured-search__chevron {
    position: absolute;
    right: 20px;
    color: #9e9e9e;
    font-size: 0.7rem;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
}

.home-featured-search__field--select input {
    padding-right: 32px;
    cursor: pointer;
}

/* Estilos para Modal de Provincias (reutilizado de search/results.php) */
.location-modal {
    position: fixed !important;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 16px;
}

.location-modal[aria-hidden="false"],
.location-modal.show {
    display: flex !important;
}

.location-modal-backdrop {
    position: fixed !important;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99998 !important;
}

.location-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999 !important;
}

.location-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.location-modal-back {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.location-modal-back:hover {
    background: #f3f4f6;
}

.location-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

.location-modal-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #e9ecef;
    gap: 0;
}

.location-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.location-tab.active {
    color: #00b487;
    border-bottom-color: #00b487;
}

.location-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.location-tab-content {
    display: none;
}

.location-tab-content.active {
    display: block;
}

#locationMapContainer {
    width: 100% !important;
    min-width: 100% !important;
    height: 400px !important;
    min-height: 400px !important;
    max-height: 400px !important;
    position: relative !important;
    overflow: hidden !important;
    background-color: #f0f0f0 !important;
}

#locationMapContainer .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
}

.location-tab-content.active #locationMapContainer {
    display: block !important;
    visibility: visible !important;
}

.location-search-bar {
    position: relative;
    margin-bottom: 16px;
    z-index: 1001;
}

.location-search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.location-search-bar input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: 1px solid #e2e4e9;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.location-search-bar input:focus {
    outline: none;
    border-color: #00b487;
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    z-index: 10;
    transition: color 0.2s ease;
}

.clear-search-btn:hover {
    color: #6b7280;
    background-color: #f3f4f6;
}

.location-distance-slider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.location-distance-slider span {
    font-size: 14px;
    color: #6b7280;
    min-width: 60px;
}

.location-distance-slider input[type="range"] {
    flex: 1;
    height: 4px;
    background: #e2e4e9;
    border-radius: 2px;
    outline: none;
}

.location-distance-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #00b487;
    border-radius: 50%;
    cursor: pointer;
}

.apply-location-filter-btn {
    width: 100%;
    padding: 14px 20px;
    background: #00b487;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.apply-location-filter-btn:hover {
    background: #00a077;
}

.location-suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e4e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0;
}

.location-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.location-suggestion-item:hover {
    background: #f9fafb;
}

.location-suggestion-item i {
    color: #9ca3af;
}

.location-suggestion-text {
    flex: 1;
    font-size: 16px;
    color: #1f2937;
}

.location-suggestion-type {
    font-size: 12px;
    color: #6b7280;
}

.home-featured-search__submit {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 0 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    min-width: 140px;
    min-height: 64px;
}

.home-featured-search__submit:hover {
    background: #1d4ed8;
}

.home-featured-search__submit:active {
    background: #1e40af;
}

.home-featured-search__submit i {
    font-size: 1rem;
}

.home-featured-search__submit span {
    font-weight: 600;
}

@media (max-width: 1024px) {
    .home-featured-search {
        padding: 48px 20px 40px;
    }
    
    .home-featured-search__title {
        font-size: clamp(1.75rem, 3vw, 2.5rem);
        margin-bottom: 32px;
    }
    
    .home-featured-search__wrapper {
        flex-wrap: wrap;
    }
    
    .home-featured-search__field {
        flex: 1 1 calc(50% - 1px);
        min-height: 60px;
    }
    
    .home-featured-search__field:nth-child(2n):not(.home-featured-search__submit) {
        border-right: none;
    }
    
    .home-featured-search__submit {
        flex: 1 1 100%;
        border-top: 1px solid #e0e0e0;
        min-height: 60px;
    }
}

@media (max-width: 768px) {
    .home-featured-search {
        padding: 40px 18px 32px;
    }
    
    .home-featured-search__title {
        font-size: 1.875rem;
        margin-bottom: 28px;
    }
    
    .home-featured-search__wrapper {
        flex-direction: column;
    }
    
    .home-featured-search__field {
        flex: 1 1 100%;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0;
        min-height: 56px;
    }
    
    .home-featured-search__field:last-of-type:not(.home-featured-search__submit) {
        border-bottom: none;
    }
    
    .home-featured-search__submit {
        flex: 1 1 100%;
        border-top: 1px solid #e0e0e0;
        min-height: 56px;
    }
}

@media (max-width: 480px) {
    .home-featured-search {
        padding: 32px 16px 24px;
    }
    
    .home-featured-search__title {
        font-size: 1.5rem;
        margin-bottom: 24px;
    }
    
    .home-featured-search__field {
        min-height: 52px;
        padding: 0 16px;
    }
    
    .home-featured-search__submit {
        min-height: 52px;
        padding: 0 24px;
    }
}

.home section {
    margin: 0 auto;
    max-width: 1200px;
    padding: 48px 24px;
}

.home-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 32px;
    margin-top: 24px;
}

.home-hero__content {
    flex: 1 1 520px;
    background: linear-gradient(150deg, var(--home-primary) 0%, var(--home-primary-dark) 100%);
    color: #fff;
    border-radius: 24px;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.home-hero__content::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.25), transparent 55%);
    pointer-events: none;
}

.home-hero__content h1 {
    position: relative;
    font-size: clamp(2rem, 3vw + 1rem, 3rem);
    font-weight: 700;
    margin-bottom: 16px;
    z-index: 1;
}

.home-hero__content p {
    position: relative;
    font-size: 1.05rem;
    margin-bottom: 32px;
    opacity: 0.9;
    z-index: 1;
}

.home-search {
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 32px;
    backdrop-filter: blur(6px);
}

.home-search__row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.home-search__field {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    padding: 0 16px;
    color: var(--home-muted);
}

.home-search__field i {
    font-size: 1rem;
}

.home-search__field input,
.home-search__field select {
    background: transparent;
    border: none;
    color: var(--home-text);
    font-size: 0.95rem;
    width: 100%;
    padding: 16px 0;
}

.home-search__field input:focus,
.home-search__field select:focus {
    outline: none;
}

.home-search__submit {
    border: none;
    border-radius: 12px;
    background: #fff;
    color: var(--home-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-search__submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
}

.home-hero__stats {
    display: flex;
    gap: 24px;
    z-index: 1;
    position: relative;
    margin-top: 12px;
}

.home-stat {
    flex: 1;
    background: rgba(255,255,255,0.12);
    border-radius: 16px;
    text-align: center;
    padding: 20px 12px;
}

.home-stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
}

.home-stat span {
    font-size: 0.9rem;
    opacity: 0.85;
}

.home-hero__promo {
    flex: 1 1 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-publish-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 18px 36px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    white-space: nowrap;
}

.home-publish-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    color: #ffffff;
}

.home-publish-btn i {
    font-size: 1.2rem;
}

.home-quick-categories {
    padding-top: 0;
    width: 100%;
}

.home-quick-categories-nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.home-quick-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--home-border);
    border-radius: 16px;
    padding: 18px 12px;
    color: var(--home-text);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-quick-category i {
    font-size: 1.3rem;
    color: var(--home-primary);
}

.home-quick-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.home-carousel {
    background: transparent;
}

.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.home-section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.home-section-link {
    text-decoration: none;
    color: var(--home-primary);
    font-weight: 600;
}

.home-section-link:hover {
    text-decoration: underline;
}

.home-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.home-carousel__viewport {
    position: relative;
    display: flex;
    align-items: center;
}

.home-carousel__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
    overscroll-behavior-x: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.home-carousel__track::-webkit-scrollbar {
    display: none;
}

.home-carousel__track.is-dragging {
    scroll-snap-type: none;
    cursor: grabbing;
}

.home-carousel__control {
    border: none;
    background: #fff;
    color: var(--home-primary);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin: 0 8px;
}

.home-carousel__control:hover {
    transform: translateY(-2px);
}

.home-carousel__control i {
    font-size: 1.25rem;
}

.home-card {
    flex: 0 0 260px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    scroll-snap-align: start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-card--featured {
    border: 2px solid rgba(37, 99, 235, 0.25);
}

.home-card--premium {
    border: 3px solid #FFD700;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3), 0 12px 30px rgba(15, 23, 42, 0.12);
    position: relative;
    overflow: visible;
}

.home-card--premium::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
    border-radius: 20px;
    z-index: -1;
    opacity: 0.3;
    animation: premium-glow 3s ease-in-out infinite;
}

@keyframes premium-glow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
    }
}

.home-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.home-card__media {
    position: relative;
    height: 180px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-card__placeholder {
    color: var(--home-muted);
    font-size: 2rem;
}

.home-card__price {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(37,99,235,0.95);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
}

.home-card__badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(250,204,21,0.95);
    color: #b45309;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.home-card__badge--premium {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 8px 14px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: premium-pulse 2s ease-in-out infinite;
}

.home-card__badge--premium i {
    font-size: 0.9rem;
    color: #000;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

@keyframes premium-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 4px 16px rgba(255, 215, 0, 0.8);
    }
}

.home-card__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-card__category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--home-muted);
    letter-spacing: 0.04em;
}

.home-card__title {
    font-size: 1rem;
    margin: 0;
    color: var(--home-text);
    line-height: 1.35;
}

.home-card__meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--home-muted);
}

.home-empty {
    text-align: center;
    background: #fff;
    border-radius: 20px;
    padding: 48px 32px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.home-empty i {
    font-size: 2rem;
    color: var(--home-primary);
    margin-bottom: 12px;
}

.home-goals__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.home-goal {
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.home-goal__icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin: 0 auto 16px;
    background: rgba(37,99,235,0.08);
    color: var(--home-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.home-goal h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.home-goal p {
    font-size: 0.95rem;
    color: var(--home-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 12px 22px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: var(--home-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--home-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #1f2937;
    color: #fff;
}

@media (max-width: 1024px) {
    .home-search__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-hero__stats {
        flex-direction: column;
    }

    .home-carousel__control {
        display: none;
    }
}

@media (max-width: 768px) {
    .home section {
        padding: 36px 18px;
    }

    .home-hero__content {
        padding: 32px;
    }

    .home-hero__promo {
        flex: 1 1 100%;
        margin-top: 24px;
    }
    
    .home-publish-btn {
        width: 100%;
        padding: 16px 32px;
    }

    .home-search__row {
        grid-template-columns: 1fr;
    }

    .home-quick-categories-nav {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .home-card {
        flex-basis: 220px;
    }
}

@media (max-width: 480px) {
    .home section {
        padding: 28px 16px;
    }

    .home-hero__content {
        padding: 28px;
    }

    .home-hero__stats {
        gap: 16px;
    }

    .home-card {
        flex-basis: 200px;
    }
}
