/* =====================================================
    🟥 HEADER MODERNO - CAMPO 9 INMOBILIARIA
    Versión Definitiva: Corrección Ultra-Wide y Adaptación Notebooks
===================================================== */

.c9-header {
    font-family: 'Poppins', sans-serif;
    width: 100%;
    box-sizing: border-box;
}

/* 🔥 CONTENEDOR FLUIDO INTERNO: ALINEACIÓN MILIMÉTRICA SIN CORTES */
.header-container-fluid {
    width: 94%;
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    gap: 15px; /* Evita que los bloques colisionen en pantallas intermedias */
}

/* =====================================================
    🔴 TOPBAR
===================================================== */

.topbar {
    background: #a30000;
    color: #fff;
    padding: 14px 0;
    width: 100%;
}

/* LOGO */
.top-left .logo {
    display: inline-block;
}

.top-left .logo img {
    height: 90px;
    display: block;
    width: auto;
}

/* REDES */
.top-center {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
}

.social {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: #a30000;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s ease;
    text-decoration: none;
}

.social:hover {
    background: #ffcc00;
    color: #111;
    transform: translateY(-1px);
}

/* CONTACTOS */
.top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.top-right .contact {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: rgba(255, 255, 255, .1);
    padding: 6px 14px;
    border-radius: 25px;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
}

.top-right .contact:hover {
    background: #ffcc00;
    color: #111;
}

.top-right .contact i {
    margin-right: 8px;
}

/* =====================================================
    🔸 NAVBAR
===================================================== */

.navbar {
    background: #111111;
    padding: 6px 0;
    border-top: 1px solid #222;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* MENU */
.nav {
    list-style: none;
    display: flex;
    gap: 20px; /* Reducción elástica para evitar saltos en portátiles */
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav li a {
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px; /* Balance óptimo para resoluciones medianas */
    transition: color .2s;
    padding: 10px 4px;
    display: block;
    white-space: nowrap; /* Impide que los textos del menú se quiebren en dos líneas */
}

.nav li a:hover {
    color: #ffcc00;
}

/* =====================================================
    🔴 BOTONES DE ACCIÓN (JERARQUÍA VISUAL PREMIUM)
===================================================== */

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* Impide que la botonera se comprima o mutile en notebooks */
}

.actions .btn,
.btn-publi {
    color: #fff;
    padding: 8px 14px; /* Ajuste milimétrico de aire */
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Botones Translúcidos */
.actions .btn.perfil,
.actions .btn.admin {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
}

.actions .btn.perfil:hover,
.actions .btn.admin:hover {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
    transform: translateY(-1px);
}

/* Botón Destacado de Publicar */
.actions .btn.publicar,
.btn-publi {
    background: #a30000;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(163, 0, 0, 0.25);
}

.actions .btn.publicar:hover,
.btn-publi:hover {
    background: #ffcc00;
    color: #111;
    box-shadow: 0 4px 14px rgba(255, 204, 0, 0.3);
    transform: translateY(-1px);
}

/* Botón de Salida Compacto */
.actions .salir {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 8px 12px;
}

.actions .salir:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* =====================================================
    🍔 BURGER MENÚ MÓVIL
===================================================== */

.burger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.burger:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* =====================================================
    💻 ADAPTACIÓN INTERMEDIA PREDICTIVA (NOTEBOOKS / TABLETS)
========================================================= */
@media(max-width: 1200px) and (min-width: 769px) {
    .nav {
        gap: 12px; /* Reduce la separación entre enlaces para ganar espacio */
    }
    .nav li a {
        font-size: 13px;
    }
    .actions .btn span, 
    .btn-publi span {
        display: inline; /* Garantiza la lectura del texto de botones en portátiles */
    }
}

/* =====================================================
    📱 TABLET RESPONSIVE
========================================================= */

@media(max-width:991px){
    .topbar .header-container-fluid {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .top-right {
        align-items: center;
    }
}

/* =====================================================
    📱 MOBILE RESPONSIVE
========================================================= */

@media(max-width:768px){
    .c9-header .header-container-fluid {
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
    }

    /* TOPBAR */
    .topbar {
        padding: 10px 0;
    }

    .topbar .header-container-fluid {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .top-left img {
        max-height: 40px !important;
    }

    .top-center {
        gap: 8px;
    }

    .top-center a {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .top-right {
        display: none;
    }

    /* NAVBAR */
    .navbar {
        padding: 8px 0;
    }

    .navbar .header-container-fluid {
        flex-direction: column;
        align-items: center;
    }

    .burger {
        display: block;
    }

    /* MENÚ MÓVIL DESPLEGABLE */
    .nav {
        display: none;
        flex-direction: column;
        background: #111;
        padding: 10px 0;
        width: 100%;
        text-align: center;
    }

    #c9Nav.open {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 12px 0 6px 0;
        border-bottom: 1px solid #222;
    }

    #c9Nav.open a {
        padding: 10px 0;
        font-size: 16px;
    }

    /* BOTONERA MÓVIL EN CAPSULA */
    .actions {
        width: 100% !important;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 10px;
        margin: 16px auto 8px auto;
        padding: 12px;
        max-width: 360px;
        background: #0c0c0c;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0,0,0,.35);
        border: 1px solid rgba(255,255,255,.06);
    }

    .actions a {
        flex: 1 1 auto !important;
        width: auto !important;
        font-size: 14px;
        padding: 10px 14px !important;
        border-radius: 10px;
        white-space: nowrap;
    }
}

/* =====================================================
    🔽 DROPDOWN / SUBMENÚS
===================================================== */

nav ul li {
    position: relative;
}

nav ul li .submenu {
    position: absolute;
    top: 45px;
    left: 0;
    background: #1a1a1a;
    min-width: 240px;
    border-radius: 8px;
    padding: 8px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .25s ease;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
    border: 1px solid #222;
}

nav ul li:hover > .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

nav ul li .submenu li a {
    padding: 10px 20px;
    color: #cbd5e1;
    font-size: 14px;
    display: block;
    transition: .2s;
    border-left: 3px solid transparent;
}

nav ul li .submenu li a:hover {
    background: #a30000;
    color: #ffffff;
    border-left: 3px solid #ffcc00;
}

nav ul li .submenu li::before {
    display: none !important;
    content: "";
}

/* ==========================
   CHAT FLOTANTE
========================== */

.chat-float{
    position:fixed;
    right:20px;
    left:auto;

    bottom:130px;

    width:60px;
    height:60px;

    border-radius:50%;

    background:#a30000;
    color:#fff;

    text-decoration:none;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:26px;

    box-shadow:0 8px 25px rgba(0,0,0,.25);

    z-index:999999;

    transition:.3s;
}

.chat-float:hover{
    transform:scale(1.08);
}

@media(max-width:768px){

    .chat-float{
        right:15px !important;
        left:auto !important;
        bottom:140px !important;
    }

}

.chat-float:hover{
    transform:scale(1.08);
}

.chat-badge{

    position:absolute;

    top:-4px;
    right:-4px;

    min-width:24px;
    height:24px;

    border-radius:50%;

    background:#ff0000;
    color:#fff;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:12px;
    font-weight:700;

    padding:0 5px;
}

#chatWidget{ position:fixed; left:2px; bottom:20px; width:320px; height:550px; background:#fff; border-radius:18px; overflow:hidden; box-shadow:0 15px 40px rgba(0,0,0,.25); z-index:999999; display:none; flex-direction:column; } #chatHeader{ background:#a30000; color:#fff; padding:15px; display:flex; justify-content:space-between; align-items:center; font-weight:600; } #chatClose{ background:none; border:none; color:#fff; font-size:24px; cursor:pointer; } #chatUsuarios{ max-height:auto; overflow-y:auto; border-bottom:1px solid #eee; } .chatUser{ padding:12px; cursor:pointer; border-bottom:1px solid #f2f2f2; } .chatUser:hover{ background:#fafafa; } #chatMensajes{ flex:1; overflow-y:auto; padding:15px; background:#f5f5f5; } #chatEnviar{ display:flex; gap:10px; padding:12px; border-top:1px solid #eee; } #chatTexto{ flex:1; border:1px solid #ddd; border-radius:10px; padding:10px; }
#chatMensajes{
    padding:15px;
    height:320px;
    overflow-y:auto;
    background:#f5f6fa;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.message{
    max-width:75%;
    padding:10px 14px;
    border-radius:14px;
    word-wrap:break-word;
    font-size:14px;
    line-height:1.4;
}

.message.me{
    align-self:flex-end;
    background:#0d6efd;
    color:#fff;
    border-bottom-right-radius:4px;
}

.message.other{
    align-self:flex-start;
    background:#ffffff;
    color:#333;
    border:1px solid #ddd;
    border-bottom-left-radius:4px;
}

/* ==========================
   NUEVO CHAT
========================== */

#chatLista{
    flex:1;
    overflow-y:auto;
    background:#fff;
}

#chatConversacion{
    display:none;
    flex-direction:column;
    height:100%;
}

#chatTop{
    padding:15px;
    border-bottom:1px solid #eee;
    display:flex;
    align-items:center;
    gap:10px;
    background:#fff;
}

#chatNombre{
    font-weight:700;
    color:#222;
}

#chatSubtitulo{
    font-size:12px;
    color:#888;
}

#chatVolver{
    width:36px;
    height:36px;
    border:none;
    border-radius:50%;
    background:#a30000;
    color:#fff;
    cursor:pointer;
}

.chatUserName{
    font-weight:700;
    font-size:16px;
    color:#222;
}

.chatUserRole{
    font-size:12px;
    color:#888;
    margin-top:2px;
}

.chatUserLast{
    font-size:13px;
    color:#666;
    margin-top:6px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}