/* =============================================================
   PLATINADORA THEME  —  Sistema de diseño unificado
   Replica los colores, tipografía, sidebar, botones, tarjetas y
   tablas del sistema principal Bolcorona (.NET / Modernize).
   Compartido por los módulos Laravel (Contrarecibo, Compras).
   Cargar AL FINAL para que sobrescriba a Bootstrap/MDB.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Marca (tomado de Custom.css del principal) */
    --primary-color: #143c84;
    --primary-color-hover: #0f2d63;
    --primary-color-active: #0d264e;
    --primary-color-shadow: rgba(20, 60, 132, 0.5);
    --secondary-color: #3a6eb2;
    --secondary-color-hover: #335d9e;
    --secondary-color-active: #2c5a91;
    --secondary-color-shadow: rgba(58, 110, 178, 0.5);
    --color-tertiary: #1f5f74;

    /* Superficies / texto (Modernize.css) */
    --pt-bg: #f4f6f9;
    --pt-card: #ffffff;
    --pt-text: #1a1d23;
    --pt-text-muted: #6b7280;
    --pt-border: rgba(0, 0, 0, 0.08);
    --pt-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.06);
    --pt-shadow: 0 6px 18px rgba(0,0,0,.06);
    --pt-radius: 12px;
    --pt-radius-lg: 14px;

    /* Estados */
    --pt-success: #10b981;
    --pt-warning: #f59e0b;
    --pt-danger:  #ef4444;
    --pt-info:    #06b6d4;

    /* Layout */
    --pt-sidebar-w: 260px;
    --pt-topbar-h: 62px;

    /* Bootstrap map (para que utilidades .text-primary, etc. usen la marca) */
    --bs-primary: #143c84;
    --bs-primary-rgb: 20, 60, 132;
}

/* ─── TIPOGRAFÍA / BASE ─── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
    background: var(--pt-bg) !important;
    color: var(--pt-text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; color: var(--pt-text); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT SIDEBAR (clases .pt-*)  — usado por Contrarecibo
   ══════════════════════════════════════════════════════════════ */
.pt-layout { display: flex; min-height: 100vh; }

.pt-sidebar {
    width: var(--pt-sidebar-w);
    min-width: var(--pt-sidebar-w);
    background: linear-gradient(180deg, #112d6a 0%, #143c84 50%, #1a4a96 100%);
    color: #c8d8ef;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,.12);
    transition: transform .25s ease;
    overflow-y: auto;
}
.pt-sidebar::-webkit-scrollbar { width: 6px; }
.pt-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }

.pt-sidebar-header {
    background: rgba(0,0,0,.12);
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    display: flex; align-items: center; gap: 10px;
}
.pt-sidebar-header .pt-brand-title { font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: -.02em; margin: 0; }
.pt-sidebar-header .pt-brand-sub  { font-size: .72rem; color: rgba(255,255,255,.6); margin: 0; }
.pt-sidebar-header img { max-height: 34px; width: auto; }

.pt-menu { list-style: none; padding: 10px 0 20px; margin: 0; flex: 1; }
.pt-menu li { position: relative; }

/* Enlace principal / cabecera de sección */
.pt-menu > li > a,
.pt-menu > li > button {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 11px 20px;
    color: #c8d8ef;
    text-decoration: none;
    font-size: .9rem; font-weight: 500;
    background: transparent; border: none; text-align: left;
    transition: background .15s, color .15s;
}
.pt-menu > li > a i,
.pt-menu > li > button i { width: 18px; text-align: center; font-size: .95rem; opacity: .9; }

.pt-menu > li > a:hover,
.pt-menu > li > button:hover { background: rgba(255,255,255,.08); color: #fff; }

.pt-menu > li > a.active,
.pt-menu > li > button[aria-expanded="true"],
.pt-menu > li.active > a { background: rgba(0,0,0,.18); color: #fff; box-shadow: inset 3px 0 0 #ffffff; }

/* Flecha del colapsable */
.pt-menu .pt-caret { margin-left: auto; transition: transform .2s; font-size: .7rem; opacity: .7; }
.pt-menu [aria-expanded="true"] .pt-caret { transform: rotate(180deg); }

/* Submenú */
.pt-submenu { list-style: none; padding: 2px 0 6px; margin: 0; background: rgba(0,0,0,.16); }
.pt-submenu li a {
    display: block;
    padding: 8px 20px 8px 50px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .84rem;
    transition: background .15s, color .15s;
}
.pt-submenu li a:hover { background: rgba(255,255,255,.07); color: #fff; }
.pt-submenu li a.active { color: #fff; font-weight: 600; }
.pt-submenu .pt-submenu-header {
    font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255,255,255,.4); padding: 8px 20px 4px 24px;
}

/* Área principal */
.pt-main { flex: 1; margin-left: var(--pt-sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.pt-topbar {
    height: var(--pt-topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--pt-border);
    box-shadow: var(--pt-shadow-sm);
    display: flex; align-items: center; gap: 14px;
    padding: 0 20px;
    position: sticky; top: 0; z-index: 1030;
}
.pt-topbar .pt-topbar-title { font-size: 1.05rem; font-weight: 700; color: #495057; margin: 0; }
.pt-sidebar-toggle {
    background: var(--primary-color); color: #fff; border: none;
    width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
    display: none; align-items: center; justify-content: center;
}
.pt-content { padding: 22px; flex: 1; }

/* Overlay móvil */
.pt-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }

@media (max-width: 991.98px) {
    .pt-sidebar { transform: translateX(-100%); }
    .pt-sidebar.show { transform: translateX(0); }
    .pt-main { margin-left: 0; }
    .pt-sidebar-toggle { display: inline-flex; }
    .pt-overlay.show { display: block; }
}

/* ══════════════════════════════════════════════════════════════
   OVERRIDE SIDEBAR de bolcorona-compras (#sidebarMenu + MDB)
   ══════════════════════════════════════════════════════════════ */
#sidebarMenu.sidebar {
    background: linear-gradient(180deg, #112d6a 0%, #143c84 50%, #1a4a96 100%) !important;
    box-shadow: 2px 0 12px rgba(0,0,0,.12);
}
/* Texto de TODO el sidebar claro y legible */
#sidebarMenu .list-group-item,
#sidebarMenu .list-group-item * {
    background: transparent !important;
    color: #e8eef6 !important;
    border-color: transparent !important;
}
/* Ítems de primer nivel (secciones) */
#sidebarMenu .list-group-item-action {
    font-weight: 500;
    border-radius: 8px !important;
}
#sidebarMenu .list-group-item-action i { opacity: .9; }

/* Sub-ítems (dentro de collapse) más tenues */
#sidebarMenu .collapse .list-group-item,
#sidebarMenu .collapse .list-group-item * { color: #c3d3ec !important; font-weight: 400; }

/* Hover: overlay blanco sutil, texto blanco (sin la caja clara de navbar.css) */
#sidebarMenu .list-group-item-action:hover,
#sidebarMenu .collapse > .list-group-item:hover {
    background: rgba(255,255,255,.10) !important;
    box-shadow: none !important;
    border-color: transparent !important;
    border-radius: 8px !important;
}
#sidebarMenu .list-group-item-action:hover,
#sidebarMenu .list-group-item-action:hover *,
#sidebarMenu .collapse > .list-group-item:hover,
#sidebarMenu .collapse > .list-group-item:hover * { color: #ffffff !important; }

/* Active: overlay oscuro + barra blanca izquierda + texto blanco */
#sidebarMenu .list-group-item.active,
#sidebarMenu .list-group-item-action.active,
#sidebarMenu .collapse > .list-group-item.active {
    background: rgba(0,0,0,.22) !important;
    box-shadow: inset 3px 0 0 #fff !important;
    border-color: transparent !important;
    border-radius: 8px !important;
}
#sidebarMenu .list-group-item.active,
#sidebarMenu .list-group-item.active *,
#sidebarMenu .list-group-item-action.active,
#sidebarMenu .list-group-item-action.active * { color: #ffffff !important; }

#main-navbar.navbar { box-shadow: var(--pt-shadow-sm); border-bottom: 1px solid var(--pt-border); }

/* ══════════════════════════════════════════════════════════════
   COMPONENTES COMPARTIDOS (botones, tarjetas, tablas, badges)
   ══════════════════════════════════════════════════════════════ */

/* Botones marca */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color-hover) !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-color-hover) !important;
    border-color: var(--primary-color-active) !important;
}
.btn-primary:focus { box-shadow: 0 0 0 .2rem var(--primary-color-shadow) !important; }
.btn-primary:active { background-color: var(--primary-color-active) !important; }

.btn-secondary {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color-hover) !important;
    color: #fff !important;
}
.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--secondary-color-hover) !important;
    border-color: var(--secondary-color-active) !important;
}
.btn-secondary:focus { box-shadow: 0 0 0 .2rem var(--secondary-color-shadow) !important; }

.btn-outline-primary { color: var(--primary-color) !important; border-color: var(--primary-color) !important; }
.btn-outline-primary:hover { background: var(--primary-color) !important; color: #fff !important; }

.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
a { color: var(--secondary-color); }
a:hover { color: var(--primary-color); }

/* Tarjetas */
.card {
    border: 1px solid var(--pt-border) !important;
    border-radius: var(--pt-radius-lg) !important;
    box-shadow: var(--pt-shadow) !important;
    background: var(--pt-card);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--pt-border);
    font-weight: 700;
}

/* Títulos de página (equivalentes a Custom.css) */
.page-title, .pt-page-title { font-size: 1.35rem; font-weight: 800; margin: 8px 0 0; color: var(--pt-text); }
.page-subtitle, .pt-page-subtitle { color: var(--pt-text-muted); margin-top: 2px; font-size: .92rem; }

/* ─── TABLAS (estilo del principal) ─── */
.table { color: var(--pt-text); }

/* Solo la PRIMERA fila del thead es la cabecera azul.
   (Muchas tablas tienen una 2ª fila de inputs de filtro que NO debe pintarse.) */
.table thead tr:first-child th {
    background: var(--primary-color);
    color: #fff !important;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-color: var(--primary-color-hover) !important;
    vertical-align: middle;
    white-space: nowrap;
}
/* Fila(s) de filtros: fondo claro, sin el azul */
.table thead tr:nth-child(n+2) th {
    background: #fff !important;
    color: var(--pt-text) !important;
    border-color: var(--pt-border) !important;
    padding: .4rem .5rem;
    font-weight: 400;
    text-transform: none;
}
.table thead tr:nth-child(n+2) th .form-control { font-size: .82rem; }

.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(20,60,132,.035); }
.table-hover > tbody > tr:hover > * { background-color: rgba(20,60,132,.07); }
.table td, .table tbody th { border-color: var(--pt-border); }

/* Tabla dentro de tarjeta: bordes redondeados arriba */
.card > .table-responsive:first-child thead tr:first-child th:first-child,
.card > .table:first-child thead tr:first-child th:first-child { border-top-left-radius: var(--pt-radius); }
.card > .table-responsive:first-child thead tr:first-child th:last-child,
.card > .table:first-child thead tr:first-child th:last-child { border-top-right-radius: var(--pt-radius); }

/* Badges de estado con la paleta moderna */
.badge.bg-success { background-color: var(--pt-success) !important; }
.badge.bg-warning { background-color: var(--pt-warning) !important; color: #fff !important; }
.badge.bg-danger  { background-color: var(--pt-danger) !important; }
.badge.bg-info    { background-color: var(--pt-info) !important; color: #fff !important; }

/* Inputs foco marca */
.form-control:focus, .form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 .2rem var(--primary-color-shadow);
}
