/* =====================================================
   VENTAS — Tema moderno y responsive
   ===================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #0ea5e9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --nav-width: 280px;
    --header-height: 56px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@font-face {
    font-family: "RobotoCondensedLight";
    src: url("../webfonts/robotocondensed-light.woff2") format("woff2"),
        url("../webfonts/robotocondensed-light.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "RobotoRegular";
    src: url("../webfonts/roboto-regular.woff2") format("woff2"),
        url("../webfonts/roboto-regular.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "OswaldLight";
    src: url("../webfonts/oswald-light.woff2") format("woff2"),
        url("../webfonts/oswald-light.woff") format("woff");
    font-display: swap;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-family: "RobotoRegular", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ========== Login ========== */
.main-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
}

.main-container > .login,
.main-container > .hero-body {
    width: 100%;
    max-width: 420px;
}

.main-container .box.login {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: none;
    padding: 2rem 1.75rem;
}

.main-container .title.is-5 {
    color: var(--text);
    font-weight: 600;
}

.main-container .button.is-info {
    background: var(--primary);
    border: none;
    font-weight: 600;
    padding-left: 2rem;
    padding-right: 2rem;
    transition: var(--transition);
}

.main-container .button.is-info:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ========== Layout principal ========== */
.page-container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    position: relative;
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--transition);
    backdrop-filter: blur(2px);
}

.nav-overlay.is-active {
    display: block;
    opacity: 1;
}

/* ========== Sidebar ========== */
.navLateral {
    width: var(--nav-width);
    min-width: var(--nav-width);
    background: var(--bg-sidebar);
    border-right: none;
    transition: transform var(--transition), width var(--transition);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 999;
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Escritorio: sidebar oculto al colapsar (botón ☰) */
html.sidebar-collapsed #navLateral,
html.sidebar-collapsed section.navLateral,
body.sidebar-collapsed #navLateral,
body.sidebar-collapsed section.navLateral,
#navLateral.navLateral.is-collapsed {
    transform: translateX(calc(-1 * var(--nav-width))) !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

html.sidebar-collapsed #pageContent,
html.sidebar-collapsed section.pageContent,
body.sidebar-collapsed #pageContent,
body.sidebar-collapsed section.pageContent,
#pageContent.pageContent.is-sidebar-collapsed {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.navLateral-body {
    background: transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.navLateral-body-logo {
    height: var(--header-height);
    min-height: var(--header-height);
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0 0.75rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
}

.navLateral-body-logo-text {
    flex: 1;
    text-align: center;
    line-height: 1.2;
    color: #fff;
}

.sidebar-close-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-close-mobile:hover {
    background: rgba(255, 255, 255, 0.35);
}

.navLateral-body-tittle-menu {
    height: auto;
    line-height: 1.4;
    padding: 1rem;
    font-size: 0.75rem;
    background: transparent;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Perfil lateral (flex, sin figure.full-width) */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-profile__avatar,
.user-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    border: 2px solid var(--primary-light);
}

.sidebar-profile__info {
    color: #f8fafc;
    font-size: 0.875rem;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile__info strong {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile__info small {
    color: #94a3b8;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Iconos del menú lateral */
.menu-principal .navLateral-body-cl,
.menu-principal .navLateral-body-cr {
    float: left;
    height: 48px;
    line-height: 48px;
}

.menu-principal .navLateral-body-cl {
    width: 42px;
    min-width: 42px;
    text-align: center;
}

.menu-principal .navLateral-body-cr {
    width: calc(100% - 42px);
    padding-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-principal li a {
    overflow: hidden;
}

.menu-principal li a::after {
    content: "";
    display: table;
    clear: both;
}

.navBar-options-list ul li img,
.navBar-options-list ul li .user-avatar {
    width: 39px !important;
    height: 39px !important;
    max-width: 39px !important;
    max-height: 39px !important;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.dashboard-user-photo {
    width: 96px !important;
    height: 96px !important;
    max-width: 96px !important;
    max-height: 96px !important;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    margin: 0 auto;
}

.navLateral-body-logo {
    font-family: "OswaldLight", sans-serif;
}

.navLateral-body-cr {
    color: #f8fafc;
    font-size: 0.9rem;
}

.navLateral-body-cr small {
    color: #94a3b8;
}

.menu-principal li a {
    color: #cbd5e1;
    height: 48px;
    border-radius: var(--radius-sm);
    margin: 2px 8px;
    width: calc(100% - 16px);
}

.menu-principal li a:hover,
.btn-subMenu-show {
    background: var(--bg-sidebar-hover) !important;
    color: #fff !important;
}

.menu-principal li a div.navLateral-body-cl,
.menu-principal li a div.navLateral-body-cr {
    height: 48px;
    line-height: 48px;
}

.menu-principal li a div.navLateral-body-cl {
    color: var(--accent);
    font-size: 1.1rem;
}

.sub-menu-options {
    background: rgba(0, 0, 0, 0.2) !important;
}

.sub-menu-options li a {
    padding-left: 0.5rem;
    font-size: 0.9rem;
}

.sub-menu-options li a:hover {
    border-left-color: var(--accent) !important;
}

.divider-menu-h {
    border-top-color: rgba(255, 255, 255, 0.08);
    width: calc(100% - 24px) !important;
}

.btn-exit .navLateral-body-cl {
    color: var(--danger) !important;
}

.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 3px;
}

/* ========== Navbar superior ========== */
.navBar {
    background: var(--bg-card);
    height: var(--header-height);
    color: var(--text);
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navBar-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--header-height);
    padding: 0 1rem;
    max-width: 100%;
}

.btn-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: #eff6ff;
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    font-size: 1.15rem;
}

.btn-sidebar-toggle:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sidebar-toggle:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.navBar-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.navBar-options-list {
    margin-left: auto;
}

.navBar-options-list ul {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navBar-options-list ul li a,
.navBar-options-list ul li {
    color: var(--text-muted);
}

.navBar-options-list .btn-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    transition: var(--transition);
}

.navBar-options-list .btn-exit:hover {
    background: #fee2e2;
    color: var(--danger);
}

.page-intro {
    padding-top: 0.5rem;
    padding-bottom: 0.25rem;
}

/* Sin foto grande en el contenido: solo en el sidebar */
.pageContent .dashboard-user-photo {
    display: none !important;
}

/* ========== Contenido ========== */
.pageContent {
    flex: 1;
    width: calc(100% - var(--nav-width));
    margin-left: var(--nav-width);
    background: var(--bg-page);
    min-height: 100vh;
    transition: margin var(--transition), width var(--transition);
}

.pageContent .container,
.pageContent .container.is-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 1400px;
}

.pageContent .title {
    color: var(--text);
    font-weight: 700;
    font-size: 1.5rem;
}

.pageContent .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Cards y paneles */
.app-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.dashboard-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: block;
    color: inherit;
    height: 100%;
}

.dashboard-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.dashboard-stat .heading {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.dashboard-stat .title {
    color: var(--primary);
    font-size: 2rem !important;
    margin: 0 !important;
}

/* Botones modernos */
.button.is-info {
    background: var(--primary);
    border-color: transparent;
}

.button.is-info:hover {
    background: var(--primary-dark);
}

.button.is-link.is-light {
    color: var(--primary);
    background: #eff6ff;
}

/* Tablas responsive */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.table-container .table {
    margin-bottom: 0;
    min-width: 600px;
}

.table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Lista productos (media) */
.media.pb-3 {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ========== POS / Venta móvil ========== */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}

.pos-scan-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.pos-scan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-scan-camera {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff !important;
    border: none;
    font-weight: 600;
    flex: 1;
    min-width: 140px;
}

.btn-scan-camera:hover {
    opacity: 0.92;
    color: #fff !important;
}

.pos-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.pos-total-box {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    margin: 1rem 0;
}

.pos-total-box small,
.pos-total-box .subtitle {
    color: #e2e8f0 !important;
}

/* Carrito móvil: cards en lugar de tabla */
@media (max-width: 768px) {
    .sale-cart-table thead {
        display: none;
    }

    .sale-cart-table tbody tr:not(.sale-cart-total-row) {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        box-shadow: var(--shadow);
    }

    .sale-cart-table tbody tr.sale-cart-total-row {
        display: table-row;
        background: #f1f5f9;
    }

    .sale-cart-table tbody tr:not(.sale-cart-total-row) td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0;
        border: none;
        text-align: left !important;
    }

    .sale-cart-table tbody tr:not(.sale-cart-total-row) td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        margin-right: 0.5rem;
    }

    .sale-cart-table .table-container .table {
        min-width: unset;
    }
}

/* ========== Inventario móvil / escáner ========== */
.inventory-hero {
    text-align: center;
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius);
    color: #fff;
    margin-bottom: 1.25rem;
}

.inventory-hero h2 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.inventory-hero p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.scanner-modal .modal-card {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
}

.scanner-modal .modal-card-body {
    padding: 0;
}

#barcode-reader {
    width: 100%;
    min-height: 280px;
    border: none;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

#barcode-reader video {
    border-radius: var(--radius-sm);
}

.product-result-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.product-result-card .product-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.stock-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
}

.stock-badge.ok { background: #d1fae5; color: #065f46; }
.stock-badge.low { background: #fef3c7; color: #92400e; }
.stock-badge.out { background: #fee2e2; color: #991b1b; }

.stock-adjust-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.stock-adjust-row .input {
    max-width: 120px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Modales */
.modal-card {
    border-radius: var(--radius);
    overflow: hidden;
}

.modal-card-head {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.modal-card-title {
    font-weight: 600;
    color: var(--text);
}

/* Utilidades */
.is-photo { max-width: 280px; height: auto; margin: 0 auto; }
.text-condensedLight { font-family: "RobotoCondensedLight", sans-serif; }
.tittles { font-family: "OswaldLight", sans-serif; }
/* full-width: 100% del contenedor padre, NO del viewport en layout principal */
.full-width { width: 100%; box-sizing: border-box; }

/* El sidebar y el contenido NO deben heredar width:100% del viewport */
section.navLateral,
#navLateral.navLateral {
    width: var(--nav-width) !important;
    max-width: var(--nav-width) !important;
    min-width: var(--nav-width) !important;
    flex: 0 0 var(--nav-width);
}

section.pageContent,
#pageContent.pageContent {
    width: calc(100% - var(--nav-width)) !important;
    max-width: none !important;
    margin-left: var(--nav-width) !important;
    flex: 1 1 auto;
    min-width: 0;
}

.list-unstyle { list-style: none; margin: 0; padding: 0; }

/* Imágenes: nunca escalar avatares al 100% del contenedor */
.navLateral img:not(.sidebar-profile__avatar):not(.user-avatar),
.navBar img.user-avatar,
.pageContent .image.is-96x96 img,
.pageContent .dashboard-user-photo {
    max-width: none;
}

.img-responsive:not(.user-avatar):not(.sidebar-profile__avatar):not(.dashboard-user-photo) {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Bulma .image no debe estirar avatares */
.image.is-96x96,
figure.image[style*="96px"] {
    width: 96px !important;
    height: 96px !important;
    max-width: 96px !important;
    max-height: 96px !important;
    margin-left: auto;
    margin-right: auto;
}

.image.is-96x96 img,
figure.image[style*="96px"] img {
    width: 96px !important;
    height: 96px !important;
    max-width: 96px !important;
    max-height: 96px !important;
    object-fit: cover;
    border-radius: 50%;
}

.sale-details {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sale-details:hover { background: #f8fafc; }

.hide-mobile { display: block; }
.show-mobile { display: none; }

/* Paginación */
.pagination.is-centered { flex-wrap: wrap; gap: 0.25rem; }

/* ========== Responsive: tablet y móvil ========== */
@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-sidebar {
        position: static;
    }
}

@media (max-width: 750px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }

    .sidebar-close-mobile {
        display: inline-flex;
    }

    section.navLateral,
    #navLateral.navLateral {
        transform: translateX(-100%);
        width: min(85vw, var(--nav-width)) !important;
        max-width: 85vw !important;
        min-width: unset !important;
    }

    .navLateral.navLateral-change,
    #navLateral.navLateral.navLateral-change {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    section.pageContent,
    #pageContent.pageContent {
        width: 100% !important;
        margin-left: 0 !important;
        max-width: none !important;
    }

    .pageContent.pageContent-change {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .navBar-options-list ul li.noLink small {
        display: none;
    }

    .pageContent .title {
        font-size: 1.25rem;
    }

    .container.is-fluid.mb-6 {
        margin-bottom: 1rem !important;
    }

    .columns.is-multiline .column {
        padding: 0.5rem;
    }

    .field.is-grouped {
        flex-direction: column;
    }

    .field.is-grouped .control {
        width: 100%;
    }

    .modal-card {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }

    .scanner-modal .modal {
        align-items: flex-end;
    }

    .scanner-modal .modal-card {
        max-height: 92vh;
    }
}

@media (max-width: 480px) {
    .main-container .box.login {
        padding: 1.5rem 1.25rem;
    }

    .pos-scan-actions .button {
        width: 100%;
    }

    .dashboard-stat .title {
        font-size: 1.5rem !important;
    }
}

/* Impresión */
@media print {
    .navLateral, .navBar, .nav-overlay { display: none !important; }
    .pageContent { margin: 0 !important; width: 100% !important; }
}
