/* =====================================================================================
   FEDEHACEB · Área "cuentas" (Views/Account/* y Views/Shared/_User.cshtml)
   Requiere fedehaceb.css (tokens y componentes fh-). Se carga desde @section Styles de cada vista.

   1. Acceso: formulario + columna de ayuda (.ac-auth), encabezado de tarjeta (.ac-head)
   2. Campo de contraseña con botón "ver" (.ac-pass, #togglePassword del Login)
   3. Avisos de validación dentro de fh-notice y condiciones de contraseña (.ac-rules)
   4. Formularios de administración (.ac-admin-form) y lista de datos (.ac-dl)
   5. Listado de usuarios (Account/Index): tarjeta, leyenda de acciones, tabla y modal
   ===================================================================================== */

/* ------------------------------------------------------------------ 1. Acceso */
.ac-auth {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 28px;
    align-items: start;
}

.ac-auth__aside { display: grid; gap: 20px; }
.ac-auth__aside .fh-notice { margin: 0; }

.ac-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 24px;
}

.ac-head .fh-card__ico { margin: 0; }
.ac-head .fh-card__title { font-size: 1.6rem; }
.ac-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.45; }

/* Fila "Recordar contraseña" + enlace de recuperación */
.ac-between {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 16px;
    margin: 0 0 18px;
}

.ac-between .fh-check { margin: 0; align-items: center; min-height: 44px; }
.ac-between .fh-check span { color: var(--ink); font-weight: 500; }
.ac-between .fh-btn--link { min-height: 44px; padding-left: 0; padding-right: 0; font-weight: 600; }

/* Tarjeta oscura del portal (columna derecha del Login) */
.ac-portal { overflow: hidden; isolation: isolate; }
.ac-portal::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 180px;
    aspect-ratio: 1 / 1;
    border-radius: 50% 0 50% 50%;
    background: var(--bosque-2);
    z-index: -1;
}

.ac-portal .fh-kicker { color: var(--lima); --kc: var(--menta); }
.ac-portal .fh-card__title { color: #fff; }
.ac-portal p { color: rgba(255, 255, 255, .88); }
.ac-portal .fh-checks { margin-top: 18px; }
.ac-portal .fh-checks li { color: #fff; }

.ac-help a { font-weight: 600; }

/* Pasos en la columna de ayuda (Recuperar contraseña) */
.ac-steps .fh-step { grid-template-columns: 52px minmax(0, 1fr); }
.ac-steps .fh-step__n { width: 52px; height: 52px; font-size: 22px; }

@media (max-width: 980px) {
    .ac-auth { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .ac-auth .fh-card--lg,
    .fh-card--lg.ac-admin-form { padding: 26px 20px; border-radius: var(--r-md); }
    .ac-head { align-items: flex-start; }
    .ac-head .fh-card__ico { width: 48px; height: 48px; }
    .ac-head .fh-card__title { font-size: 1.35rem; }
}

/* ------------------------------------------------------------------ 2. Contraseña con botón "ver" */
.ac-pass { position: relative; }

/* El campo deja sitio al botón (se gana a la regla .fh-field input:not(...) de fedehaceb.css con el id) */
.ac-pass #passwordInput { padding-right: 58px; }

.ac-pass__toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--verde-d);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color .2s;
}

.ac-pass__toggle:hover { background: var(--verde-s); }
.ac-pass__toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ------------------------------------------------------------------ 3. Avisos y condiciones */
/* El resumen de validación (ModelOnly) solo se pinta si hay errores: se ve como fh-notice--error */
.ac-summary ul { margin: 0; padding-left: 18px; color: var(--rojo); font-weight: 600; font-size: 14.5px; }
.ac-summary ul:only-of-type { align-self: center; }
.ac-summary li:only-child { list-style: none; margin-left: -18px; }

/* fedehaceb.css (.fh-field input:not(...), .fh-field select:not(...)) pinta fondo blanco y le gana al aspecto de
   solo lectura / deshabilitado de .form-control: se recupera para los campos que no se editan.
   Sin :is() a propósito: un navegador que no lo entienda descartaría la regla entera (también la del select). */
.fh-field input.form-control[readonly]:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.fh-field input.form-control:disabled:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.fh-field select.custom-select:disabled:not([multiple]):not([size]) {
    background-color: var(--crema-2);
    border-color: #A8B9A2;
    color: var(--ink-2);
}

.fh-field .form-control:disabled,
.fh-field .custom-select:disabled { cursor: not-allowed; }

/* Mensajes de campo: los vacíos (válidos) no ocupan espacio en la grilla del campo */
.fh-field .field-validation-valid { display: none; }

/* En una fila de campos, si uno muestra error el otro se estira: sin esto su grilla reparte el alto y desalinea el control */
.fh-field { align-content: start; }

.ac-rules {
    margin: 4px 0 20px;
    padding: 18px 20px;
    border-radius: var(--r-sub);
    background: var(--crema-2);
}

.ac-rules__title { margin: 0 0 12px; font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.ac-rules .fh-checks { gap: 8px; font-size: 14.5px; }
.ac-rules .fh-checks li { padding-left: 32px; }
.ac-rules .fh-checks li::before { width: 20px; height: 20px; background-size: 12px; }

/* ------------------------------------------------------------------ 4. Formularios de administración */
.ac-admin-form { max-width: 920px; }
.ac-admin-form .fh-actions { margin-top: 12px; }
.ac-admin-form .fh-check { margin: 0 0 18px; }
.ac-admin-form .fh-check span { color: var(--ink); font-weight: 600; }

/* Lista de datos clave/valor (Detalle del usuario) */
.ac-dl {
    display: grid;
    grid-template-columns: minmax(150px, 240px) minmax(0, 1fr);
    margin: 0;
}

.ac-dl dt,
.ac-dl dd {
    margin: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--linea);
}

.ac-dl dt { padding-right: 16px; font-weight: 600; font-size: 14px; color: var(--muted); }
.ac-dl dd { font-weight: 500; word-break: break-word; }
.ac-dl dt:last-of-type,
.ac-dl dd:last-of-type { border-bottom: 0; }

@media (max-width: 560px) {
    .ac-dl { grid-template-columns: minmax(0, 1fr); }
    .ac-dl dt { padding-bottom: 0; border-bottom: 0; }
    .ac-dl dd { padding-top: 4px; }
    .ac-dl dt:last-of-type { border-bottom: 0; }
}

/* ------------------------------------------------------------------ 5. Listado de usuarios */
.ac-users { padding: 24px; }
.ac-users .fh-card__head { align-items: flex-end; }
.ac-users .fh-card__head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }

.ac-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
}

.ac-legend li { display: inline-flex; align-items: center; gap: 8px; }

.ac-legend__ico {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--b, var(--ink));
    color: var(--bt, #fff);
}

.ac-legend__ico svg.i { width: 15px; height: 15px; }
.ac-legend__ico--mango { --b: var(--mango); --bt: var(--ink); }
.ac-legend__ico--menta { --b: var(--menta); --bt: var(--ink); }
.ac-legend__ico--rojo { --b: var(--rojo); --bt: #fff; }

.ac-users table.dataTable { margin-top: 0 !important; }
.ac-users .ac-actions { display: inline-flex; gap: 6px; }

/* Aire entre el buscador de DataTables y la tabla */
.ac-users div.dataTables_wrapper div.dataTables_filter { margin-bottom: 12px; }

@media (max-width: 760px) {
    .ac-users { padding: 16px 12px; border-radius: var(--r-md); }
    .ac-users .fh-card__head { margin-bottom: 14px; }
}

/* Modal "Actualizar permisos y correo" */
.ac-perms { margin: 4px 0 6px; padding: 0; border: 0; min-width: 0; }
.ac-perms legend { margin: 0 0 10px; font-size: 1.05rem; }

.ac-perms__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    gap: 0 16px;
}

#updateDialog .modal-body { padding: 22px 28px 8px; }
#updateDialog .modal-footer { padding: 14px 24px 20px; border-top: 2px dashed var(--linea); }

@media (max-width: 575px) {
    #updateDialog .modal-body { padding: 18px 18px 4px; }
    #updateDialog .modal-footer { justify-content: stretch; }
    #updateDialog .modal-footer .fh-btn { flex: 1 1 0; }
}
