/* ???????????????????????????????????????????????????????????????????
   Portal User Header - Header con accesibilidad + perfil de usuario
   Diseño basado en prototipo-pantalla-solicitudes.html.
   Compartido entre todos los portales SIA-PY.
   Consumir con: ~/_content/WebDesignSystem/css/portal-user-header.css
   ??????????????????????????????????????????????????????????????????? */

/* ??? Portal Header bar ??? */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color, #E2E8F0);
    position: relative;
    z-index: 100;
    min-height: 72px;
}

/* ??? Header info: breadcrumb + título + subtítulo ??? */
.portal-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.portal-header-title {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--mre-blue, #002855);
}

.portal-header-subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: #64748B;
    font-weight: 600;
}

/* -- Accesibilidad: contenedor y botón trigger -- */
.a11y-container {
    position: relative;
    margin-right: 15px;
}

.btn-a11y-trigger {
    background: #F8FAFC;
    border: 1px solid var(--border-color, #E2E8F0);
    color: var(--mre-blue, #002855);
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.btn-a11y-trigger:hover,
.btn-a11y-trigger.active {
    background: #F1F5F9;
    border-color: var(--mre-blue-light, #0038A8);
    color: var(--mre-blue-light, #0038A8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* ??? Accesibilidad: dropdown ??? */
.a11y-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 16px;
    width: 280px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color, #E2E8F0);
    display: none;
    z-index: 200;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
    padding: 1rem;
}

.a11y-dropdown-menu.show {
    display: block;
}

.a11y-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #94A3B8;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

/* --- Controles de tamaño de texto --- */
.text-resize-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F8FAFC;
    border-radius: 10px;
    padding: 4px;
    border: 1px solid #E2E8F0;
    margin-bottom: 1rem;
}

.btn-resize {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 8px;
    color: var(--mre-blue, #002855);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-resize:hover {
    background: var(--mre-blue, #002855);
    color: white;
}

.font-size-display {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}

/* ??? Toggle switches ??? */
.switch-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #F1F5F9;
}

.switch-control:last-child {
    border-bottom: none;
}

.switch-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--mre-blue, #002855);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* ??? Perfil de usuario ??? */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.header-profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.header-profile-trigger:hover {
    background: #F8FAFC;
    border-color: var(--border-color, #E2E8F0);
}

.profile-avatar {
    background: #f1f5f9;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- User dropdown menu --- */
.dropdown-menu-mre {
    position: absolute;
    top: 120%;
    right: 0;
    background: white;
    border-radius: 14px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color, #E2E8F0);
    width: 240px;
    display: none;
    z-index: 200;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu-mre.show {
    display: block;
}

.dropdown-header-info {
    padding: 16px;
    background: #F8FAFC;
    border-bottom: 1px solid var(--border-color, #E2E8F0);
}

.dropdown-item-mre {
    padding: 12px 16px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.dropdown-item-mre:hover {
    background: #F1F5F9;
    color: var(--mre-blue, #002855);
}

.dropdown-item-mre i {
    width: 16px;
    color: #64748B;
}

.dropdown-item-mre:hover i {
    color: var(--mre-blue, #002855);
}

.dropdown-item-mre.text-danger:hover {
    background: #FFF1F2;
    color: #BE123C;
}

.dropdown-item-mre.text-danger:hover i {
    color: #BE123C;
}

/* ??? Breadcrumb (dentro del header) ??? */
.panel-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.panel-breadcrumb-item {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    position: relative;
    white-space: nowrap;
}

.panel-breadcrumb-item:not(:last-child)::after {
    content: "/";
    position: absolute;
    right: -8px;
    color: #94A3B8;
}

.panel-breadcrumb-item.active {
    color: var(--mre-blue, #002855);
}

/* Responsive */
@media (max-width: 768px) {
    .portal-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 10px;
    }

    .portal-header-info {
        flex-basis: 100%;
    }

    .portal-header-title {
        font-size: 1.1rem;
    }

    .portal-header-subtitle {
        font-size: 0.75rem;
    }

    .a11y-container {
        margin-right: 8px;
    }

    .btn-a11y-trigger span {
        display: none;
    }
}
