/* global.css */
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

/* ===== CSS VARIABLES PARA SIDEBAR ===== */
:root {
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
    --sidebar-current-width: var(--sidebar-width);
}

/* ===== DESIGN TOKENS (app-wide) =====
   Mismos tokens que usa el dashboard (public/assets/css/dashboard.css),
   promovidos aquí para que cualquier vista nueva los reutilice en vez de
   reinventar colores/spacing. Nombres con prefijo --kt- (Katana). */
/* ===== Panel de marca navy reutilizable (login, inicio) ===== */
.kt-brand-panel {
    background-color: var(--kt-navy, #212f3d);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Patrón de puntos sutil en vez de una imagen de fondo pesada */
.kt-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(circle at 15% 15%, #000 0%, transparent 65%);
    mask-image: radial-gradient(circle at 15% 15%, #000 0%, transparent 65%);
    pointer-events: none;
}

.kt-brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.kt-brand-mark img {
    width: 34px;
    height: 34px;
    /* El asset "blanco" trae el fill en negro dentro del propio SVG;
       se fuerza a blanco por CSS para que se lea sobre el panel navy. */
    filter: brightness(0) invert(1);
}

.kt-brand-mark span {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ===== Selector de periodo en píldora (reutilizable en páginas de reporte) ===== */
.kt-select-pill {
    width: auto !important;
    min-width: 168px;
    border: 1px solid var(--kt-border, rgba(22, 33, 44, 0.08));
    border-radius: 999px;
    padding: .5rem 2.25rem .5rem 1rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--kt-navy, #212f3d);
    background-color: var(--kt-surface, #fff);
    box-shadow: var(--kt-shadow, 0 1px 2px rgba(16, 24, 40, .04));
}

.kt-select-pill:focus {
    outline: none;
    border-color: var(--kt-accent, #2f6fed);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .15);
}

/* ===== Link con icono ("ver más", "ver kardex" ...) ===== */
.kt-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--kt-navy, #212f3d) !important;
    text-decoration: none !important;
    padding: .5rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--kt-border, rgba(22, 33, 44, 0.08));
    background-color: var(--kt-surface, #fff);
    transition: background-color .2s ease, border-color .2s ease;
}

.kt-link-btn:hover {
    background-color: var(--kt-navy-tint, #eef1f5);
    border-color: rgba(47, 111, 237, .18);
}

.kt-link-btn svg {
    width: 16px;
    height: 16px;
}

:root {
    --kt-bg: #f3f5f8;
    --kt-surface: #ffffff;
    --kt-navy: #212f3d;
    --kt-navy-ink: #16212c;
    --kt-navy-tint: #eef1f5;
    --kt-border: rgba(22, 33, 44, 0.08);
    --kt-text: #16212c;
    --kt-text-muted: #667085;
    --kt-accent: #2f6fed;
    --kt-success: #16794f;
    --kt-success-tint: #e6f4ee;
    --kt-warning: #a15c00;
    --kt-warning-tint: #fdf1e0;
    --kt-danger: #b42318;
    --kt-danger-tint: #fdeeed;
    --kt-radius-lg: 16px;
    --kt-radius-md: 12px;
    --kt-radius-sm: 8px;
    --kt-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 24px -14px rgba(16, 24, 40, .12);
    --kt-shadow-hover: 0 4px 10px rgba(16, 24, 40, .06), 0 20px 34px -16px rgba(16, 24, 40, .20);
}

body.sidebar-collapsed {
    --sidebar-current-width: var(--sidebar-collapsed-width);
}

* {
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f4f4;
    font-family: "Rubik", sans-serif;
}

.container {
    max-width: 100%;
    background-color: white;
    margin-left: calc(var(--sidebar-current-width) + 20px);
    margin-top: 25px;
    width: auto !important;
    border-radius: 10px;
    box-shadow: 0.5px 0.5px 0.5px 0px rgba(0, 0, 0, 0.2);
    padding: 10px;
    transition: margin-left 0.3s ease;
}

/* container-xxl del layout también necesita margen */
.container-xxl {
    margin-left: var(--sidebar-current-width) !important;
    transition: margin-left 0.3s ease, padding-left 0.3s ease;
    max-width: calc(100% - var(--sidebar-current-width)) !important;
    box-sizing: border-box;
    padding: 28px 32px 40px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 10px;
    align-items: start;
}

.carousel-container {
    grid-column: span 8;
}

.grid-item-1  { grid-column: span 1;  padding: 10px; }
.grid-item-2  { grid-column: span 2;  padding: 10px; }
.grid-item-3  { grid-column: span 3;  padding: 10px; }
.grid-item-4  { grid-column: span 4;  padding: 10px; }
.grid-item-5  { grid-column: span 5;  padding: 10px; }
.grid-item-6  { grid-column: span 6;  padding: 10px; }
.grid-item-7  { grid-column: span 7;  padding: 10px; }
.grid-item-8  { grid-column: span 8;  padding: 10px; }
.grid-item-9  { grid-column: span 9;  padding: 10px; }
.grid-item-10 { grid-column: span 10; padding: 10px; }
.grid-item-11 { grid-column: span 11; padding: 10px; }
.grid-item-12 { grid-column: span 12; padding: 10px; }

/* ===== ASIDE / SIDEBAR ===== */
.aside {
    max-height: 100vh;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #212F3D;
    width: var(--sidebar-current-width);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
}

.aside h5 {
    color: white;
}

/* ===== ESTADO COLAPSADO: solo iconos =====
   La mayoría de las reglas de "solo iconos" y los tooltips viven junto al
   nuevo markup del sidebar en src/layouts/main.ejs (.nav-link, .nav-group-label,
   .aside-header h2, .aside-credit span). Aquí solo queda lo que depende de
   --sidebar-collapsed-width, que sí es específico de este archivo. */

/* ===== BOTÓN TOGGLE ===== */
#sidebar-toggle {
    position: fixed;
    top: 14px;
    left: calc(var(--sidebar-current-width) - 1px);
    z-index: 300;
    background: var(--bs-primary-color, #212F3D);
    border: none;
    border-radius: 0 6px 6px 0;
    padding: 7px 6px;
    cursor: pointer;
    transition: left 0.3s ease, background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 6px rgba(0,0,0,0.25);
}

#sidebar-toggle:hover {
    filter: brightness(1.2);
}

#sidebar-toggle svg {
    stroke: #fff;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

body.sidebar-collapsed #sidebar-toggle svg {
    transform: rotate(180deg);
}

.list-items {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 16px;
    gap: 2px;
}

.link-reference-navbar {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.link-reference-navbar.active {
    background-color: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.link-reference-navbar:hover {
    background-color: #121b24;
    transition: background-color 0.3s ease, transform 0.3s ease, color 0.3s ease;
    color: white;
    text-decoration: none;
}

.footer-layout {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: fixed;
    bottom: 0;
    padding: 10px 20px;
    font-size: large;
    color: rgba(0, 0, 0, 0.5);
}

.image-bottom {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
}

#logo_katana_dark,
#big_logo_katana_dark {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.image-bottom > span {
    color: rgba(255, 255, 255, 0.8);
}

.banner {
    width: 100%;
}

.banner img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    position: relative;
}

.img_avatar {
    width: 100%;
    margin: auto;
}

/* ===== MEDIA QUERIES ===== */

/* Tablets medianas: auto-colapsar sidebar */
@media (min-width: 1025px) and (max-width: 1280px) {
    :root {
        --sidebar-current-width: var(--sidebar-collapsed-width);
    }

    body.sidebar-expanded {
        --sidebar-current-width: var(--sidebar-width);
    }

    .aside .nav-link span,
    .aside .nav-group-label,
    .aside .nav-soon,
    .aside .aside-header h2,
    .aside .aside-credit span {
        display: none !important;
    }

    body.sidebar-expanded .aside .nav-link span,
    body.sidebar-expanded .aside .nav-group-label,
    body.sidebar-expanded .aside .nav-soon,
    body.sidebar-expanded .aside .aside-header h2,
    body.sidebar-expanded .aside .aside-credit span {
        display: revert !important;
    }

    .aside .aside-header {
        justify-content: center;
        padding: 18px 8px 16px;
    }

    body.sidebar-expanded .aside .aside-header {
        justify-content: flex-start;
        padding: 18px 16px 16px;
    }

    .aside .nav-link {
        justify-content: center;
        padding: 10px;
    }

    body.sidebar-expanded .aside .nav-link {
        justify-content: flex-start;
        padding: 9px 12px;
    }

    /* Tooltips en tablet */
    .aside .nav-link[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.85);
        color: #fff;
        padding: 4px 10px;
        border-radius: 6px;
        font-size: 11px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
        z-index: 9999;
    }

    .aside .nav-link[data-tooltip]:hover::after {
        opacity: 1;
    }

    body.sidebar-expanded .aside .nav-link[data-tooltip]::after {
        display: none;
    }
}

/* Mobile: ocultar desktop sidebar, mostrar navbar mobile */
@media (max-width: 1024px) {
    #navbar-desktop,
    #sidebar-toggle {
        display: none !important;
    }

    #navbar-mobile {
        display: block !important;
    }

    .container-xxl {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding: 84px 16px 32px; /* 70px del navbar mobile fijo + gutter */
    }

    .container {
        margin-left: 0 !important;
        padding: 84px 16px 32px;
    }

    .navbar-floating {
        display: none !important;
    }
}