:root {
    /* Tema base (se sobreescribe por pool via --pool-primary/--pool-secondary) */
    --app-primary: #013369;   /* azul NFL */
    --app-accent: #d50a0a;    /* rojo NFL */
    --app-bg: #f4f6f9;
    --app-surface: #ffffff;
    --app-sidebar-width: 250px;
    --app-bottomnav-height: 62px;
}

html, body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background-color: var(--app-bg);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--app-primary);
}

.btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #012a57;
    border-color: #012a57;
}

.btn-accent {
    background-color: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

/* ===== Estructura general ===== */
.app-shell {
    min-height: 100vh;
}

.app-content {
    padding: 1rem;
    /* espacio para la bottom nav en móvil (+ safe area iOS) */
    padding-bottom: calc(var(--app-bottomnav-height) + env(safe-area-inset-bottom) + 1rem);
}

@media (min-width: 992px) {
    .app-content {
        margin-left: var(--app-sidebar-width);
        padding: 1.5rem 2rem;
    }
}

/* ===== Header móvil ===== */
.app-mobile-header {
    background: var(--app-primary);
    color: #fff;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-mobile-header .brand {
    font-weight: 700;
    letter-spacing: .5px;
}

/* ===== Sidebar desktop ===== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--app-sidebar-width);
    background: linear-gradient(180deg, var(--app-primary) 0%, #001f3f 100%);
    color: #fff;
    z-index: 1030;
    display: flex;
    flex-direction: column;
}

.app-sidebar .brand {
    font-size: 1.15rem;
    font-weight: 700;
    padding: 1.1rem 1.25rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: .5px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.app-sidebar .brand .bi {
    color: var(--app-accent);
}

.app-sidebar .nav-section {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.45);
    padding: 1rem 1.25rem .35rem;
}

.app-sidebar .nav-link {
    color: rgba(255,255,255,.82);
    padding: .55rem 1.25rem;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: .65rem;
}

.app-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}

.app-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.10);
    border-left-color: var(--app-accent);
}

.app-sidebar .sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: .85rem;
    color: rgba(255,255,255,.7);
}

/* ===== Bottom nav móvil ===== */
.app-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--app-bottomnav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--app-surface);
    border-top: 1px solid #e2e6ea;
    display: flex;
    z-index: 1030;
}

.app-bottomnav .nav-item-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #8a94a0;
    text-decoration: none;
    font-size: .68rem;
}

.app-bottomnav .nav-item-mobile .bi {
    font-size: 1.35rem;
    line-height: 1;
}

.app-bottomnav .nav-item-mobile.active {
    color: var(--app-primary);
    font-weight: 600;
}

/* ===== Tarjetas de equipo (grid de picks) ===== */
.team-card {
    border: 2px solid transparent;
    border-radius: .75rem;
    background: var(--app-surface);
    transition: transform .1s ease, border-color .1s ease;
    cursor: pointer;
    user-select: none;
}

.team-card:hover:not(.disabled) {
    transform: translateY(-2px);
    border-color: var(--app-primary);
}

.team-card.selected {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 .2rem rgba(213,10,10,.15);
}

.team-card.disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(60%);
}

.team-card img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

/* ===== Marcadores ===== */
.score-card {
    background: var(--app-surface);
    border-radius: .75rem;
    border: 1px solid #e2e6ea;
}

.score-card .team-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.score-live {
    color: var(--app-accent);
    font-weight: 700;
}

/* ===== Validación / errores (template Blazor) ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ocurrió un error.";
}

/* Overlay de reconexión de circuito */
#components-reconnect-modal {
    color-scheme: light only;
}

/* Overlay de reconexión Blazor */
#components-reconnect-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

#components-reconnect-modal.components-reconnect-hide {
    display: none;
}

#components-reconnect-modal .reconnect-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.5rem 2rem;
    text-align: center;
    max-width: 320px;
}

#components-reconnect-modal.components-reconnect-failed .spinner-border,
#components-reconnect-modal.components-reconnect-rejected .spinner-border {
    display: none;
}

/* ===== Tablero calendario de picks ===== */
.board-wrap {
    overflow-x: auto;
    background: var(--app-surface);
    border: 1px solid #e2e6ea;
    border-radius: .75rem;
}

.board-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    font-size: .8rem;
}

.board-table th, .board-table td {
    border: 1px solid #eef1f4;
    text-align: center;
    vertical-align: middle;
    padding: .3rem .35rem;
}

.board-table thead th {
    background: #fdf6e3;
    position: sticky;
    top: 0;
    z-index: 2;
}

.board-week-col { min-width: 46px; }
.board-week-date { font-size: .62rem; color: #8a94a0; }

.board-name-col {
    position: sticky;
    left: 0;
    background: var(--app-surface);
    text-align: left !important;
    min-width: 150px;
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    z-index: 1;
}

.board-table thead .board-name-col { z-index: 3; background: #fdf6e3; }

.board-total-col { min-width: 42px; background: #fafbfc; }

.board-row-dead td { background: #fbf2f2; }
.board-row-dead .board-name-col { color: #b02a37; text-decoration: line-through; background: #fbf2f2; }
.board-row-mine .board-name-col { color: var(--app-primary); }

.board-cell { padding: .15rem !important; }

.board-pick {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    border: 1.5px solid #d7dde3;
    border-radius: .35rem;
    cursor: pointer;
    background: #fff;
}

.board-pick:hover { border-color: var(--app-primary); }
.board-pick img { width: 24px; height: 24px; object-fit: contain; }

.board-pick-win-home { border-color: #26b050; background-color: #fdfbf2; } /* crema tenue */
.board-pick-win-away { border-color: #26b050; background-color: #e6f9ec; } /* verde tenue */
.board-pick-loss { border-color: #dc3545; background: #fdecec; }
.board-pick-loss img { filter: grayscale(100%); opacity: .45; }
.board-pick-tie { border-color: #ffc107; }
.board-pick-void { border-color: #adb5bd; opacity: .6; }

.board-x {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-size: 1.15rem;
    font-weight: 700;
    text-shadow: 0 0 3px #fff;
}

.board-check {
    position: absolute;
    right: -4px;
    bottom: -5px;
    color: #26b050;
    font-size: .8rem;
    font-weight: 700;
    text-shadow: 0 0 2px #fff;
}

.board-footer td {
    background: #fdf6e3;
    border-top: 2px solid #f0e3bb;
}

/* Popover de detalle del partido */
.board-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1049;
}

.board-popover {
    position: fixed;
    z-index: 1050;
    width: 280px;
    background: #fff;
    border: 1px solid #d7dde3;
    border-radius: .6rem;
    box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.2);
    padding: .75rem .9rem;
}

.board-pop-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .15rem 0;
}

.board-pop-row img { width: 26px; height: 26px; object-fit: contain; }
.board-pop-row .team { flex: 1; }
.board-pop-row .score { font-size: 1.05rem; font-weight: 700; }

/* ===== Carrusel promocional (100% Blazor, sin JS de Bootstrap) ===== */
.promo-carousel {
    position: relative;
    border-radius: .75rem;
    overflow: hidden;
    background: #0b1622;
    box-shadow: 0 .25rem .75rem rgba(0,0,0,.12);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/*
   Altura fija del viewport: todas las diapositivas miden lo mismo, así una promo
   de solo texto no hereda el alto de un flyer vertical (y viceversa).
*/
.promo-viewport {
    position: relative;
    height: 300px;
}

@media (max-width: 575.98px) {
    .promo-viewport { height: 260px; }
}

@media (min-width: 992px) {
    .promo-viewport { height: 330px; }
}

/* Absoluto (no grid): con height:100% dentro de una fila 'auto' la altura
   se vuelve circular y las slides se desbordan del viewport. */
.promo-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s ease;
    pointer-events: none;
}

.promo-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.promo-link { display: block; height: 100%; text-decoration: none; }

.promo-body {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Copia difuminada al fondo para rellenar los lados de imágenes verticales */
.promo-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(22px) brightness(.5) saturate(1.2);
    transform: scale(1.15);
}

/* La imagen real, completa y centrada */
.promo-img {
    position: relative;
    z-index: 1;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Texto sobre imagen: franja inferior legible */
.promo-caption {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem 1rem .75rem;
    background: linear-gradient(transparent, rgba(0,0,0,.85));
    color: #fff;
    text-align: center;
}

/* Promo sin imagen: ocupa toda la altura, centrada */
.promo-caption-solo {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    height: 100%;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--app-primary) 0%, #001f3f 60%, #3a0d0d 100%);
}

.promo-title { font-weight: 700; font-size: 1.15rem; line-height: 1.25; }
.promo-text { font-size: .88rem; opacity: .92; }

.promo-caption-solo .promo-title { font-size: 1.4rem; max-width: 22ch; }
.promo-caption-solo .promo-text { font-size: .95rem; max-width: 42ch; }

/* Controles */
.promo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-nav:hover { background: rgba(0,0,0,.65); }
.promo-prev { left: .5rem; }
.promo-next { right: .5rem; }

.promo-dots {
    position: absolute;
    bottom: .5rem;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: .35rem;
}

.promo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    background: rgba(255,255,255,.45);
}

.promo-dot.is-active { background: #fff; width: 20px; border-radius: 4px; }

/* Imagen ampliada al tocar (flyers verticales) */
.promo-zoomable { cursor: zoom-in; }

.promo-zoom-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0,0,0,.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: zoom-out;
}

.promo-zoom-img {
    max-width: 100%;
    max-height: 92vh;
    object-fit: contain;
    border-radius: .5rem;
    box-shadow: 0 1rem 2rem rgba(0,0,0,.5);
}

.promo-zoom-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 1.1rem;
}

.promo-zoom-close:hover { background: rgba(255,255,255,.3); }

/* Miniatura en el admin */
.promo-thumb {
    width: 90px;
    height: 60px;
    object-fit: cover;
    border-radius: .35rem;
    background: #0b1622;
}

/* ===== Vista previa de logos (Admin -> Configuracion) ===== */
.brand-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    height: 90px;
    border-radius: .5rem;
    border: 1px dashed #ced4da;
    padding: .5rem;
}

.brand-preview img { max-height: 56px; max-width: 80%; object-fit: contain; }
.brand-preview-light { background: #f4f6f9; }
.brand-preview-dark { background: var(--app-primary); border-color: rgba(255,255,255,.25); }

/* Logo grande del landing / login */
.brand-hero { max-width: 260px; width: auto; object-fit: contain; }

/* ===== Fotos de perfil ===== */
.avatar-mini, .avatar-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--app-primary);
    color: #fff;
    font-weight: 700;
    flex: none;
}

.avatar-mini {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: .9rem;
}

.avatar-edit {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    font-size: 2.4rem;
    border: 3px solid var(--line);
}

.avatar-mini img, .avatar-edit img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Foto junto al nombre en standings y tablero */
.avatar-inline {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: .35rem;
    vertical-align: middle;
    background: var(--app-primary);
}
