/*
 * Interlomas Online - Feed, favoritos y cuentas de cliente
 * Solo usa variables del tema (interlomas.css).
 */

/* ==========================================
   AVISOS (toast)
   ========================================== */
.io-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1100;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--invert-bg);
    color: var(--invert-text);
    box-shadow: var(--menu-shadow);
    font-size: 14px;
}

.io-toast[hidden] { display: none; }

.io-toast button {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* ==========================================
   ACCESO DE CLIENTES
   ========================================== */
.acceso-page [hidden] { display: none !important; }

.acceso-page { padding-top: 32px; }

.acceso-wrap {
    display: flex;
    justify-content: center;
}

.acceso-card { width: min(460px, 100%); }

.acceso-title {
    margin: 6px 0 8px;
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--heading);
}

.acceso-sub {
    margin: 0 0 20px;
    color: var(--body);
}

.acceso-error,
.form-error {
    display: block;
    margin: 6px 0 12px;
    color: var(--danger);
    font-size: 14px;
}

.acceso-codigo {
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: 0.4em;
    text-align: center;
}

.acceso-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tel-field {
    display: grid;
    grid-template-columns: minmax(0, 170px) 1fr;
    gap: 8px;
}

.acceso-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 8px 0 4px;
    color: var(--body);
    font-size: 14px;
}

.acceso-check input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.acceso-check a { color: var(--accent-ink); }

.header-account .header-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legal-page { max-width: 760px; }

/* ==========================================
   FEED DE PROPIEDADES
   ========================================== */
.feed-page {
    padding-top: 24px;
    padding-bottom: 96px;
}

.feed-page [hidden] { display: none !important; }

.feed-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.feed-title {
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 36px);
    color: var(--heading);
}

.feed-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.feed-chips::-webkit-scrollbar { display: none; }

.feed-chip {
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid var(--ghost-border);
    border-radius: 999px;
    background: var(--chip);
    color: var(--chip-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
}

.feed-chip:hover { border-color: var(--accent); }

.feed-chip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--ink);
}

.feed-more {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* Selector de vista */
.view-switch {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--ghost-border);
    border-radius: 14px;
    background: var(--ghost-bg);
}

.view-switch-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.view-switch-btn.is-active {
    background: var(--chip);
    color: var(--heading);
    box-shadow: var(--lift-shadow);
}

/* Listas */
.posts--feed {
    display: grid;
    gap: 28px;
    max-width: 560px;
    margin: 0 auto;
}

.posts--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

@media (min-width: 768px) {
    .posts--grid { gap: 12px; }
}

/* Publicación */
.post {
    overflow: hidden;
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    background: var(--surface);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.post.is-removing {
    opacity: 0.35;
    transform: scale(0.98);
}

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.post-avatar {
    width: 34px;
    height: 34px;
    padding: 4px;
    border-radius: 50%;
    background: var(--bg);
    object-fit: contain;
}

.post-head strong {
    display: block;
    color: var(--heading);
    font-size: 14px;
}

.post-head span {
    color: var(--muted);
    font-size: 13px;
}

.post-media {
    position: relative;
    aspect-ratio: 4 / 5;
    background: var(--field);
}

.post-swiper,
.post-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.post-swiper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
}

.post-swiper .swiper-pagination-bullet {
    background: var(--on-photo);
    opacity: 0.6;
}

.post-swiper .swiper-pagination-bullet-active {
    background: var(--accent);
    opacity: 1;
}

.post-badge,
.post-vendida {
    position: absolute;
    top: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.post-badge {
    left: 12px;
    background: var(--accent);
    color: var(--ink);
}

.post-badge.is-rent {
    background: var(--invert-bg);
    color: var(--invert-text);
}

.post-vendida {
    right: 12px;
    background: var(--danger);
    color: var(--on-photo);
}

.post-heart-burst {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    color: var(--on-photo);
    opacity: 0;
    pointer-events: none;
}

.post-heart-burst svg {
    fill: currentColor;
    filter: drop-shadow(0 6px 18px var(--shadow-burst));
}

.post-heart-burst.is-on { animation: io-corazon 0.8s var(--ease-out); }

@keyframes io-corazon {
    0% { opacity: 0; transform: scale(0.4); }
    15% { opacity: 1; transform: scale(1.15); }
    30% { transform: scale(0.95); }
    45% { transform: scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: scale(1); }
}

.post-grid-overlay { display: none; }

.post-body { padding: 10px 16px 18px; }

.post-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: -10px;
}

.post-like,
.post-share {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--heading);
    cursor: pointer;
}

.post-like svg { transition: transform 0.2s var(--ease-out); }
.post-like[aria-pressed="true"] { color: var(--danger); }
.post-like[aria-pressed="true"] svg { fill: currentColor; }
.post-like.is-pop svg { transform: scale(1.25); }

.post-more {
    margin-left: auto;
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.post-likes {
    margin: 2px 0 6px;
    color: var(--heading);
    font-size: 14px;
}

.post-price {
    margin: 0;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--heading);
}

.post-price span {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--muted);
}

.post-title {
    margin: 4px 0;
    font-size: 16px;
}

.post-title a {
    color: var(--text);
    text-decoration: none;
}

.post-features {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* Cuadrícula: solo la foto con precio y ❤️ */
.posts--grid .post {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.posts--grid .post-head,
.posts--grid .post-body,
.posts--grid .swiper-pagination { display: none; }

.posts--grid .post-media { aspect-ratio: 1; }

.posts--grid .post-badge,
.posts--grid .post-vendida {
    top: 8px;
    padding: 2px 8px;
    font-size: 10px;
}

.posts--grid .post-badge { left: 8px; }
.posts--grid .post-vendida { right: 8px; }

.posts--grid .post-grid-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    padding: 28px 10px 8px;
    background: linear-gradient(transparent, var(--scrim));
    color: var(--on-photo);
    font-size: 13px;
}

.posts--grid .post-grid-overlay svg {
    fill: currentColor;
    vertical-align: -2px;
}

@media (max-width: 575px) {
    .posts--grid .post-badge { display: none; }
    .posts--grid .post-grid-overlay {
        padding: 20px 6px 5px;
        font-size: 11px;
    }
}

/* Compartir */
.share-menu {
    position: absolute;
    top: 44px;
    left: 40px;
    z-index: 10;
    display: grid;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--ghost-border);
    border-radius: 14px;
    background: var(--chip);
    box-shadow: var(--menu-shadow);
}

.share-menu a,
.share-menu button {
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.share-menu a:hover,
.share-menu button:hover { background: var(--ghost-bg); }

/* Modal */
.post-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.post-modal[hidden] { display: none; }

.post-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--scrim-strong);
}

.post-modal-dialog {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    border-radius: 20px;
}

.post-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    background: var(--chip);
}

body.io-modal-abierto { overflow: hidden; }

/* ==========================================
   MIS FAVORITOS Y HEADER
   ========================================== */
.fav-aviso {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto 24px;
    padding: 14px 18px;
    border: 1px solid var(--ghost-border);
    border-radius: 16px;
    background: var(--ghost-bg);
    color: var(--body);
    font-size: 14px;
}

.header-fav {
    position: relative;
    color: var(--heading);
}

.header-fav-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.header-fav-count[hidden] { display: none; }

/* ==========================================
   DETALLE
   ========================================== */
.detail-like {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 12px;
    color: var(--body);
    font-size: 15px;
}

.detail-like .post-like { margin-left: -10px; }
