/* =========================================================
   AH Bienes Raíces — estilos propios
   Se cargan DESPUÉS de bootstrap.min.css para sobreescribirlo.
   El rosa corporativo vive en una sola variable: --ah-pink.
   ========================================================= */

:root {
    --ah-pink: #E5427A;
    --ah-pink-dark: #C7315F;
    --ah-pink-light: #FCE8EF;

    --ah-ink: #1F2328;
    --ah-gray-600: #6B7280;
    --ah-gray-300: #E4E6EA;
    --ah-gray-100: #F6F7F9;

    --ah-radius: 14px;
    --ah-radius-sm: 10px;
    --ah-shadow: 0 2px 14px rgba(17, 17, 17, .07);
    --ah-shadow-hover: 0 8px 24px rgba(17, 17, 17, .10);

    --bs-primary: var(--ah-pink);
    --bs-primary-rgb: 229, 66, 122;
}

html, body {
    background-color: var(--ah-gray-100);
    color: var(--ah-ink);
}

a {
    color: var(--ah-pink-dark);
}

/* ---------- Botones ---------- */
.btn-primary {
    background-color: var(--ah-pink);
    border-color: var(--ah-pink);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--ah-pink-dark);
    border-color: var(--ah-pink-dark);
}

.btn-outline-primary {
    color: var(--ah-pink);
    border-color: var(--ah-pink);
}

.btn-outline-primary:hover {
    background-color: var(--ah-pink);
    border-color: var(--ah-pink);
}

.btn {
    border-radius: var(--ah-radius-sm);
    font-weight: 500;
}

/* ---------- Utilidades de marca ---------- */
.text-ah-pink { color: var(--ah-pink) !important; }
.bg-ah-pink { background-color: var(--ah-pink) !important; }
.bg-ah-pink-light { background-color: var(--ah-pink-light) !important; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--ah-gray-300);
    border-radius: var(--ah-radius);
    box-shadow: var(--ah-shadow);
}

.card-hover {
    transition: box-shadow .15s ease, transform .15s ease;
}

.card-hover:hover {
    box-shadow: var(--ah-shadow-hover);
    transform: translateY(-2px);
}

/* ---------- Formularios ---------- */
.form-control, .form-select {
    border-radius: var(--ah-radius-sm);
    border-color: var(--ah-gray-300);
    padding: .6rem .85rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ah-pink);
    box-shadow: 0 0 0 .2rem var(--ah-pink-light);
}

.form-label {
    font-weight: 600;
    font-size: .92rem;
    margin-bottom: .35rem;
}

.form-hint {
    color: var(--ah-gray-600);
    font-size: .84rem;
}

/* ---------- Badges de estado (usados por x-status-badge) ---------- */
.badge-ah {
    font-weight: 600;
    padding: .4em .75em;
    border-radius: 999px;
    font-size: .78rem;
}

/* ---------- Layout de autenticación (guest) ---------- */
.ah-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, var(--ah-pink-light) 0%, #ffffff 55%);
}

.ah-auth-card {
    width: 100%;
    max-width: 420px;
}

.ah-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--ah-ink);
}

.ah-brand span {
    color: var(--ah-pink);
}

/* ---------- Layout administrativo ---------- */
.ah-sidebar {
    width: 260px;
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--ah-gray-300);
}

.ah-sidebar .nav-link {
    color: var(--ah-gray-600);
    border-radius: var(--ah-radius-sm);
    padding: .6rem .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.ah-sidebar .nav-link i {
    font-size: 1.05rem;
}

.ah-sidebar .nav-link.active {
    background-color: var(--ah-pink-light);
    color: var(--ah-pink-dark);
}

.ah-sidebar .nav-link:hover {
    background-color: var(--ah-gray-100);
    color: var(--ah-ink);
}

.ah-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--ah-gray-300);
    padding: .75rem 1.25rem;
}

.ah-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--ah-pink-light);
    color: var(--ah-pink-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}

.ah-main {
    background-color: var(--ah-gray-100);
    min-height: 100vh;
}

/* ---------- Empty state ---------- */
.ah-empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--ah-gray-600);
}

.ah-empty-state .ah-empty-icon {
    font-size: 2.6rem;
    margin-bottom: .75rem;
    display: block;
}

/* ---------- Fichas del proceso de reserva ---------- */
.ah-step-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--ah-gray-100);
    color: var(--ah-gray-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .95rem;
    border: 1px solid var(--ah-gray-300);
}

.ah-step-circle.ah-step-activo {
    background-color: var(--ah-pink-light);
    color: var(--ah-pink-dark);
    border-color: var(--ah-pink);
}

.ah-step-circle.ah-step-completado {
    background-color: var(--ah-pink);
    color: #fff;
    border-color: var(--ah-pink);
}

/* ---------- Stat tiles del dashboard ---------- */
.ah-stat-card {
    border-radius: var(--ah-radius);
}

.ah-stat-card .ah-stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
}

.ah-stat-card .ah-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--ah-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background-color: var(--ah-pink-light);
    color: var(--ah-pink-dark);
}

/* ---------- Calendario de propiedad (Fase 4) ---------- */
.ah-calendar-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.ah-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    max-width: 100%;
}

.ah-calendar-grid .ah-calendar-cabecera {
    text-align: center;
    font-size: .75rem;
    color: var(--ah-muted, #6c757d);
    font-weight: 600;
    padding-bottom: 4px;
}

.ah-calendar-dia {
    min-height: 64px;
    min-width: 0;
    border-radius: var(--ah-radius-sm);
    border: 1px solid #e9ecef;
    padding: 4px 6px;
    font-size: .8rem;
    cursor: pointer;
    transition: transform .1s ease;
    overflow: hidden;
}

.ah-calendar-dia:hover {
    transform: scale(1.03);
}

.ah-calendar-dia.is-vacio {
    background: transparent;
    border: none;
    cursor: default;
}

.ah-calendar-dia.is-disponible {
    background: #fff;
}

.ah-calendar-dia.is-pendiente {
    background-color: var(--bs-warning-bg-subtle, #fff3cd);
    border-color: var(--bs-warning-border-subtle, #ffe69c);
}

.ah-calendar-dia.is-ocupado {
    background-color: var(--bs-danger-bg-subtle, #f8d7da);
    border-color: var(--bs-danger-border-subtle, #f1aeb5);
}

.ah-calendar-dia.is-bloqueado {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.ah-calendar-dia .ah-calendar-numero {
    font-weight: 600;
}

/* ---------- Calendario general de reservas (Fase 8) ----------
   Mismo grid que el calendario de propiedad (.ah-calendar-grid /
   .ah-calendar-dia arriba), pero cada día puede traer eventos de
   varias propiedades a la vez, cada una con su color. ---------- */
.ah-calendar-dia.is-multi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 82px;
    min-width: 0;
    cursor: default;
    align-items: stretch;
}

.ah-calendar-dia.is-multi:hover {
    transform: none;
}

.ah-calendar-evento {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .68rem;
    line-height: 1.35;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.ah-calendar-evento:hover {
    filter: brightness(0.92);
}

.ah-calendar-evento.is-pendiente {
    opacity: .68;
    color: #212529;
}

.ah-calendar-evento-mas {
    font-size: .68rem;
    color: var(--ah-muted, #6c757d);
    padding-left: 5px;
}

.ah-calendar-leyenda-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}


/* Calendario general en pantallas angostas: texto y padding más chicos para
   que los 7 días quepan sin forzar scroll horizontal de la página. */
@media (max-width: 575.98px) {
    .ah-calendar-dia {
        min-height: 52px;
        padding: 2px 3px;
        font-size: .68rem;
    }

    .ah-calendar-dia.is-multi {
        min-height: 60px;
    }

    .ah-calendar-evento {
        font-size: .6rem;
        padding: 1px 3px;
    }

    .ah-calendar-grid {
        gap: 2px;
    }
}

/* =========================================================
   Galería de fotos de propiedad — mosaico + lightbox
   (x-property-gallery, usado en preview interna y ficha pública)
   ========================================================= */
.ah-gallery {
    display: grid;
    gap: 8px;
    border-radius: var(--ah-radius);
    overflow: hidden;
}

.ah-gallery-cover,
.ah-gallery-tile {
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background-color: var(--ah-gray-100);
}

.ah-gallery-cover img,
.ah-gallery-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s ease;
}

.ah-gallery-cover:hover img,
.ah-gallery-tile:hover img {
    transform: scale(1.04);
}

.ah-gallery-mas {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, .5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.ah-gallery-vertodas {
    position: absolute;
    right: 12px;
    bottom: 12px;
    box-shadow: var(--ah-shadow);
}

/* Variantes según cuántas fotos hay — degradan de un mosaico completo
   (portada + 4 miniaturas) a algo proporcional con menos fotos. */
.ah-gallery-1 { grid-template-columns: 1fr; }
.ah-gallery-1 .ah-gallery-cover { height: 420px; }

.ah-gallery-2 { grid-template-columns: 1fr 1fr; height: 380px; }

.ah-gallery-3 { grid-template-columns: 1.4fr 1fr; grid-template-rows: repeat(2, 1fr); height: 380px; }
.ah-gallery-3 .ah-gallery-cover { grid-row: 1 / span 2; }

.ah-gallery-4 { grid-template-columns: 1.4fr 1fr; grid-template-rows: repeat(3, 1fr); height: 420px; }
.ah-gallery-4 .ah-gallery-cover { grid-row: 1 / span 3; }

.ah-gallery-5plus { grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: repeat(2, 1fr); height: 380px; }
.ah-gallery-5plus .ah-gallery-cover { grid-row: 1 / span 2; }

@media (max-width: 767.98px) {
    .ah-gallery-2,
    .ah-gallery-3,
    .ah-gallery-4,
    .ah-gallery-5plus {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: 200px repeat(2, 110px);
        height: auto;
    }

    .ah-gallery-2 .ah-gallery-cover,
    .ah-gallery-3 .ah-gallery-cover,
    .ah-gallery-4 .ah-gallery-cover,
    .ah-gallery-5plus .ah-gallery-cover {
        grid-column: 1 / span 2;
        grid-row: 1;
    }

    .ah-gallery-1 .ah-gallery-cover { height: 260px; }

    .ah-gallery-vertodas {
        right: 8px;
        bottom: 8px;
        font-size: .8rem;
        padding: .25rem .5rem;
    }
}

/* Lightbox (modal + carousel de Bootstrap, sin librerías nuevas) */
.ah-gallery-modal .modal-content {
    border: none;
    border-radius: 0;
}

.ah-gallery-modal .carousel-item img.ah-gallery-modal-img {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    object-fit: contain;
    margin: auto;
}

.ah-gallery-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.ah-gallery-modal .carousel-control-prev,
.ah-gallery-modal .carousel-control-next {
    width: 4rem;
}

.ah-gallery-contador {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 17, 17, .55);
    color: #fff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: .85rem;
    z-index: 5;
}

/* ---------- Editor de texto enriquecido (components/rich-editor) ---------- */
.rich-editor {
    border: 1px solid var(--ah-gray-300);
    border-radius: var(--ah-radius-sm);
    background: #fff;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.rich-editor:focus-within {
    border-color: var(--ah-pink);
    box-shadow: 0 0 0 .2rem rgba(229, 66, 122, .15);
}
.rich-editor.is-over { border-color: #dc3545; }

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--ah-gray-100);
    border-bottom: 1px solid var(--ah-gray-300);
}
.rich-editor-toolbar button {
    border: 0;
    background: transparent;
    color: var(--ah-ink);
    width: 34px;
    height: 34px; /* cómodo para tocar en móvil */
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
}
.rich-editor-toolbar button:hover { background: var(--ah-gray-300); }
.rich-editor-toolbar button.active {
    background: var(--ah-pink-light);
    color: var(--ah-pink-dark);
}
.rich-editor-sep {
    width: 1px;
    height: 20px;
    margin: 0 6px;
    background: var(--ah-gray-300);
}

.rich-editor-area {
    min-height: 140px;
    max-height: 420px;
    overflow-y: auto;
    padding: 12px 14px;
    outline: none;
    line-height: 1.55;
    position: relative;
}
.rich-editor-area:empty::before,
.rich-editor-area:has(> p:only-child > br:only-child)::before {
    content: attr(data-placeholder);
    color: var(--ah-gray-600);
    pointer-events: none;
    position: absolute;
    top: 12px;
    left: 14px;
}
.rich-editor-area p { margin-bottom: .6rem; }
.rich-editor-area h4,
.descripcion-rica h4 { font-size: 1.05rem; font-weight: 600; margin: .8rem 0 .4rem; }
.rich-editor-area ul, .rich-editor-area ol,
.descripcion-rica ul, .descripcion-rica ol { padding-left: 1.4rem; margin-bottom: .6rem; }
.descripcion-rica > :last-child { margin-bottom: 0; }

.rich-editor-foot {
    padding: 4px 12px 6px;
    text-align: right;
    font-size: .75rem;
    color: var(--ah-gray-600);
}
.rich-editor.is-over .rich-editor-foot { color: #dc3545; font-weight: 600; }

/* ---------- Cinta de modalidad en tarjetas (venta / renta / roomie) ---------- */
.ah-ribbon {
    position: absolute;
    top: 14px;
    left: 0;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 5px 14px 5px 10px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1.2;
    color: #fff;
    border-radius: 0 999px 999px 0;
    box-shadow: 0 2px 8px rgba(17, 17, 17, .22);
    pointer-events: none;
}
/* "doblez" de la cinta: triangulito oscuro bajo el borde izquierdo */
.ah-ribbon::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    border-top: 5px solid rgba(0, 0, 0, .35);
    border-left: 5px solid transparent;
}
.ah-ribbon.is-renta  { background: var(--ah-pink); }
.ah-ribbon.is-venta  { background: var(--ah-ink); }
.ah-ribbon.is-roomie { background: #0f8b8d; }
