:root {
    --sidebar-width: 260px;
    --primary: #0d6efd;
}

body {
    background: #f4f6f9;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar .nav-link {
    border-radius: 8px;
    margin-bottom: 2px;
    padding: 10px 15px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255,255,255,0.1);
}

.sidebar-footer {
    margin-top: auto;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.stat-card {
    border: none;
    border-radius: 12px;
}

.stat-card .card-body {
    padding: 1.25rem;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-container .card {
    border: none;
    border-radius: 16px;
}

.table-actions .btn {
    padding: 2px 8px;
}

.product-search-input {
    width: 220px;
}

.product-list-name {
    font-weight: 600;
    line-height: 1.3;
}

.product-list-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 2px;
}

.product-list-meta code {
    font-size: 0.75rem;
}

.inventory-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
}

.inventory-summary-sep {
    color: #ced4da;
}

.product-lotes-panel {
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.375rem;
    overflow: hidden;
}

.product-lotes-panel summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.product-lotes-panel summary::-webkit-details-marker {
    display: none;
}

.product-lotes-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid transparent;
}

.product-lotes-panel[open] .product-lotes-summary {
    border-bottom-color: rgba(0,0,0,.125);
}

.precio-preview-inline {
    min-height: 38px;
    display: flex;
    align-items: center;
}

.ingreso-line-iva .form-check-input {
    margin-top: 0;
}

.ingreso-line-iva .form-check {
    min-height: auto;
}

.ingreso-lines-table th,
.ingreso-lines-table td {
    vertical-align: middle;
}

.ingreso-product-wrap {
    width: 100%;
}

.product-search-box {
    position: relative;
    width: 100%;
}

.product-selected-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.product-selected-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.product-selected-meta .stock-info {
    font-size: 0.65rem;
    font-weight: 500;
}

.product-selected-text {
    font-size: 0.8125rem;
    line-height: 1.35;
    word-break: break-word;
    width: 100%;
}

.product-change-btn {
    font-size: 0.75rem;
    text-decoration: none;
}

.ingreso-lines-table {
    table-layout: fixed;
    width: 100%;
    min-width: 860px;
}

.ingreso-lines-table .ingreso-col-product {
    width: 42%;
    min-width: 300px;
}

.ingreso-lines-table .ingreso-col-qty {
    width: 78px;
}

.ingreso-lines-table .ingreso-col-price {
    width: 145px;
}

.ingreso-lines-table .ingreso-col-subtotal {
    width: 115px;
}

.ingreso-lines-table .ingreso-col-iva {
    width: 72px;
}

.ingreso-lines-table .ingreso-col-action {
    width: 44px;
}

.ingreso-lines-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

.ingreso-lines-card-body {
    overflow: visible;
}

.product-search-menu {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.175);
    max-height: 260px;
    overflow-y: auto;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.product-search-menu .list-group-item-action:hover,
.product-search-menu .list-group-item-action:focus {
    background-color: #e7f1ff;
}

.product-search-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.102a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.6rem center;
    padding-left: 2rem;
    width: 100%;
}

.totals-card-cop .form-check-label {
    line-height: 1.4;
}

.line-item-row .input-group-text {
    min-width: 2.2rem;
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.item-subtotal {
    font-variant-numeric: tabular-nums;
}

.stock-badge-high { background: #198754; }
.stock-badge-low { background: #ffc107; color: #000; }
.stock-badge-out { background: #dc3545; }

.product-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.product-card .card-img-top,
.product-card .product-store-img {
    height: 180px;
    object-fit: cover;
    background: #f8f9fa;
}

.product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.product-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #e9ecef;
    border-radius: 6px;
    color: #adb5bd;
}

.product-preview-img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
}

.media-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.media-gallery-item {
    position: relative;
    width: 120px;
}

.media-gallery-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.media-gallery-actions {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
}

.media-gallery-actions label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.media-badge {
    position: absolute;
    top: 6px;
    left: 6px;
}

.media-new-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.media-new-preview-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
}

.product-video-preview {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    background: #000;
}

.product-store-video {
    height: 180px;
    object-fit: cover;
    background: #000;
}

.product-carousel .carousel-item {
    height: 180px;
}

.product-carousel .carousel-control-prev,
.product-carousel .carousel-control-next {
    width: 15%;
}

.product-carousel .carousel-indicators {
    margin-bottom: 0.25rem;
}

.product-carousel .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.product-price-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.product-price-old {
    color: #6c757d;
    text-decoration: line-through;
    font-size: 0.9rem;
}

.product-price-final {
    color: #0d6efd;
    font-weight: 700;
    font-size: 1.1rem;
}

.product-price-table .product-price-final {
    font-size: 0.95rem;
}

.product-discount-badge {
    font-size: 0.7rem;
}

.featured-discount-ribbon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    background: #dc3545;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.precio-preview-box {
    min-height: 70px;
    display: flex;
    align-items: center;
}

.product-card-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

.product-card-clickable .product-card-media .carousel-control-prev,
.product-card-clickable .product-card-media .carousel-control-next,
.product-card-clickable .product-card-media .carousel-indicators {
    z-index: 2;
}

.product-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.product-modal-carousel {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

.product-modal-carousel .carousel-item {
    height: 420px;
    background: #f8f9fa;
}

.product-modal-carousel .carousel-item.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-slide-img {
    max-height: 420px;
    object-fit: contain;
}

.modal-slide-video {
    max-height: 420px;
    background: #000;
}

.modal-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-thumb {
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    cursor: pointer;
}

.modal-thumb.active {
    border-color: #0d6efd;
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-thumb-video {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    color: #fff;
    font-size: 1.5rem;
}

.modal-no-media {
    height: 320px;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 3rem;
    gap: 0.5rem;
}

.modal-no-media span {
    font-size: 1rem;
}

.product-price-modal .product-price-final {
    font-size: 1.75rem;
}

@media (max-width: 768px) {
    .product-modal-carousel .carousel-item {
        height: 280px;
    }

    .modal-slide-img,
    .modal-slide-video {
        max-height: 280px;
    }
}

/* Carrito */
/* WhatsApp flotante */
.whatsapp-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 62px;
    height: 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: whatsappFabPulse 2.5s ease-out infinite;
}

@keyframes whatsappFabPulse {
    0% { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5), 0 0 0 0 rgba(37, 211, 102, 0.45); }
    70% { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5), 0 0 0 14px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5), 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-fab:hover {
    color: #fff;
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-fab i {
    font-size: 1.85rem;
    line-height: 1;
}

.whatsapp-fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.whatsapp-fab--with-cart {
    right: auto;
    left: 24px;
}

@media (max-width: 575px) {
    .whatsapp-fab {
        bottom: 20px;
        right: 20px;
        width: 58px;
        height: 58px;
    }

    .whatsapp-fab--with-cart {
        left: 20px;
    }

    .whatsapp-fab i {
        font-size: 1.75rem;
    }
}

.cart-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.cart-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    font-size: 0.75rem;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #fff;
}

.cart-offcanvas {
    width: min(400px, 100vw);
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item-info strong {
    font-size: 0.9rem;
    display: block;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cart-qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-weight: 700;
    white-space: nowrap;
    font-size: 0.9rem;
}

.cart-footer {
    background: #f8f9fa;
}

.cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.product-card .placeholder-img {
    height: 180px;
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #adb5bd;
}

.store-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.line-item-row input,
.line-item-row select {
    font-size: 0.9rem;
}

/* Marca / logo */
.site-brand,
.landing-brand,
.store-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.site-brand-mark-img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(37, 99, 235, 0.45));
}

.site-brand-text strong,
.landing-brand-text strong,
.store-brand-text strong {
    display: block;
    line-height: 1.2;
}

.site-brand-text small,
.landing-brand-text small,
.store-brand-text small {
    display: block;
    opacity: 0.82;
    font-size: 0.72rem;
    line-height: 1.25;
}

.site-brand-logo--login {
    height: 80px;
    width: 80px;
    max-width: none;
    filter: drop-shadow(0 10px 24px rgba(37, 99, 235, 0.35));
}

.site-brand-portada--login {
    width: min(100%, 360px);
    height: auto;
    max-width: none;
    filter: drop-shadow(0 10px 24px rgba(37, 99, 235, 0.25));
}

@media (max-width: 575px) {
    .site-brand-mark-img {
        width: 40px;
        height: 40px;
    }

    .landing-brand-text small,
    .store-brand-text small {
        display: none;
    }
}
