:root {
    /* Tema Claro / Base */
    --ph-bg-solid-light: #002b59;
    --ph-text-light: #f8fafc;
    --ph-text-sub-light: #5dd1ff;
    --ph-border-light: rgba(255, 255, 255, 0.15);
    /* Fondo claro y texto oscuro legible para el modo claro */
    --ph-input-bg-light: #ffffff;
    --ph-input-text-light: #0f172a;
    --ph-shadow-light: 0 15px 30px -5px rgba(0, 0, 0, 0.5), 0 10px 15px -5px rgba(0, 0, 0, 0.3);
    --bg-logo-header-light: #001b37;


    /* Tema Oscuro */
    --ph-bg-solid-dark: #151f2f;
    --ph-text-dark: #f8fafc;
    --ph-text-sub-dark: #00c2ff;
    --ph-border-dark: rgba(255, 255, 255, 0.05);
    --ph-input-bg-dark: #1e293b;
    --ph-input-text-dark: #f8fafc;
    --ph-shadow-dark: 0 15px 30px -5px rgba(0, 0, 0, 0.5), 0 10px 15px -5px rgba(0, 0, 0, 0.3);
    --bg-logo-header-dark: #0f172a;
}

.premium-header-container {
    background-color: var(--ph-bg-solid-light);
    background-image: none;
    border-radius: 20px;
    padding: 10px 20px 15px 20px;
    margin-bottom: 24px;
    border: 1px solid var(--ph-border-light);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.premium-header-container::before {
    display: none;
}

/* LÍNEA 1: Saludo, Avatar y Logo */
.ph-line-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    z-index: 1;
}

.ph-user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.ph-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.ph-avatar-wrapper img {
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1e293b;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    width: 56px;
    height: 56px;
    transition: all 0.2s ease;
}

.ph-greeting {
    margin: 0;
    /* Redujimos el mínimo a 0.95rem y el máximo a 1.3rem para un mejor balance */
    font-size: clamp(0.95rem, 3.5vw, 1.3rem); 
    font-weight: 800;
    color: var(--ph-text-light);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* 🔥 Forzamos a que se mantenga en 1 sola línea */
    white-space: nowrap; /* 🔥 Evita el salto de línea */
    gap: 6px;
    line-height: 1.2;
    overflow: hidden; 
}

/* 🔥 Si el nombre del usuario es excesivamente largo, le pondrá "..." en vez de desbordar */
.ph-greeting span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ph-wave {
    flex-shrink: 0;
    font-size: 1.3rem;
}

.ph-brand-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 4px;
    background: var(--bg-logo-header-light);
    padding: 10px;
    border-radius: 10px;
}

body.dark-mode .ph-brand-wrapper {
    background: var(--bg-logo-header-dark);
}

.ph-app-logo {
    max-height: 60px; 
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
    transition: all 0.2s ease;
}

/* LÍNEA 2: Selector de Vivienda */
.ph-line-2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
}

.ph-housing-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--ph-text-sub-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    margin: 0;
}

.ph-housing-label svg {
    color: var(--ph-text-sub-light);
    flex-shrink: 0;
}

.ph-housing-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.ph-housing-select, .ph-housing-static {
    width: 100%;
    background-color: var(--ph-input-bg-light);
    color: var(--ph-input-text-light);
    border: 1px solid var(--ph-border-light);
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ph-housing-select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.ph-housing-static {
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ph-select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ph-input-text-light);
    opacity: 0.8;
}

/* LÍNEA 3: Badges Grid */
.ph-line-3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    z-index: 1;
}

@media (max-width: 480px) {
    .ph-user-info { gap: 10px; }
    .ph-avatar-wrapper img { width: 46px; height: 46px; }
    .ph-app-logo { max-height: 60px; }
}

@media (max-width: 400px) {
    .ph-line-3 { gap: 8px; }
    .ph-badge { padding: 3px 2px !important; }
    .ph-badge span { font-size: 0.65rem !important; }
}

/* =========================================================================
   NUEVO SISTEMA DE COLORES SÓLIDOS (PREMIUM SIN TRANSPARENCIAS)
   ========================================================================= */
.ph-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px; 
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
    word-wrap: break-word;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    
    /* 🔥 Corrección Android: Min-height fijo y anulación de aspect-ratio forzado en móviles */
    width: 100%;
    min-height: 78px;
    height: auto;
    aspect-ratio: auto;

    box-sizing: border-box;
    /* Sombras Premium */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.08);
    position: relative;
    overflow: hidden;
}

.ph-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.15);
}

.ph-badge-icon {
    font-size: 26px; 
    margin-bottom: 0px;
    height: 32px; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: normal; 
    flex-shrink: 0; 
}

/* 1. ROL (Turquesa / Teal Oscuro - Totalmente distinto) */
.badge-role { background: linear-gradient(135deg, #0f766e, #134e4a); color: #5eead4; border: 1px solid #2dd4bf; }

/* 2. ESTADOS DE VIVIENDA (Simbología exacta del mapa - Sólidos) */
.badge-verified { background: linear-gradient(135deg, #15803d, #14532d); color: #86efac; border: 1px solid #4ade80; }
.badge-renovacion { background: linear-gradient(135deg, #c2410c, #7c2d12); color: #fdba74; border: 1px solid #fb923c; }
.badge-unverified { background: linear-gradient(135deg, #475569, #334155); color: #e2e8f0; border: 1px solid #94a3b8; }
.badge-pending-auth { background: linear-gradient(135deg, #a16207, #713f12); color: #fde047; border: 1px solid #facc15; }

/* 3. VERIFICADOR (Azul Fuerte y Amarillo) */
.badge-verifier { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); color: #bfdbfe; border: 1px solid #60a5fa; }
.badge-verifier-pending { background: linear-gradient(135deg, #a16207, #713f12); color: #fde047; border: 1px solid #facc15; }

/* 4. JUNTA DIRECTIVA (Rojo Fuerte y Morado Fuerte) */
.badge-board { background: linear-gradient(135deg, #b91c1c, #7f1d1d); color: #fca5a5; border: 1px solid #f87171; }
.badge-board-pending { background: linear-gradient(135deg, #6b21a8, #4c1d95); color: #d8b4fe; border: 1px solid #c084fc; }

/* 5. VACÍOS Y BLOQUEADOS (Con vida, coloridos y con icono nítido) */
.badge-empty { 
    color: #e0f2fe; 
    border: 1px solid #38bdf8; 
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), 0 4px 10px rgba(0,0,0,0.3);
}
.badge-empty .ph-badge-icon { opacity: 1; filter: none; }

.badge-locked {
    background: transparent;
    color: #ede9fe;
    border: 1px solid #656565;
    cursor: default;
}
.badge-locked:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.3);
}
.badge-locked .ph-badge-icon { filter: none; opacity: 1; }

/* --- DARK MODE OVERRIDES --- */
body.dark-mode .premium-header-container { 
    background-color: var(--ph-bg-solid-dark);
    background-image: none;
    border-color: var(--ph-border-dark);
}
body.dark-mode .premium-header-container::before { display: none; }
body.dark-mode .ph-greeting { color: var(--ph-text-dark); }
body.dark-mode .ph-housing-label { color: var(--ph-text-sub-dark); }
body.dark-mode .ph-housing-label svg { color: var(--ph-text-sub-dark); }
body.dark-mode .ph-housing-select, 
body.dark-mode .ph-housing-static { 
    background-color: var(--ph-input-bg-dark);
    color: var(--ph-input-text-dark);
    border-color: #212b3d;
    box-shadow: inset 0 0px 6px 0px #37404f;
}
body.dark-mode .ph-select-icon { color: var(--ph-input-text-dark); opacity: 0.5; }
body.dark-mode .ph-avatar-wrapper img { border-color: #1e293b; }

body.dark-mode .ph-badge { box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.05); }

/* ANIMACIONES Y CARAS DE BADGES INTERACTIVOS (Clic para girar) */
.interactive-badge .badge-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 85px;
    padding: 8px;
    box-sizing: border-box;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 12px;
}

.interactive-badge .face-normal {
    opacity: 1;
    transform: translateY(0);
    cursor: pointer;
}

.interactive-badge .face-accion,
.interactive-badge .face-scanner {
    opacity: 0;
    transform: translateY(100%);
    color: #ffffff;
    cursor: pointer;
    pointer-events: none;
}

/* Colores para las caras de acción giratorias */
#badge-verificador-header .face-scanner { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
#badge-estado-verificacion .face-accion { background: linear-gradient(135deg, #16a34a, #15803d); }

/* Diseño Premium para botones de postulación */
#badge-postular-verificador .face-accion,
#badge-postular-directiva .face-accion {
    color: #ffffff;

}

/* Estado volteado (Flipped al hacer clic) */
.interactive-badge.flipped-active .face-normal { 
    opacity: 0; 
    transform: translateY(-100%); 
    pointer-events: none; 
}

.interactive-badge.flipped-active .face-accion,
.interactive-badge.flipped-active .face-scanner { 
    opacity: 1; 
    transform: translateY(0); 
    pointer-events: auto; 
}


.colinas-header-title-main {
    display: block;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
    line-height: 1.2;
    text-align: center;
    
    /* GRADIENTE DORADO FORMAL / ORO VIEJO (Simétrico y elegante) */
    background: linear-gradient(90deg, #8c6239 0%, #d4af37 35%, #fef3c7 50%, #d4af37 65%, #8c6239 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldShimmer 3s linear infinite;
}        

@keyframes goldShimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: -200% center;
    }
}
/* DISEÑO DE DOS COLUMNAS SUPERIORES */
.ph-top-layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    z-index: 1;
    width: 100%;
}

.ph-left-column {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.ph-housing-section {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}