/**
 * Athena Gym Management System
 * Barra de navegación inferior (móvil) + bottom sheet "Más"
 *
 * Reemplaza el sidebar deslizable en pantallas < xl (1200px).
 * Desktop (>= xl) conserva el sidebar tradicional sin cambios.
 */

:root {
    --athena-bottomnav-height: 60px;
}

/* ============================================================
   Barra inferior fija
   ============================================================ */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    align-items: stretch;
    height: calc(var(--athena-bottomnav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* Identidad de marca Athena (slate-blue), como el FAB y los headers */
    background: var(--athena-bg-primary, linear-gradient(135deg, #435971 0%, #566a7f 100%));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--athena-shadow-lg, 0 -4px 12px rgba(0, 0, 0, 0.15));
}

/* Grupos laterales: reparten el espacio a izquierda y derecha de la gota */
.mobile-bottom-nav__side {
    flex: 1 1 0;
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.mobile-bottom-nav__item {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 0.6875rem;     /* 11px */
    line-height: 1.1;
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}

.mobile-bottom-nav__item i {
    font-size: 1.375rem;      /* ~22px */
    line-height: 1;
    transition: transform 0.15s ease-in-out;
}

.mobile-bottom-nav__item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-bottom-nav__item:hover,
.mobile-bottom-nav__item:focus {
    color: #ffffff;
}

.mobile-bottom-nav__item.active {
    color: #ffffff;
    font-weight: 600;
}

.mobile-bottom-nav__item.active i {
    transform: translateY(-1px);
}

/* Punto de notificaciones pendientes (campana) */
.mobile-bottom-nav__dot {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bs-danger, #ef4444);
    border: 1.5px solid var(--athena-primary-darker, #1a252f);
}

.mobile-bottom-nav__dot[hidden] {
    display: none;
}

/* ============================================================
   Gota central: botón flotante de acciones rápidas
   ============================================================ */
.mobile-bottom-nav__center {
    flex: 0 0 72px;
    position: relative;
}

.mobile-bottom-nav__fab {
    position: absolute;
    left: 50%;
    top: -22px;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Círculo claro que "flota" sobre la barra slate (efecto gota) */
    background: #ffffff;
    color: var(--athena-primary-dark, #2c3e50);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    z-index: 2;
    transition: transform 0.12s ease-in-out, box-shadow 0.15s ease-in-out;
}

.mobile-bottom-nav__fab i {
    font-size: 2rem;
    line-height: 1;
}

.mobile-bottom-nav__fab:hover,
.mobile-bottom-nav__fab:focus {
    color: var(--athena-primary-darker, #1a252f);
}

.mobile-bottom-nav__fab:active {
    transform: translateX(-50%) scale(0.92);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Bottom sheet de acciones rápidas
   ============================================================ */
/* Selector específico (.offcanvas-bottom.quick-actions-sheet) para ganarle a
   la altura por defecto de Bootstrap (--bs-offcanvas-height ~30vh) que
   recortaba la segunda fila de acciones. */
.offcanvas-bottom.quick-actions-sheet {
    height: auto;
    max-height: 85vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: var(--athena-shadow-lg, 0 -4px 12px rgba(0, 0, 0, 0.15));
    background: var(--athena-primary-darker, #1a252f);
    color: var(--bs-body-color, #ffffff);
}

.quick-actions-sheet .offcanvas-header {
    position: relative;
    padding-top: 1.25rem;
}

.quick-actions-sheet .offcanvas-header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
}

.quick-actions-sheet .offcanvas-title {
    color: #ffffff;
    font-weight: 600;
}

.quick-actions-sheet .offcanvas-body {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
    transition: background 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.quick-action:hover,
.quick-action:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.quick-action:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.16);
}

.quick-action__icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    color: #ffffff;
    flex-shrink: 0;
}

/* Color propio para "Registrar pago" (slate claro de marca) */
.quick-action__icon--pay {
    background: var(--athena-primary-lighter, #6f7f93);
}

.quick-action__label {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Indicador superior del item activo */
.mobile-bottom-nav__item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: #ffffff;
}

/* ============================================================
   Bottom sheet "Más"
   ============================================================ */
.mobile-more-sheet {
    /* Es el menú principal en móvil: hoja grande (no un sheet pequeño) */
    height: 80vh;
    max-height: 85vh;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: var(--athena-shadow-lg, 0 -4px 12px rgba(0, 0, 0, 0.15));
    /* Misma identidad slate-blue que la barra inferior, FAB y headers */
    background: var(--athena-primary-darker, #1a252f);
    color: var(--bs-body-color, #ffffff);
}

/* Asita (grabber) superior, estilo app nativa */
.mobile-more-sheet .offcanvas-header {
    position: relative;
    padding-top: 1.25rem;
}

.mobile-more-sheet .offcanvas-header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: var(--athena-border, #dee2e6);
}

.mobile-more-sheet .offcanvas-title {
    color: var(--bs-body-color, #ffffff);
    font-weight: 600;
}

.mobile-more-sheet .offcanvas-body {
    padding-top: 0.25rem;
    flex: 1 1 auto;
    overflow-y: auto;
}

.mobile-more-sheet__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-more-sheet__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem;
    color: var(--bs-body-color, #e5e5e5);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
}

.mobile-more-sheet__list li:last-child .mobile-more-sheet__link {
    border-bottom: 0;
}

.mobile-more-sheet__link i:first-child {
    font-size: 1.25rem;
    color: var(--bs-text-secondary, #b0b3b8);
}

.mobile-more-sheet__link.active {
    color: var(--bs-body-color, #ffffff);
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.mobile-more-sheet__link.active i:first-child {
    color: var(--bs-body-color, #ffffff);
}

.mobile-more-sheet__link:hover,
.mobile-more-sheet__link:focus {
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

/* ============================================================
   Ajustes de layout en móvil (< xl): ocultar sidebar y dar
   espacio inferior para que la barra no tape el contenido.
   ============================================================ */
@media (max-width: 1199.98px) {
    /* Reservar espacio para la barra inferior */
    .content-wrapper {
        padding-bottom: calc(var(--athena-bottomnav-height) + env(safe-area-inset-bottom, 0px));
    }

    /* El sidebar se reemplaza por la barra inferior + "Más" */
    #layout-menu {
        display: none !important;
    }

    /* Evitar que el disparador del sidebar abra el menú lateral */
    .layout-menu-toggle {
        display: none !important;
    }
}

/* En escritorio la barra inferior nunca se muestra (refuerza d-xl-none) */
@media (min-width: 1200px) {
    .mobile-bottom-nav,
    .mobile-more-sheet,
    .quick-actions-sheet {
        display: none !important;
    }
}

/* ============================================================
   Pantallas de formulario (crear/editar): modo enfocado.
   Si la pantalla incluye el footer de acciones, se oculta la barra
   inferior para que Guardar/Cancelar no queden tapados.
   Auto-aplicado a cualquier pantalla con .mobile-action-footer
   (no requiere flag en la vista).
   ============================================================ */
@media (max-width: 1199.98px) {
    body:has(.mobile-action-footer) .mobile-bottom-nav,
    body:has(.mobile-action-footer) .mobile-more-sheet,
    body:has(.mobile-action-footer) .quick-actions-sheet {
        display: none !important;
    }
}

/* < md: el footer de acciones es fijo -> reservar su alto (no el de la nav) */
@media (max-width: 767.98px) {
    body:has(.mobile-action-footer) .content-wrapper {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
}

/* md-xl (tablet): el footer es in-flow (desktop_form_footer); sin reserva de nav */
@media (min-width: 768px) and (max-width: 1199.98px) {
    body:has(.mobile-action-footer) .content-wrapper {
        padding-bottom: 0;
    }
}
