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

:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(22, 30, 49, 0.7);
    --bg-input: #111827;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #14b8a6;
    --primary-hover: #0d9488;
    --secondary: #6366f1;
    --secondary-hover: #4f46e5;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    --font-sans: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(20, 184, 166, 0.15);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 45%);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover {
    border-color: rgba(20, 184, 166, 0.2);
    box-shadow: var(--shadow-glow), var(--shadow);
    transform: translateY(-2px);
}

/* Auth / Login Page styling */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    text-align: center;
}
.auth-logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.05em;
}
.auth-logo span {
    font-weight: 300;
}
.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* Forms and Inputs */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.form-select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.35);
}
.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-gray {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-gray:hover {
    background: rgba(255, 255, 255, 0.12);
}
.btn-block {
    width: 100%;
}

/* Header & Navigation Bar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
}
.nav-brand span {
    font-weight: 300;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}
.user-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
}

/* Sub-nav menus (for admin) */
.sub-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
}
.sub-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
}
.sub-nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}
.sub-nav-link.active {
    color: var(--primary);
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.2);
}

/* Stats Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(20, 184, 166, 0.1);
    color: var(--primary);
}
.stat-icon.secondary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--secondary);
}
.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 4px;
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Waiter View: Tables Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}
.table-card {
    text-align: center;
    padding: 30px 20px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.table-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}
.table-card.libre::before { background-color: var(--success); }
.table-card.ocupada::before { background-color: var(--warning); }
.table-card.esperando-cuenta::before { background-color: var(--info); }

.table-number {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.table-capacity {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.table-status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.table-card.libre .table-status-pill {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}
.table-card.ocupada .table-status-pill {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.table-card.esperando-cuenta .table-status-pill {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

/* Waiter View: Menu & Order Selection Split Layout */
.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
    width: 100%;
}
.pos-menu-column {
    min-width: 0;
    width: 100%;
}
@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }
}
.menu-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
    width: 100%;
    scrollbar-width: thin;
}
.menu-categories::-webkit-scrollbar {
    height: 5px;
}
.menu-categories::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
.menu-categories::-webkit-scrollbar-thumb {
    background: rgba(20, 184, 166, 0.4);
    border-radius: 4px;
}
.menu-categories::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
.category-btn {
    padding: 8px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}
.category-btn.active, .category-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.product-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--transition);
}
.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    background: rgba(20, 184, 166, 0.03);
}
.product-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
}
.product-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    flex-grow: 1;
}
.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}
.product-stock-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}
.stock-ok { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stock-low { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Order Panel Drawer (Right side) */
.order-drawer {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    position: sticky;
    top: 96px;
    width: 100%;
    min-width: 320px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.order-items-list {
    flex-grow: 1;
    overflow-y: auto;
    margin: 16px 0;
    padding-right: 4px;
}
.order-item-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.order-item-title {
    font-weight: 500;
    font-size: 0.95rem;
}
.order-item-quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
}
.qty-btn:hover { background: rgba(255, 255, 255, 0.15); }
.order-item-notes {
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 100%;
    margin-top: 6px;
    outline: none;
    padding: 2px 0;
}
.order-totals {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-bottom: 16px;
}
.totals-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}
.totals-row.grand-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    padding-top: 10px;
    margin-top: 10px;
}

/* =========================================================
   MOBILE CART / BOTTOM SHEET FOR WAITER ORDER VIEW
   ========================================================= */
.mobile-cart-bar {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 14px;
    right: 14px;
    z-index: 990;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.97) 0%, rgba(31, 41, 55, 0.97) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid var(--primary);
    border-radius: 18px;
    padding: 12px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(20, 184, 166, 0.25);
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    animation: slideUpMobileBar 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUpMobileBar {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.mobile-cart-bar:active {
    transform: scale(0.98);
}
.mobile-cart-bar.cart-bump {
    animation: cartBumpAnim 0.3s ease;
}
@keyframes cartBumpAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); border-color: #34d399; }
    100% { transform: scale(1); }
}
.mobile-cart-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mobile-cart-icon-badge {
    position: relative;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
}
.mobile-cart-badge-count {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.mobile-cart-summary {
    display: flex;
    flex-direction: column;
}
.mobile-cart-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.mobile-cart-total-amount {
    font-size: 1.15rem;
    font-weight: 800;
    color: #34d399;
}
.mobile-cart-action-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #0d9488 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
    cursor: pointer;
}
.mobile-cart-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 995;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-cart-backdrop.active {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
}
.mobile-close-drawer-btn {
    display: none;
}
.mobile-header-cart-btn {
    display: none;
}

@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
        padding-bottom: 95px; /* Espacio para que la barra flotante no tape los últimos platos */
    }

    .mobile-cart-bar {
        display: flex;
    }

    .mobile-header-cart-btn {
        display: inline-flex !important;
    }

    .order-drawer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 85vh !important;
        border-radius: 24px 24px 0 0 !important;
        background: #111827 !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-bottom: none !important;
        box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.85) !important;
        z-index: 1000 !important;
        transform: translateY(105%) !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        margin: 0 !important;
        padding: 20px 20px 24px 20px !important;
    }

    .order-drawer.mobile-open {
        transform: translateY(0%) !important;
    }

    .mobile-close-drawer-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: var(--text-main);
        font-size: 1.1rem;
        cursor: pointer;
    }
}

/* Kitchen View: Order Board */
.kitchen-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.kitchen-card {
    border-top: 4px solid var(--primary);
}
.kitchen-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 12px;
}
.kitchen-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.kitchen-time.warning {
    color: var(--danger);
    animation: blinker 1s linear infinite;
}
@keyframes blinker {
    50% { opacity: 0.4; }
}
.kitchen-items-list {
    margin-bottom: 16px;
}
.kitchen-item {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: start;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.kitchen-item:last-child { border-bottom: none; }
.kitchen-item-qty {
    background: rgba(20, 184, 166, 0.15);
    color: var(--primary);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 8px;
}
.kitchen-item-notes {
    font-size: 0.8rem;
    color: #fca5a5;
    margin-top: 4px;
    font-style: italic;
}

/* Cashier / Caja view table styling */
.caja-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.data-table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.data-table th {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}
.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 16px;
    overflow-y: auto;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-container {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: var(--transition);
}
.modal-overlay.active .modal-container {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.modal-close:hover { color: white; }

/* Grid systems for modules */
.grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 768px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

.alert-bar {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.alert-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }
.alert-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }

/* Quick Recipe Modal Custom styling */
.recipe-ingredient-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Print Media Styles for POS Thermal Receipts */
@media print {
    /* Hide all main elements directly under body except the ticket */
    body > *:not(#ticket-imprimible) {
        display: none !important;
    }
    
    /* Force 100% pure black, no dithering gray on thermal printer */
    #ticket-imprimible, #ticket-imprimible * {
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    /* Show and style only the ticket container */
    #ticket-imprimible {
        display: block !important;
        width: 80mm !important; /* Fit 80mm paper */
        max-width: 80mm !important;
        margin: 0 auto !important;
        padding: 6px 10px !important;
        box-sizing: border-box !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        font-size: 12px !important;
        color: #000 !important;
        background: #fff !important;
        line-height: 1.35 !important;
        -webkit-font-smoothing: antialiased;
    }

    .ticket-receipt {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        color: #000 !important;
    }
    
    .ticket-header {
        text-align: center;
        margin-bottom: 6px;
    }
    .ticket-title {
        font-size: 16px;
        font-weight: 800;
        letter-spacing: 0.3px;
        color: #000 !important;
        line-height: 1.25;
    }
    .ticket-subtitle {
        font-size: 11px;
        font-weight: 600;
        margin-top: 2px;
        color: #000 !important;
    }
    .ticket-info {
        font-size: 10.5px;
        font-weight: 500;
        color: #000 !important;
        line-height: 1.3;
    }
    
    .ticket-cpe-box {
        font-size: 12px;
        border: 2px solid #000;
        border-radius: 4px;
        padding: 6px 8px;
        text-align: center;
        margin: 8px 0;
        width: 100%;
        box-sizing: border-box;
        line-height: 1.4;
    }

    .ticket-client-box {
        border: 1.5px solid #000;
        border-radius: 4px;
        padding: 6px 8px;
        margin: 8px 0;
        background: #fff;
    }
    .ticket-client-box .client-row {
        font-size: 11.5px;
        line-height: 1.35;
        margin-bottom: 3px;
        display: flex;
        align-items: baseline;
        gap: 4px;
    }
    .ticket-client-box .client-row:last-child {
        margin-bottom: 0;
    }
    .ticket-client-box .client-label {
        font-weight: 800;
        white-space: nowrap;
    }
    .ticket-client-box .client-val {
        font-weight: 700;
        word-break: break-word;
    }

    .ticket-divider {
        border-top: 1px solid #000;
        margin: 6px 0;
    }
    
    .ticket-meta {
        font-size: 11px;
        margin-bottom: 6px;
    }
    .ticket-meta-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2px;
        font-size: 11px;
        font-weight: 500;
        color: #000 !important;
    }
    .ticket-meta-row strong {
        font-weight: 700;
    }
    
    .ticket-items-header {
        display: flex;
        font-weight: 800;
        font-size: 11.5px;
        border-bottom: 1px solid #000;
        padding-bottom: 3px;
        margin-bottom: 4px;
        color: #000 !important;
    }
    .hdr-qty { width: 16%; }
    .hdr-name { width: 56%; }
    .hdr-price { width: 28%; text-align: right; }
    
    .ticket-items {
        margin: 4px 0;
    }
    .ticket-item {
        margin-bottom: 4px;
        page-break-inside: avoid;
    }
    .ticket-item-main {
        display: flex;
        font-size: 11.5px;
        line-height: 1.3;
        align-items: start;
        color: #000 !important;
    }
    .ticket-qty {
        width: 16%;
        font-weight: 700;
    }
    .ticket-name {
        width: 56%;
        word-break: break-word;
        font-weight: 500;
    }
    .ticket-price {
        width: 28%;
        text-align: right;
        font-weight: 700;
    }
    .ticket-item-notes {
        font-size: 9.5px;
        font-style: italic;
        padding-left: 16%;
        color: #000 !important;
        margin-top: 1px;
    }
    
    .ticket-totals {
        font-size: 11.5px;
        margin-top: 6px;
    }
    .ticket-total-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 3px;
        font-weight: 600;
        color: #000 !important;
    }
    .ticket-grand-total {
        font-size: 14.5px;
        font-weight: 900;
        border-top: 1.5px solid #000;
        border-bottom: 1.5px solid #000;
        padding: 4px 0;
        margin-top: 4px;
        color: #000 !important;
    }
    
    .ticket-footer {
        text-align: center;
        margin-top: 10px;
        font-size: 10.5px;
        color: #000 !important;
    }
    .ticket-payment-method {
        font-size: 11.5px;
        font-weight: 700;
        margin-bottom: 6px;
        color: #000 !important;
    }
    .ticket-thanks {
        font-weight: 700;
        font-size: 11px;
        margin-bottom: 4px;
        color: #000 !important;
    }
    .ticket-visit {
        font-size: 10px;
        font-weight: 600;
        color: #000 !important;
    }

    /* Contenedor del código QR local */
    #ticket-qr-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 8px auto !important;
        text-align: center !important;
        width: 120px !important;
        min-height: 120px !important;
    }
    #ticket-qr-container canvas {
        display: none !important;
    }
    #ticket-qr-container img {
        display: block !important;
        margin: 0 auto !important;
        width: 120px !important;
        height: 120px !important;
        image-rendering: pixelated !important;
    }

    .ticket-logo {
        max-width: 130px !important;
        max-height: 75px !important;
        object-fit: contain !important;
        display: block !important;
        margin: 0 auto 6px auto !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Clean up page dimensions for roll printers */
    @page {
        margin: 0;
        size: auto;
    }
}

/* Ocultar ticket fuera de pantalla para permitir que el navegador renderice canvas e imágenes */
@media screen {
    #ticket-imprimible {
        position: fixed !important;
        left: -9999px !important;
        top: 0 !important;
        width: 80mm !important;
        opacity: 0 !important;
        pointer-events: none !important;
        display: block !important;
    }
}
