/* Custom Header Premium - css/header.css */

.app-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 150;
    /* Mayor que bottom-nav o cualquier contenido */
    padding: 0 22px;
    box-sizing: border-box;
    background-color: #306859;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
}

/* Tres columnas con el centro matemáticamente alineado */
.app-header .header-left,
.app-header .header-right {
    width: 44px;
    /* Un poco de margen para facilidad de click/tap en móvil */
    min-width: 44px;
    height: 100%;
    display: flex;
    align-items: center;
}

.app-header .header-left {
    justify-content: flex-start;
}

.app-header .header-right {
    justify-content: flex-end;
}

.app-header .header-center {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

/* Botón de retroceso */
.app-header .header-back-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.app-header .header-back-btn:active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: scale(0.92);
}

.app-header .header-back-btn.hidden {
    display: none !important;
}

.app-header .header-back-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.app-header .header-back-btn:active svg {
    transform: translateX(-2px);
}

/* Título del header */
.app-header .header-title {
    font-size: 15px;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

/* Contenedor del usuario (imagen en la derecha) */
.app-header .header-user-wrapper {
    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

.app-header .header-user-wrapper:hover {
    transform: scale(1.05);
}

.app-header .header-user-wrapper:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Imagen de perfil del usuario */
.app-header .header-user-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background-color: #ffffff;
    transition: all 0.25s ease;
    opacity: 1;
    /* Opacidad normal cuando está logueado */
}

/* Opacidad reducida cuando no está logueado */
.app-header .header-user-img.not-logged {
    opacity: 0.4;
}

.app-header .header-user-wrapper:hover .header-user-img {
    border-color: #ffffff;
}

/* Menú desplegable del usuario (Dropdown) */
.app-header .header-right {
    position: relative;
    /* Necesario para ubicar el dropdown absoluto */
}

.header-dropdown {
    position: absolute;
    top: 48px;
    /* Altura ideal debajo de la foto */
    right: 0;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    min-width: 106px;
    z-index: 200;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.06);
    animation: fadeInDropdown 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.header-dropdown.hidden {
    display: none !important;
}

.header-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: center;
    font-size: 11.5px;
    color: #333333;
    text-decoration: none;
    background-color: #ffffff;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 400;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
}

.header-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.header-dropdown .dropdown-item:hover {
    background-color: #f5f5f5;
    color: #111111;
}

.header-dropdown .dropdown-item:active {
    background-color: #e9e9e9;
}

.header-dropdown .dropdown-item.hidden {
    display: none !important;
}

/* Opción de cerrar sesión en rojo */
.header-dropdown .dropdown-item.dropdown-logout {
    color: #dc2626;
    /* Rojo premium */
    font-weight: 500;
}

.header-dropdown .dropdown-item.dropdown-logout:hover {
    background-color: #fef2f2;
    /* Fondo sutil rojo en hover */
    color: #b91c1c;
}

.header-dropdown .dropdown-item.dropdown-logout:active {
    background-color: #fee2e2;
}

/* Estilo premium del Header Transparente para vistas Index y Partidos */
.app-header.header-transparent {
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none !important;
}

.app-header.header-transparent .header-left,
.app-header.header-transparent .header-center {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.app-header.header-transparent .header-user-img {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

.app-header.header-transparent .header-user-img.not-logged {
    opacity: 0.65 !important;
}