/* ==========================================================================
   PASIONES.ONLINE - 100% ESTÁTICO (NO PEGA NI TAPA EN IPHONE / ANDROID / PC)
   ========================================================================== */

:root {
    --primary: #d6004c;
    --primary-dark: #b0003e;
    --primary-light: #fff0f5;
    --secondary: #1a2a3a;
    --gold: #f59e0b;
    --gold-bg: #fffdf5;
    --gold-border: #f59e0b;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --bg-gray: #f1f5f9;
    --border-color: #cbd5e1;
    --whatsapp-green: #25d366;
    --whatsapp-dark: #128c7e;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* iOS & Mobile Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* iOS Input & Select Fixes (No Auto-Zoom, Clean Look) */
input, select, textarea, button {
    font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 6px;
}

/* HEADER ESTÁTICO (NO STICKY - NO TAPA EN MÓVIL AL HACER SCROLL) */
.main-header {
    background: #ffffff;
    border-bottom: 2px solid var(--primary);
    position: relative; /* Normal document flow */
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo-area {
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 26px;
    font-weight: 900;
    color: var(--secondary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.logo-dot {
    color: var(--primary);
}

.logo-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle-search {
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1.5px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-toggle-search:hover, .btn-toggle-search.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #fbcfe8;
}

.btn-my-ads {
    background: #1e293b;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-my-ads:hover {
    background: #334155;
}

.btn-publish {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 13px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-publish:hover {
    background: var(--primary-dark);
}

.free-badge {
    background: #fde047;
    color: #000;
    font-size: 10px !important;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 900;
}

/* PASION.COM DESPLEGABLE DE BÚSQUEDA */
.pasion-search-bar {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.pasion-search-bar.closed {
    display: none;
}

.pasion-search-container {
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 180px 180px 180px 1fr 120px;
    gap: 10px;
    align-items: flex-end;
}

.search-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-field-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.search-field-group select, .search-field-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--border-color);
    background: white;
    font-size: 13.5px !important;
    color: var(--text-dark);
    height: 40px;
}

.search-field-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px;
    cursor: pointer;
}

.search-field-group select:focus, .search-field-group input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(214, 0, 76, 0.15);
}

.btn-pasion-search {
    background: var(--primary);
    color: white;
    border: none;
    height: 40px;
    font-weight: 900;
    font-size: 14px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.btn-pasion-search:hover {
    background: var(--primary-dark);
}

/* MAIN LAYOUT */
.main-content-layout {
    max-width: 1300px;
    margin: 18px auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 20px;
}

/* SIDEBAR ACCORDION */
.sidebar-box {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--secondary);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.province-accordion {
    list-style: none;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.province-item {
    border-bottom: 1px solid #f1f5f9;
}

.province-header {
    padding: 8px 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    border-radius: 4px;
    font-weight: 600;
}

.province-header:hover, .province-header.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
}

.city-sublist {
    list-style: none;
    padding: 4px 0 6px 14px;
    background: #f8fafc;
    border-radius: 4px;
    margin: 2px 0 6px 0;
    display: none;
}

.city-sublist.open {
    display: block;
}

.city-item {
    padding: 5px 8px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-radius: 4px;
}

.city-item:hover, .city-item.active {
    color: var(--primary);
    background: #ffe4e6;
    font-weight: 700;
}

.sidebar-banner {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

.sidebar-banner h4 {
    font-size: 13px;
    margin-bottom: 4px;
    color: #fbbf24;
}

.sidebar-banner p {
    font-size: 11.5px;
    color: #cbd5e1;
    margin-bottom: 12px;
    line-height: 1.4;
}

.btn-vip-banner {
    background: var(--gold);
    color: #111;
    font-weight: 800;
    border: none;
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 12px !important;
    cursor: pointer;
    width: 100%;
}

/* FEED SECTION */
.feed-header {
    background: white;
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.feed-title-box h1 {
    font-size: 18px;
    font-weight: 800;
    color: var(--secondary);
}

.count-badge {
    font-size: 12px;
    color: var(--text-muted);
}

.feed-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.feed-sort select {
    padding: 4px 8px;
    font-size: 12px !important;
    background: white;
    border: 1px solid var(--border-color);
}

/* VIP SHOWCASE GRID */
.vip-showcase {
    background: var(--gold-bg);
    border: 2px solid var(--gold-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 18px;
}

.vip-header-tag {
    font-size: 12px;
    font-weight: 900;
    color: #b45309;
    margin-bottom: 10px;
}

.vip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.vip-card {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #fde68a;
    display: flex;
    flex-direction: column;
}

.vip-card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #000;
}

.vip-card-body {
    padding: 10px;
    flex: 1;
}

.vip-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vip-card-loc {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* ADS LIST */
.ads-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ad-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.ad-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.ad-card.is-vip {
    background: #fffdf5;
    border: 2px solid var(--gold-border);
}

.ad-thumb-box {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    height: 140px;
    background: #000;
}

.ad-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vip-badge-ribbon {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--gold);
    color: #000;
    font-size: 10px !important;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
}

.ad-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ad-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 2px;
    line-height: 1.3;
}

.ad-price-pill {
    background: #f1f5f9;
    color: #334155;
    font-weight: 800;
    font-size: 12px !important;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.ad-location {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.ad-description {
    font-size: 13px;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ad-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border-color);
    padding-top: 8px;
}

.btn-phone {
    background: var(--secondary);
    color: white;
    text-decoration: none;
    font-size: 12px !important;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
}

.btn-wa {
    background: var(--whatsapp-green);
    color: white;
    text-decoration: none;
    font-size: 12px !important;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    min-height: 32px;
}

.btn-bump {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 11px !important;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    min-height: 28px;
}

/* PAGINATION */
.pagination {
    margin: 24px 0;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.page-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px !important;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: white;
    border-radius: 12px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
}

.btn-submit-ad {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 15px !important;
    font-weight: 800;
    cursor: pointer;
    margin-top: 10px;
    min-height: 44px;
}

/* FLOATING ANONYMOUS SUPPORT BUTTON */
.floating-support-btn {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    background: #0f172a;
    color: #38bdf8;
    border: 2px solid #38bdf8;
    padding: 10px 16px;
    border-radius: 25px;
    font-weight: 800;
    font-size: 12px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 999;
    min-height: 42px;
}

/* FOOTER */
.main-footer {
    background: var(--secondary);
    color: #94a3b8;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)) 16px;
    text-align: center;
    font-size: 12px;
    margin-top: 40px;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE BREAKPOINTS (IOS / SAFARI / ANDROID)
   ========================================================================== */

@media (max-width: 992px) {
    .pasion-search-container {
        grid-template-columns: 1fr 1fr;
    }
    .search-text-input {
        grid-column: span 2;
    }
    .btn-pasion-search {
        grid-column: span 2;
    }
    .main-content-layout {
        grid-template-columns: 1fr;
    }
    .sidebar-provinces {
        display: none;
    }
}

@media (max-width: 640px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header-actions {
        display: grid;
        grid-template-columns: 1.2fr 1fr 1fr;
        gap: 6px;
    }
    .btn-toggle-search, .btn-my-ads, .btn-publish {
        justify-content: center;
        padding: 7px 6px;
        font-size: 11.5px !important;
    }
    .btn-text {
        font-size: 11px;
    }
    .pasion-search-container {
        grid-template-columns: 1fr;
    }
    .search-text-input {
        grid-column: span 1;
    }
    .btn-pasion-search {
        grid-column: span 1;
    }
    .ad-card {
        grid-template-columns: 1fr;
    }
    .ad-thumb-box {
        height: 180px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .vip-grid {
        grid-template-columns: 1fr 1fr;
    }
}
