/* ============================================================
   BlackLab — retint del tema abstack
   Carga DESPUÉS de vendor/abstack/css/app.min.css + icons.min.css.
   Redefine tokens (--ct-*) + ajustes de marca:
   lima BlackLab como color primario + superficies negras
   + tipografías Sora / Inter + navegación mobile-first.
   Lo estructural (cards, grid, botones, formularios) lo aporta abstack.
   ============================================================ */

/* ---- Paleta primaria = lima BlackLab ---- */
:root,
[data-bs-theme="dark"] {
    --bl-lime:                 #D0FA03;
    --bl-lime-hi:              #E4FB55;

    --ct-primary:              #D0FA03;
    --ct-primary-rgb:          208, 250, 3;
    --ct-primary-text-emphasis:#D0FA03;
    --ct-primary-bg-subtle:    rgba(208, 250, 3, 0.14);
    --ct-primary-border-subtle:rgba(208, 250, 3, 0.30);
    --ct-link-color:           #D0FA03;
    --ct-link-hover-color:     #E4FB55;
    --ct-link-color-rgb:       208, 250, 3;

    /* semánticos que usa la app */
    --ct-success:              #D0FA03;
    --ct-success-rgb:          208, 250, 3;
    --ct-success-bg-subtle:    rgba(208, 250, 3, 0.14);
    --ct-danger:               #FF4D6D;
    --ct-danger-rgb:           255, 77, 109;
    --ct-danger-bg-subtle:     rgba(255, 77, 109, 0.14);
    --ct-purple:               #A78BFA;

    /* tipografía */
    --ct-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --ct-body-font-size: 0.9rem;
}

/* ---- Superficies negras BlackLab (modo oscuro) ---- */
[data-bs-theme="dark"] {
    --ct-body-bg:            #0B0D10;
    --ct-body-bg-rgb:        11, 13, 16;
    --ct-secondary-bg:       #171B22;   /* = fondo de card */
    --ct-secondary-bg-rgb:   23, 27, 34;
    --ct-tertiary-bg:        #1E242E;
    --ct-tertiary-bg-rgb:    30, 36, 46;
    --ct-border-color:       #2A313C;
    --ct-border-color-translucent: #2A313C;
    --ct-body-color:         #C7CCD3;
    --ct-emphasis-color:     #F2F4F7;
    --ct-secondary-color:    #99A2AD;
    --ct-heading-color:      #F2F4F7;
}

/* Sidebar y topbar: negro puro para separar del contenido */
html[data-bs-theme="dark"][data-menu-color="dark"]   { --ct-menu-bg: #0F1319; --ct-menu-item-color: #99A2AD; --ct-menu-item-hover-color: #FFFFFF; --ct-menu-item-active-color: #D0FA03; }
html[data-bs-theme="dark"][data-topbar-color="dark"] { --ct-topbar-bg: #0F1319; }

/* ---- Tipografía de títulos: Sora ---- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.page-title, .card-title, .card-header h2,
.navbar-custom .topbar-title {
    font-family: 'Sora', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

/* ---- Botón primario lima: texto negro (contraste) ---- */
.btn-primary {
    --ct-btn-color: #0B0D10;
    --ct-btn-bg: #D0FA03;
    --ct-btn-border-color: #D0FA03;
    --ct-btn-hover-color: #0B0D10;
    --ct-btn-hover-bg: #E4FB55;
    --ct-btn-hover-border-color: #E4FB55;
    --ct-btn-active-color: #0B0D10;
    --ct-btn-active-bg: #E4FB55;
    --ct-btn-active-border-color: #E4FB55;
    --ct-btn-disabled-color: #0B0D10;
    --ct-btn-disabled-bg: #D0FA03;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(208, 250, 3, 0.22);
}
.btn-soft-primary,
.btn-success { --ct-btn-color: #D0FA03; }
.avatar-title { color: #0B0D10; }

/* Logo: agrandar respecto del default de abstack (22px) */
:root { --ct-logo-lg-height: 40px; --ct-logo-sm-height: 30px; }
.leftside-menu .logo,
.logo-topbar { padding-top: 2px; }
.leftside-menu .logo img,
.logo-topbar img { width: auto; max-height: 40px; object-fit: contain; }

/* Topbar: el toggle de notificaciones/perfil (<a role="button">) tomaba el foco
   azul default de Safari al tocarlo en el celular -> se veía un marco feo. */
.navbar-custom .nav-link {
    -webkit-tap-highlight-color: transparent;
}
.navbar-custom .nav-link:focus {
    outline: none;
    box-shadow: none;
}
.navbar-custom .nav-link:focus-visible {
    outline: 2px solid rgba(208, 250, 3, .55);
    outline-offset: 2px;
    border-radius: 8px;
}

/* KPI card: que el número no empuje el ícono */
.card .avatar-md { width: 3.4rem; height: 3.4rem; }
.card .avatar-md .avatar-title { font-size: 1.35rem; }
.card-body h5.text-muted { margin-bottom: 0; }

/* Menú activo: barra de acento a la izquierda */
.side-nav .side-nav-item .side-nav-link.active {
    color: var(--ct-menu-item-active-color);
}
.side-nav > .side-nav-item > .side-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: #D0FA03;
}

/* Barra de scroll oscura */
* { scrollbar-width: thin; scrollbar-color: #2A313C transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #2A313C; border-radius: 999px; }

/* ---- Campos de formulario: el select/input de abstack venía cuadrado (4px)
   y sin foco marcado -> se veía "gris genérico" al lado de todo lo redondeado
   en lima. Los redondeamos y les damos un foco de marca. ---- */
.form-control, .form-select {
    background-color: var(--ct-tertiary-bg);
    border-color: var(--ct-border-color);
    border-radius: 12px;
}
.form-control-sm, .form-select-sm { border-radius: 10px; }
.form-control:focus, .form-select:focus {
    background-color: var(--ct-tertiary-bg);
    border-color: rgba(208, 250, 3, .55);
    box-shadow: 0 0 0 3px rgba(208, 250, 3, .15);
}
.form-control::placeholder { color: var(--ct-secondary-color); opacity: .75; }
.input-group-text {
    background-color: var(--ct-tertiary-bg);
    border-color: var(--ct-border-color);
    color: var(--ct-secondary-color);
}
.input-group > :first-child:not(:last-child) { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.input-group > :last-child:not(:first-child) { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.form-check-input { background-color: var(--ct-tertiary-bg); border-color: var(--ct-border-color); }
.form-check-input:checked { background-color: #D0FA03; border-color: #D0FA03; }
.form-check-input:focus { border-color: rgba(208, 250, 3, .55); box-shadow: 0 0 0 3px rgba(208, 250, 3, .15); }
.form-range::-webkit-slider-thumb { background-color: #D0FA03; }
.form-range::-moz-range-thumb { background-color: #D0FA03; }

/* ============================================================
   MOBILE-FIRST — barra de navegación inferior
   ============================================================ */
.bl-bottomnav {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0)); z-index: 1030;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(15, 19, 25, .92);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .04);
    padding: 6px;
}
.bl-bottomnav a,
.bl-bottomnav button {
    -webkit-tap-highlight-color: transparent;
    background: none; border: 0; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    margin: 2px; padding: 8px 2px 7px;
    border-radius: 16px;
    color: var(--ct-secondary-color);
    font-size: .6rem; font-weight: 700; letter-spacing: .01em;
    text-decoration: none;
    transition: background-color .16s ease, color .16s ease;
}
.bl-bottomnav a i,
.bl-bottomnav button i { font-size: 1.32rem; line-height: 1; }
.bl-bottomnav a.active,
.bl-bottomnav button.active {
    background: #D0FA03; color: #0B0D10;
    box-shadow: 0 4px 14px rgba(208, 250, 3, .35);
}
.bl-bottomnav .bl-plus { padding: 0; margin: 0; border-radius: 50%; }
.bl-bottomnav .bl-plus span {
    display: flex; align-items: center; justify-content: center;
    width: 62px; height: 62px; margin-top: -32px; border-radius: 50%;
    background: linear-gradient(160deg, #E4FB55, #D0FA03 60%);
    color: #0B0D10; font-size: 2.15rem;
    border: 4px solid #0B0D10;
    box-shadow: 0 10px 26px rgba(208, 250, 3, .55);
}
.bl-bottomnav .bl-badge {
    position: absolute; transform: translate(14px, -6px);
    min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
    background: #FF4D6D; color: #fff; font-size: .58rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #0F1319;
}

/* Hoja "Más" */
.bl-more .offcanvas-body { padding-top: .25rem; }
.bl-more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bl-more-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 6px; border-radius: 12px;
    background: var(--ct-tertiary-bg); border: 1px solid var(--ct-border-color);
    color: var(--ct-body-color); text-decoration: none;
    font-size: .74rem; font-weight: 600; text-align: center;
}
.bl-more-grid a i { font-size: 1.5rem; color: #D0FA03; }
.bl-more-grid a.active { border-color: #D0FA03; color: #D0FA03; }

@media (max-width: 767.98px) {
    html, body { overflow-x: hidden; }
    .bl-bottomnav { display: grid; }
    .leftside-menu { display: none !important; }
    .content-page { margin-left: 0 !important; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0)); }
    .button-toggle-menu { display: none !important; }
    .fab { display: none !important; }
    .footer { display: none; }

    /* topbar: abstack le mete margin-left:240px por el sidebar; lo anulamos */
    html body .wrapper .navbar-custom {
        margin-left: 0 !important; left: 0 !important; right: 0 !important;
        width: 100% !important; position: sticky; top: 0;
    }
    .navbar-custom .topbar {
        width: 100% !important; max-width: 100% !important;
        padding-left: 14px; padding-right: 14px;
    }

    /* en el teléfono también se ve el wordmark completo (corona + "BlackLab"), no solo el ícono */
    .logo-topbar { display: flex !important; align-items: center; }
    .logo-topbar .logo-lg { display: inline-block !important; }
    .logo-topbar .logo-sm { display: none !important; }
    .logo-topbar .logo-lg img { height: 24px; width: auto; max-width: 150px; object-fit: contain; }

    .page-title-box { padding: 14px 0 6px; }
    .content-page .content { padding-top: 6px; }
}

/* En escritorio no existe la barra inferior ni la hoja */
@media (min-width: 768px) {
    .bl-bottomnav, .bl-more { display: none !important; }
}

/* Tarjeta de recurrente pendiente: info arriba, acciones en su propia fila
   (así no compite por ancho con los botones en el teléfono). */
.due-card { padding: 12px 0; border-bottom: 1px solid var(--ct-border-color); }
.due-card:last-child { border-bottom: 0; }
.due-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.due-actions { display: flex; gap: 8px; }
.due-actions .btn:first-child { flex: 1; }

/* Fila propia en el leaderboard: borde lima sutil, no un bloque sólido.
   .tx-item.rank-me (dos clases) le gana en especificidad a .tx-item solo,
   que si no pisaba este padding por cargarse después en el <head>. */
.tx-item.rank-me {
    padding: 12px 14px;
    border: 1px solid rgba(208, 250, 3, .35);
    border-radius: 12px;
    background: rgba(208, 250, 3, .06);
}
