/* ==============================================================
   GymManager - Estilos propios
   Complementan Bootstrap 5; no lo reemplazan.
   ============================================================== */

:root {
    --gm-primary: #1b6ef3;
    --gm-primary-dark: #1450b5;
    --gm-sidebar-bg: #101828;
    --gm-sidebar-hover: #1d2739;
    --gm-sidebar-text: #c3cbd9;
    --gm-body-bg: #f4f6fa;
    --gm-border: #e4e8ef;
    --gm-sidebar-width: 250px;
    --gm-header-height: 62px;
}

body {
    background-color: var(--gm-body-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.925rem;
    color: #1f2937;
}

a { text-decoration: none; }

/* ---------------- Layout ---------------- */
.gm-layout { min-height: 100vh; }

.gm-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--gm-sidebar-width);
    background: var(--gm-sidebar-bg);
    color: var(--gm-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1045;
    transition: transform .2s ease-in-out;
    overflow-y: auto;
}

.gm-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    height: var(--gm-header-height);
    padding: 0 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #fff;
    font-weight: 600;
    letter-spacing: .2px;
    flex: 0 0 auto;
}

.gm-sidebar__brandmark {
    width: 32px; height: 32px; border-radius: .55rem; padding: 2px;
    background: rgba(255, 255, 255, .08); display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto;
}

.gm-exercise-results {
    z-index: 1080;
    max-height: 280px;
    overflow-y: auto;
}

.gm-field-xs { width: 58px; }
.gm-field-sm { width: 82px; }
.gm-sidebar__brandmark img { width: 100%; height: 100%; object-fit: contain; border-radius: .45rem; }
.gm-sidebar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gm-sidebar__nav { padding: .75rem .6rem 1.5rem; flex: 1 1 auto; }

.gm-sidebar__label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #667085;
    padding: 1rem .75rem .35rem;
    font-weight: 600;
}

.gm-sidebar__link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .58rem .75rem;
    border-radius: .5rem;
    color: var(--gm-sidebar-text);
    font-weight: 500;
    margin-bottom: 2px;
}

.gm-sidebar__link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.gm-sidebar__link:hover { background: var(--gm-sidebar-hover); color: #fff; }
.gm-sidebar__link.active { background: var(--gm-primary); color: #fff; }

.gm-main {
    margin-left: var(--gm-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.gm-header {
    height: var(--gm-header-height);
    background: #fff;
    border-bottom: 1px solid var(--gm-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.gm-content { padding: 1.35rem; flex: 1 1 auto; }

.gm-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    z-index: 1040;
}

/* ---------------- Componentes ---------------- */
.card { border: 1px solid var(--gm-border); border-radius: .65rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--gm-border); font-weight: 600; padding: .85rem 1.1rem; }

.gm-stat { display: flex; align-items: center; gap: .9rem; }
.gm-stat__icon {
    width: 46px; height: 46px; border-radius: .65rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex: 0 0 auto;
}
.gm-stat__value { font-size: 1.5rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.gm-stat__label { font-size: .8rem; color: #667085; }

/* Permite que el texto de las tarjetas se encoja dentro del contenedor flex
   (Bootstrap no incluye esta utilidad). */
.min-w-0 { min-width: 0; }

.gm-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    object-fit: cover; background: #e9eef7; color: var(--gm-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .85rem; flex: 0 0 auto;
}
.gm-avatar--lg { width: 96px; height: 96px; font-size: 1.9rem; }
.gm-avatar--xl { width: 130px; height: 130px; font-size: 2.6rem; }

.table > :not(caption) > * > * { padding: .68rem .75rem; }
.table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: #667085; background: #fafbfd; white-space: nowrap; }
.table-hover tbody tr:hover { background-color: #f7f9fc; }

.badge { font-weight: 600; letter-spacing: .01em; }
.gm-empty { text-align: center; padding: 2.5rem 1rem; color: #98a2b3; }
.gm-empty i { font-size: 2.4rem; display: block; margin-bottom: .6rem; }

.gm-qr-frame {
    width: max-content; max-width: 100%; padding: 18px;
    background: #fff; border: 1px solid var(--gm-border); border-radius: .75rem;
    box-shadow: 0 4px 14px rgba(16, 24, 40, .08);
}
.gm-qr-frame canvas, .gm-qr-frame img { display: block; max-width: 100%; height: auto !important; }

.gm-filters .form-label { font-size: .78rem; font-weight: 600; color: #667085; margin-bottom: .2rem; }

/* ---------------- Control de acceso ---------------- */
.gm-access-result {
    border-radius: .85rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    color: #fff;
    animation: gm-pop .18s ease-out;
}
.gm-access-result--ok { background: linear-gradient(160deg, #12b76a, #0e9455); }
.gm-access-result--denied { background: linear-gradient(160deg, #f04438, #b42318); }
.gm-access-result--warn { background: linear-gradient(160deg, #f79009, #b54708); }
.gm-access-result h2 { font-weight: 700; letter-spacing: .02em; }
.gm-access-photo {
    width: 132px; height: 132px; border-radius: 50%;
    object-fit: cover; border: 4px solid rgba(255, 255, 255, .65);
    background: rgba(255, 255, 255, .2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.8rem; font-weight: 700; color: #fff;
}
#gm-reader { border-radius: .65rem; overflow: hidden; }
#gm-reader video { width: 100% !important; border-radius: .65rem; }

@keyframes gm-pop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* ---------------- Punto de venta ---------------- */
.gm-pos-product {
    border: 1px solid var(--gm-border);
    border-radius: .6rem;
    padding: .7rem;
    cursor: pointer;
    background: #fff;
    height: 100%;
    transition: border-color .12s, box-shadow .12s;
}
.gm-pos-product:hover { border-color: var(--gm-primary); box-shadow: 0 2px 8px rgba(27, 110, 243, .12); }
.gm-pos-product.disabled { opacity: .5; cursor: not-allowed; }
.gm-pos-product__name { font-weight: 600; font-size: .86rem; line-height: 1.25; }
.gm-pos-product__price { color: var(--gm-primary); font-weight: 700; }
.gm-pos-cart { max-height: 46vh; overflow-y: auto; }
.gm-pos-total { font-size: 1.65rem; font-weight: 700; }

/* ---------------- Login ---------------- */
.gm-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #101828 0%, #1b6ef3 140%);
    padding: 1.5rem;
}
.gm-login__card { width: 100%; max-width: 410px; border-radius: .85rem; }
.gm-login__logo {
    width: 62px; height: 62px; border-radius: .9rem;
    display: block; object-fit: contain; margin: 0 auto 1rem;
    box-shadow: 0 8px 20px rgba(16, 24, 40, .18);
}

/* ---------------- Impresion ---------------- */
@media print {
    .gm-sidebar, .gm-header, .no-print { display: none !important; }
    .gm-main { margin-left: 0; }
    .gm-content { padding: 0; }
    body { background: #fff; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .gm-sidebar { transform: translateX(-100%); }
    .gm-sidebar.show { transform: translateX(0); }
    .gm-main { margin-left: 0; }
    .gm-backdrop.show { display: block; }
    .gm-content { padding: 1rem .85rem; }
}

@media (max-width: 575.98px) {
    body { font-size: .9rem; }
    .gm-stat { gap: .6rem; }
    .gm-stat__icon { width: 38px; height: 38px; font-size: 1.05rem; }
    .gm-stat__value { font-size: 1.15rem; }
    .gm-stat__label { font-size: .74rem; }
    .gm-content { padding: .85rem .7rem; }
    .card-header { padding: .7rem .85rem; }
    .table-responsive { border-radius: .5rem; }
}
