/**
 * Estilos Globales - MaxiNorte Kiosco
 * Sistema POS
 */

/* ===== Variables CSS ===== */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --body-bg: #f4f6f9;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition-speed: 0.3s;

    /* Tema del sidebar (por defecto: oscuro) */
    --sidebar-bg: #212529;
    --sidebar-accent: #0d6efd;
    --sidebar-active-bg: rgba(13, 110, 253, 0.3);
}

/* ===== Temas del Sidebar ===== */
body[data-tema="verde_agua"] {
    --sidebar-bg: #0f766e;
    --sidebar-accent: #2dd4bf;
    --sidebar-active-bg: rgba(45, 212, 191, 0.25);
}

body[data-tema="celeste"] {
    --sidebar-bg: #0284c7;
    --sidebar-accent: #7dd3fc;
    --sidebar-active-bg: rgba(125, 211, 252, 0.25);
}

body[data-tema="gris"] {
    --sidebar-bg: #495057;
    --sidebar-accent: #ced4da;
    --sidebar-active-bg: rgba(206, 212, 218, 0.2);
}

body[data-tema="negro"] {
    --sidebar-bg: #000000;
    --sidebar-accent: #6c757d;
    --sidebar-active-bg: rgba(255, 255, 255, 0.15);
}

body[data-tema="violeta"] {
    --sidebar-bg: #6d28d9;
    --sidebar-accent: #c4b5fd;
    --sidebar-active-bg: rgba(196, 181, 253, 0.25);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Login Page ===== */
.login-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 15px;
}

.login-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.login-icon {
    font-size: 4rem;
    color: var(--primary-color);
}

/* ===== Wrapper ===== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition-speed);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--sidebar-bg);
}

.sidebar-header .sidebar-logo {
    max-height: 55px;
    max-width: 90%;
    object-fit: contain;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.sidebar .nav {
    flex-direction: column !important;
    flex-wrap: nowrap;
    width: 100%;
}

.sidebar .nav-item {
    width: 100%;
    list-style: none;
}

.sidebar-footer {
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 100px;
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: var(--transition-speed);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-accent);
}

.sidebar .nav-link i {
    width: 25px;
    text-align: center;
    margin-right: 5px;
    flex-shrink: 0;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: var(--transition-speed);
}

/* ===== Top Navbar ===== */
.top-navbar {
    background: #fff;
    padding: 12px 20px;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 999;
}

/* ===== Page Header ===== */
.page-header {
    padding: 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* ===== Cards ===== */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ===== Tables ===== */
.table-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 20px;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ===== Product Image ===== */
.product-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* ===== POS Page ===== */
.pos-container {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.pos-products {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.pos-cart {
    width: 380px;
    background: #fff;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
}

.cart-header {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.cart-footer {
    padding: 15px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* ===== Cart Item ===== */
.cart-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.cart-item .item-name {
    flex: 1;
    font-weight: 500;
}

.cart-item .item-price {
    font-weight: 600;
    color: var(--success-color);
}

/* ===== Pantalla de Bloqueo del Punto de Venta ===== */
.pos-lock {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    z-index: 1050;
}

.pos-lock-card {
    max-width: 440px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 40px 35px;
    text-align: center;
}

.pos-lock-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: #fdecea;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    animation: pulse-lock 2s infinite;
}

@keyframes pulse-lock {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.pos-lock-card h3 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.cart-item .item-total {
    font-weight: 700;
    min-width: 80px;
    text-align: right;
}

/* ===== Search Box ===== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
    border-radius: 20px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

/* ===== Badges ===== */
.badge-stock {
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* ===== Product Grid ===== */
.product-grid-item {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    height: 100%;
}

.product-grid-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-grid-item .product-name {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 5px;
    color: #333;
}

.product-grid-item .product-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success-color);
}

/* ===== Buttons ===== */
.btn-sm-icon {
    padding: 3px 8px;
    font-size: 0.8rem;
}

/* ===== Category Filter ===== */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.category-filter .btn {
    border-radius: 20px;
    font-size: 0.8rem;
    padding: 5px 15px;
}

/* ===== Alerts ===== */
.alert-flash {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar, .top-navbar, .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .ticket-container {
        width: 80mm;
        margin: 0 auto;
        font-size: 12px;
        font-family: 'Courier New', monospace;
    }
}

/* ===== Ticket ===== */
.ticket-container {
    width: 80mm;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 5mm;
}

.ticket-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.ticket-total {
    border-top: 1px dashed #000;
    padding-top: 5px;
    margin-top: 5px;
    font-weight: bold;
}

.ticket-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 10px;
}

/* ===== Favorites ===== */
#btnFavoritos.active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .pos-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 56px);
        overflow: visible;
    }

    .pos-products {
        flex: none;
        width: 100%;
        max-height: 55vh;
        overflow-y: auto;
    }

    .pos-cart {
        width: 100%;
        flex: none;
        max-height: 45vh;
        border-left: none;
        border-top: 2px solid #dee2e6;
    }

    .cart-items {
        max-height: 30vh;
    }
}

@media (max-width: 767.98px) {
    .stat-card .stat-value {
        font-size: 1.3rem;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== Overlay ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-spinner.show {
    display: flex;
}

/* ===== Cash Register Status ===== */
.cash-status {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.cash-status.open {
    background-color: var(--success-color);
}

.cash-status.closed {
    background-color: var(--danger-color);
}

/* ===== Selector de Tema (Configuración) ===== */
.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-option {
    text-align: center;
    cursor: pointer;
}

.theme-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-swatch {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
    transition: var(--transition-speed);
    margin-bottom: 4px;
}

.theme-option input:checked + .theme-swatch {
    box-shadow: 0 0 0 3px var(--primary-color);
}

.theme-option span {
    font-size: 0.7rem;
    color: #6c757d;
}

/* ===== Login con fondo personalizado ===== */
.login-page.has-fondo {
    background: none;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-logo {
    max-height: 70px;
    max-width: 180px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.5rem;
}

/* ---------- Watermark EMM Soluciones ---------- */
.watermark {
    position: fixed;
    bottom: 12px;
    right: 16px;
    opacity: 0.10;
    pointer-events: none;
    z-index: 0;
}
.watermark img {
    height: 60px;
    width: auto;
    filter: grayscale(100%);
}
