/**
 * Pantallas de acceso (login/registro) y panel "Ver como".
 *
 * Los acentos usan las variables de color de Filament (`--primary-*`, canales "R, G, B"),
 * para que respeten el color primario de cada organización (ApplyOrganizationTenantThemeColors).
 * Nunca fijar aquí el coral de marca: en el panel de una organización el acento debe ser el suyo.
 *
 * Se registra como asset global de Filament (AppServiceProvider), porque el modal "Ver como"
 * se renderiza en la barra superior de todos los paneles. Las reglas que solo valen para las
 * pantallas de acceso se limitan a `.custom-auth-wrapper` (el layout de filament-auth-ui-enhancer).
 */

/* ---------------------------------------------------------------- Pantalla de acceso */

.custom-auth-wrapper .fi-logo {
    display: none;
}

.custom-auth-wrapper .text-custom-600,
.dark .custom-auth-wrapper .text-custom-400 {
    color: #333bdd !important;
    font-weight: 600;
    text-decoration: underline;
}

.auth-topbar {
    position: fixed;
    top: 22px;
    right: 32px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cta-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    border-radius: 8px;
    padding: 12px 14px 14px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: all 0.3s ease-out;
}

.cta-btn svg {
    width: 24px;
    height: 24px;
}

.cta-demo {
    background-color: rgb(var(--primary-500));
    color: #fff;
    box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.1);
}

.cta-demo svg {
    color: rgb(var(--primary-200));
}

.cta-demo:hover {
    background-color: rgb(var(--primary-600));
    box-shadow: 0 15px 30px 0 rgba(var(--primary-500), 0.4);
}

.cta-web {
    background-color: #f6f6f6;
    color: #3c3b3e;
    box-shadow: 0 5px 5px 0 rgba(0, 0, 0, 0.05);
}

.cta-web:hover {
    background-color: #fff;
    color: #7b7b82;
    box-shadow: 0 15px 30px 0 rgba(0, 0, 0, 0.1);
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
    padding: 6px 5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.lang-switcher__flag {
    display: inline-flex;
    width: 20px;
    height: 20px;
    overflow: hidden;
}

.lang-switcher__flag img {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: cover;
    object-position: 0% 50%;
}

.lang-switcher__code {
    padding: 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
    color: #3c3b3e;
}

.lang-switcher__caret {
    width: 16px;
    height: 16px;
    color: #3c3b3e;
}

/* ------------------------------------------------- Columna visual (carrusel de novedades) */

.auth-visual {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #12141a;
}

/* Capa de fondo por slide (fuera del carrusel) para poder hacer cross-fade entre imágenes. */
.auth-visual__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: contrast(0.8) brightness(0.6);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.auth-visual__bg.is-visible {
    opacity: 1;
}

/* Velo inferior para que el texto del slide sea legible sobre cualquier imagen. */
.auth-visual__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(17, 19, 24, 0) 42%, rgba(17, 19, 24, 0.72) 100%);
}

.auth-visual__logo {
    position: absolute;
    top: 31px;
    left: 32px;
    z-index: 20;
}

.auth-visual__logo img {
    display: block;
    height: 38px;
    width: auto;
}

.auth-visual__content {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 100px;
}

/* Slides a sangre: el padding va dentro para que la imagen de fondo ocupe todo el ancho. */
.auth-visual .splide__slide {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 100px;
}

/* Evita el flash de todos los slides apilados mientras Splide monta. */
.auth-visual .splide:not(.is-initialized) .splide__list {
    display: block;
}

.auth-visual .splide:not(.is-initialized) .splide__slide {
    display: none;
}

.auth-visual .splide:not(.is-initialized) .splide__slide:first-child {
    display: flex;
}

.auth-visual__media {
    margin-bottom: 52px;
}

.auth-visual__image {
    display: block;
    width: 100%;
    border-radius: 16px;
}

.auth-visual__headline {
    font-weight: 700;
    font-size: 36px;
    line-height: 1.08;
    color: #fff;
}

.auth-visual__desc {
    margin-top: 14px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
}

.auth-visual__dots {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    padding-left: 100px;
}

.auth-visual__dot {
    height: 8px;
    width: 8px;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    cursor: pointer;
}

.auth-visual__dot.is-active {
    width: 36px;
    background: rgb(var(--primary-500));
}

@media (max-width: 1023px) {
    .auth-visual__content {
        display: none;
    }
}

/* Tarjeta de notificación de ejemplo (slide sin imagen adjunta). */
.notif-card {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
}

.notif-card__avatar {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #d9dce1;
}

.notif-card__body {
    flex: 1;
    min-width: 0;
}

.notif-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.notif-card__name {
    font-weight: 700;
    font-size: 15px;
    color: #1f2430;
}

.notif-card__time {
    flex: none;
    font-size: 13px;
    color: #9aa0aa;
}

.notif-card__text {
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.35;
    color: #5b616e;
}

.notif-card__badge {
    position: absolute;
    left: 16px;
    bottom: -11px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgb(var(--primary-500));
    box-shadow: 0 4px 10px rgba(var(--primary-500), 0.45);
}

.notif-card__badge svg {
    width: 13px;
    height: 13px;
    color: #fff;
}

/* ------------------------------------------------------------ Selector de rol ("Ver como") */

.role-switch {
    width: 100%;
    max-width: 440px;
}

.role-switch__header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 40px;
}

.role-switch__glyph {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e9ebee;
}

.role-switch__glyph svg {
    width: 30px;
    height: 30px;
    color: #9aa0aa;
}

.role-switch__title {
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    color: #1f2430;
}

.role-switch__sub {
    margin-top: 8px;
    font-size: 15px;
    color: #6b7280;
}

.role-switch__logout,
.role-switch__support {
    color: #333bdd;
    font-weight: 700;
    text-decoration: underline;
}

.role-switch__logout {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.role-switch__label {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #3c3b3e;
}

.role-switch__list {
    border: 1px solid #e7e9ed;
    border-radius: 14px;
    overflow: hidden;
}

.role-switch__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid #eef0f3;
    font-size: 16px;
    font-weight: 600;
    color: #3c3b3e;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.role-switch__item:last-child {
    border-bottom: 0;
}

.role-switch__item:hover:not(.is-current) {
    background: rgb(var(--primary-500));
    color: #fff;
}

.role-switch__item.is-current {
    background: rgba(var(--primary-500), 0.12);
    color: rgb(var(--primary-600));
}

.role-switch__icon {
    flex: none;
    display: flex;
    color: #6b7280;
}

/* En hover y en el panel actual el icono toma el color del propio item. */
.role-switch__item:hover:not(.is-current) .role-switch__icon,
.role-switch__item.is-current .role-switch__icon {
    color: inherit;
}

.role-switch__icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.role-switch__name {
    flex: 1;
}

.role-switch__badge {
    flex: none;
    padding: 4px 12px;
    border-radius: 99px;
    background: rgb(var(--primary-500));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.role-switch__footer {
    margin-top: 32px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.role-switch__support {
    display: block;
    margin-top: 2px;
}

.dark .role-switch__glyph {
    background: #27272a;
}

.dark .role-switch__glyph svg {
    color: #a1a1aa;
}

.dark .role-switch__title {
    color: #f4f4f5;
}

.dark .role-switch__sub,
.dark .role-switch__footer,
.dark .role-switch__icon {
    color: #a1a1aa;
}

.dark .role-switch__logout,
.dark .role-switch__support {
    color: #a5b4fc;
}

.dark .role-switch__label {
    color: #e4e4e7;
}

.dark .role-switch__list {
    border-color: #3f3f46;
}

.dark .role-switch__item {
    color: #e4e4e7;
    border-bottom-color: #27272a;
}

.dark .role-switch__item.is-current {
    background: rgba(var(--primary-500), 0.15);
    color: rgb(var(--primary-400));
}

/* --------------------------------------------------------- Modal "Ver como" (pantalla completa) */

.ver-como-modal .fi-modal-window {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
}

.ver-como-modal .fi-modal-content {
    padding: 0;
    gap: 0;
}

.ver-como {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #fff;
    transform: scale(0.94);
    transform-origin: center center;
    opacity: 0;
    filter: brightness(0.6);
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 240ms cubic-bezier(0.16, 1, 0.3, 1),
        filter 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ver-como.is-open {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
}

.ver-como__visual {
    position: relative;
    flex: none;
    width: 42%;
}

.ver-como__panel {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 56px;
}

.ver-como__close {
    position: absolute;
    top: 22px;
    right: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 0;
    border-radius: 8px;
    background: #f6f6f6;
    color: #3c3b3e;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ver-como__close:hover {
    background: #ececec;
}

.ver-como__close svg {
    width: 20px;
    height: 20px;
}

.dark .ver-como {
    background: #18181b;
}

.dark .ver-como__close {
    background: #27272a;
    color: #d4d4d8;
}

.dark .ver-como__close:hover {
    background: #3f3f46;
}

@media (max-width: 1023px) {
    .ver-como__visual {
        display: none;
    }

    .ver-como__panel {
        padding: 28px 20px;
    }
}
