/* ============================================================
   INMOBILIARIA — DESIGN SYSTEM
   Tipografía: Cormorant Garamond (display) + DM Sans (body)
   Paleta: Azul marino profundo · Blanco · Verde esmeralda
   Estilo: Luxury editorial — refinado, espacioso, confiable
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* --- TOKENS DE DISEÑO --- */
:root {
    --primary:        #194e72;
    --primary-light:  #1e6494;
    --primary-dark:   #0f3249;
    --accent:         #0c9545;
    --accent-light:   #10b854;
    --dark:           #111827;
    --mid:            #374151;
    --muted:          #6b7280;
    --light-bg:       #f8fafc;
    --surface:        #ffffff;
    --border:         #e5e9ef;
    --border-strong:  #c9d3dc;

    --font-display: 'Open Sans', sans-serif; 
    --font-body:    'Open Sans', sans-serif;

    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;
    --radius-xl:  28px;

    --shadow-xs:  0 1px 3px rgba(0,0,0,0.06);
    --shadow-sm:  0 4px 12px rgba(0,0,0,0.07);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.10);
    --shadow-lg:  0 16px 48px rgba(0,0,0,0.13);
    --shadow-card: 0 2px 8px rgba(25,78,114,0.06), 0 8px 24px rgba(25,78,114,0.08);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET BASE --- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--dark);
    line-height: 1.65;
    font-family: var(--font-body);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   HEADER / BANNER (INDEX)
   ============================================================ */
header {
    height: 520px;
    background-color: var(--primary-dark);
    background-position: center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Gradiente más elegante que un simple rgba negro */
.overlay {
    background: linear-gradient(
        to bottom,
        rgba(10, 25, 40, 0.35) 0%,
        rgba(10, 25, 40, 0.65) 100%
    );
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6vw, 5rem);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.4);
    line-height: 1.1;
}

header p {
    font-family: var(--font-body);
    font-size: 1.05rem;
    margin-top: 14px;
    opacity: 0.88;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 300;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 24px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 28px;
}

/* ============================================================
   TARJETAS DE PROPIEDAD
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

.card img {
    width: 100%;
    height: 230px;
    object-fit: cover;
}

/* Slideshow */
.slideshow-container {
    position: relative;
    width: 100%;
    height: 230px;
    overflow: hidden;
}

.slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.9s ease-in-out;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    z-index: 2;
}

/* Badge Venta / Renta */
.badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--primary);
    color: white;
    padding: 4px 14px;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(25,78,114,0.3);
}

/* Info dentro de la tarjeta */
.info {
    padding: 22px 22px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info h3 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.2;
}

.precio {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin: 4px 0 6px;
    letter-spacing: -0.3px;
}

.info p {
    font-size: 0.875rem;
    color: var(--muted);
    margin: 0;
}

.ubicacion {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   BARRA DE CONTACTO SUPERIOR
   ============================================================ */
.contacto-quick {
    background: var(--surface);
    padding: 10px 20px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.01em;
}

.contacto-quick span { margin: 0 16px; }

/* ============================================================
   BOTONES FLOTANTES
   ============================================================ */
.botones-flotantes {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* JS lo activa */
    gap: 12px;
    z-index: 1000;
}

.btn-flotante {
    padding: 13px 26px;
    border-radius: 50px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.22);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
    letter-spacing: 0.01em;
}

.btn-flotante:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}

.llamar    { background: var(--primary); }
.whatsapp  { background: #22c55e; }

@media (max-width: 600px) {
    .btn-flotante { padding: 11px 18px; font-size: 0.85rem; }
}

/* ============================================================
   PÁGINA DE DETALLE (propiedad.html)
   ============================================================ */
.detalle-page { background: var(--light-bg); }

.header-small {
    height: 110px !important;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%) !important;
}

.btn-volver {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 20px 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color var(--transition);
}
.btn-volver:hover { color: white; }

.container-detalle {
    max-width: 1100px;
    margin: -40px auto 60px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.detalle-imagen {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 28px;
    background: var(--light-bg);
    border-right: 1px solid var(--border);
}

#det-img-main {
    width: 100%;
    height: 420px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
}

.thumbnails img {
    width: 100%;
    height: 78px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition), border-color var(--transition);
    border: 2px solid transparent;
}

.thumbnails img:hover {
    opacity: 0.82;
    border-color: var(--primary);
}

.detalle-info {
    padding: 40px 44px;
    overflow-y: auto;
}

.detalle-info h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 600;
    margin: 10px 0 6px;
    line-height: 1.15;
    color: var(--dark);
}

.detalle-info .precio {
    font-size: 1.6rem;
    margin: 8px 0 16px;
}

.detalle-info .ubicacion {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.detalle-info hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.detalle-info h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--mid);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}

.detalle-info #det-descripcion {
    color: var(--mid);
    line-height: 1.75;
    font-size: 0.95rem;
}

.acciones-detalle { margin-top: 28px; }

@media (max-width: 820px) {
    .detalle-grid { grid-template-columns: 1fr; }
    .detalle-imagen { border-right: none; border-bottom: 1px solid var(--border); }
    #det-img-main { height: 280px; }
}

/* ============================================================
   PANEL DE ADMINISTRACIÓN (admin.html)
   ============================================================ */
.admin-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Header admin */
.admin-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 28px 32px 24px;
    margin-bottom: 32px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.admin-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-header h1 {
    color: white;
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
}

.btn-logout {
    background: rgba(255,255,255,0.12);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: 500;
    transition: background var(--transition);
    letter-spacing: 0.01em;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); }

/* Stat cards */
.admin-stats-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 14px;
}

.stat-card {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    backdrop-filter: blur(4px);
}

.stat-icon { font-size: 1.4rem; }

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6ee7a0;
    line-height: 1;
}

.stat-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    word-break: break-all;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--transition);
}
.stat-link:hover { color: white; text-decoration: underline; }

.btn-copy {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.9rem;
    margin-left: auto;
    flex-shrink: 0;
}
.btn-copy:hover { background: rgba(255,255,255,0.28); }

/* Tarjetas del admin */
.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}
.admin-card:hover { box-shadow: var(--shadow-sm); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-header .icon { font-size: 1.2rem; }

.card-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

/* Inputs */
.admin-card input[type="text"],
.admin-card input[type="email"],
.admin-card input[type="number"],
.admin-card input[type="tel"],
.admin-card select,
.admin-card textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--dark);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    margin-bottom: 12px;
}

.admin-card input:focus,
.admin-card select:focus,
.admin-card textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(25,78,114,0.1);
}

.admin-card input[type="file"] {
    padding: 8px 0;
    border: none;
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.row {
    display: flex;
    gap: 12px;
}

/* Botones del admin */
.admin-card button[type="submit"],
.admin-card .btn-success {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    letter-spacing: 0.02em;
    margin-top: 6px;
}

.admin-card button[type="submit"]:hover { background: var(--primary-light); }
.admin-card button[type="submit"]:active { transform: scale(0.99); }

.btn-success,
.admin-card .btn-success {
    background: var(--accent) !important;
}
.btn-success:hover,
.admin-card .btn-success:hover { background: var(--accent-light) !important; }

/* Desplegables */
.gestion-desplegable summary {
    cursor: pointer;
    padding: 12px 4px;
    font-size: 1rem;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--mid);
    border-radius: var(--radius-sm);
    transition: color var(--transition);
    user-select: none;
}

.gestion-desplegable summary::-webkit-details-marker { display: none; }

.gestion-desplegable summary::after {
    content: '›';
    margin-left: auto;
    font-size: 1.4rem;
    line-height: 1;
    transition: transform var(--transition);
    color: var(--muted);
}

.gestion-desplegable[open] summary::after {
    transform: rotate(90deg);
}

.gestion-desplegable summary:hover { color: var(--primary); }

.lista-borrado {
    margin-top: 18px;
    border-top: 1px dashed var(--border);
    padding-top: 16px;
}

/* Inventario items */
.lista-borrado > div {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 12px 16px !important;
    margin-bottom: 8px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: var(--light-bg);
    transition: border-color var(--transition);
}
.lista-borrado > div:hover { border-color: var(--border-strong) !important; }

.lista-borrado button {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
    padding: 6px 14px !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    transition: background var(--transition) !important;
}
.lista-borrado button:hover { background: #fee2e2 !important; }

/* Mensajes */
#lista-mensajes > div {
    border-left: 4px solid var(--primary) !important;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    background: var(--light-bg) !important;
    padding: 16px 18px !important;
    margin-bottom: 12px !important;
    border-top: 1px solid var(--border) !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
}
#lista-mensajes button {
    background: none !important;
    color: #dc2626 !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 4px 0 !important;
}

/* Link público */
.link-publico {
    display: inline-block;
    margin-top: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ============================================================
   RESPONSIVE GENERAL
   ============================================================ */
@media (max-width: 768px) {
    .admin-stats-container { grid-template-columns: 1fr; }
    .admin-header { border-radius: 0 0 var(--radius-md) var(--radius-md); padding: 20px; }
    .admin-wrapper { padding: 0 14px 40px; }
    header { height: 380px; }
    header h1 { font-size: 2.2rem; }
    .grid { grid-template-columns: 1fr; gap: 18px; }
}