/**
 * Construction Depot POS - Estilos CSS
 * ABC Group International
 * Optimizado para tablets Android
 */

:root {
    --primary-color: #30355c;
    --primary-dark: #232845;
    --primary-light: #3d4370;
    --secondary-color: #ff6b00;
    --secondary-dark: #e55a00;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.2);
    --transition: all 0.2s ease;
}

/* Server Banner */
.server-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 6px 15px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 10000;
    text-transform: uppercase;
}

.server-banner.server-test {
    background: #dc3545;
    color: white;
}

.server-banner.server-prod {
    background: #28a745;
    color: white;
}

/* Ajustar el body para que no quede tapado por el banner */
body {
    padding-top: 32px;
}

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

html, body {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Mejorar scroll en dispositivos táctiles */
.scrollable {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

/* ==================== VIEWS VISIBILITY ==================== */

.view {
    display: none;
}

.view.active {
    display: block;
}

#posView.active {
    display: flex;
    height: 100vh;
}

#pos-selectionView.active {
    display: block;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    background-color: var(--gray-100);
    color: var(--dark-color);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ==================== LOGIN PAGE ==================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-color);
    text-align: center;
    margin-bottom: 30px;
}

/* ==================== FORMS ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--gray-600);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(48, 53, 92, 0.15);
}

.form-control::placeholder {
    color: var(--gray-500);
}

/* Contenteditable input (para evitar autocompletado de Chrome) */
.content-editable-input {
    min-height: 24px;
    cursor: text;
}

.content-editable-input:empty:before {
    content: attr(data-placeholder);
    color: var(--gray-500);
    pointer-events: none;
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

.form-note {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 10px;
}

/* Customer search dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.search-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background: var(--gray-100);
}

.search-dropdown-item .customer-name {
    font-weight: 600;
    color: var(--gray-900);
}

.search-dropdown-item .customer-details {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.search-dropdown-empty {
    padding: 15px;
    text-align: center;
    color: var(--gray-500);
    font-style: italic;
}

/* Products list table */
.products-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.products-list-table thead {
    position: sticky;
    top: 0;
    background: #30355c;
    color: white;
    z-index: 10;
}

.products-list-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
}

.products-list-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.products-list-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.products-list-table tbody tr:hover {
    background: #f5f5f5;
}

.products-list-table tbody tr:active {
    background: #e8eaf6;
}

.products-list-table .product-name {
    font-weight: 500;
    color: #333;
}

.products-list-table .product-sku,
.products-list-table .product-barcode {
    font-family: monospace;
    font-size: 13px;
    color: #666;
}

.products-list-table .product-qty {
    font-weight: 600;
    text-align: center;
}

.products-list-table .product-qty.low-stock {
    color: #e74c3c;
}

/* Alert styles */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

/* Radio option toggle */
.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.radio-label {
    color: var(--gray-700);
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: var(--primary);
    font-weight: 600;
}

/* Create mode required indicators */
.create-only {
    display: none;
}

body.customer-create-mode .create-only {
    display: inline;
}

/* Password toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-control {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 18px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

/* Username with domain selector */
.username-input-group {
    display: flex;
    gap: 0;
}

.username-input-wrapper {
    flex: 1;
    position: relative;
}

.username-input-wrapper .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.username-input-group .domain-select {
    width: auto;
    min-width: 160px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
}

.username-input-group .domain-select:focus {
    background-color: #fff;
}

/* Username history dropdown */
.username-history-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.username-history-dropdown.show {
    display: block;
}

.username-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.username-history-item:last-child {
    border-bottom: none;
}

.username-history-item:hover {
    background: #f8f9fa;
}

.username-history-item .username-text {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.username-history-item .username-domain {
    font-size: 12px;
    color: #888;
    margin-left: 4px;
}

.username-history-item .username-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
    margin-left: 8px;
}

.username-history-item .username-delete:hover {
    background: #fee;
    color: #e74c3c;
}

.username-history-empty {
    padding: 12px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Cash Breakdown Modal */
.cash-breakdown-table {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.cash-breakdown-header {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    gap: 10px;
    padding: 12px 15px;
    background: #e9ecef;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
}

.cash-breakdown-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    gap: 10px;
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
}

.cash-breakdown-row:last-of-type {
    border-bottom: none;
}

.cash-denom-label {
    font-weight: 600;
    color: #2e7d32;
    font-size: 16px;
}

.cash-qty-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cash-qty-input:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.cash-subtotal {
    text-align: right;
    font-weight: 500;
    color: #333;
}

.cash-breakdown-total {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: #2e7d32;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.cash-breakdown-expected {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #1976d2;
    color: white;
    font-weight: 600;
    font-size: 15px;
}

.cash-breakdown-diff {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.cash-diff-ok {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
}

.cash-diff-over {
    background: rgba(255, 152, 0, 0.15);
    color: #e65100;
}

.cash-diff-short {
    background: rgba(244, 67, 54, 0.15);
    color: #c62828;
}

.btn-success {
    background: #2e7d32;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #1b5e20;
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-400);
    color: var(--gray-600);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 18px 32px;
    font-size: 18px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== POS LAYOUT ==================== */

.pos-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

.pos-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
    position: relative;
    width: 100%;
    min-width: 0;
}

.pos-sidebar {
    width: 380px;
    background: white;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--gray-300);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    min-height: 0; /* Importante para flexbox scroll */
}

/* ==================== POS HEADER ==================== */

.pos-header {
    background: var(--primary-color);
    color: white;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

.pos-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pos-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

/* Header elements */
.hdr-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

.hdr-btn:active { transform: scale(0.96); }
.hdr-back { padding: 8px 12px; font-size: 16px; }
.hdr-purple { background: #9b59b6; }
.hdr-red { background: #e74c3c; }
.hdr-outline { background: transparent; border: 1px solid rgba(255,255,255,0.4); }

.hdr-logo { height: 28px; }

.hdr-parking {
    background: #28a745;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 12px;
}

.hdr-conn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}
.hdr-conn.online { background: rgba(40,167,69,0.3); color: #28a745; }
.hdr-conn.offline { background: rgba(220,53,69,0.3); color: #dc3545; }

.hdr-user {
    text-align: right;
    font-size: 12px;
    line-height: 1.3;
    margin-right: 4px;
}
.hdr-user span { font-weight: 600; display: block; }
.hdr-user small { opacity: 0.8; }

.hdr-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hdr-txt { }

/* Hamburger */
.hdr-hamburger {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hdr-hamburger:active { background: rgba(255,255,255,0.3); }

/* Dropdown */
.hdr-dropdown {
    display: none;
    position: absolute;
    top: 52px;
    right: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    min-width: 200px;
    z-index: 9999;
    overflow: hidden;
}
.hdr-dropdown.active { display: block; }

.hdr-dropdown-user {
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}
.hdr-dropdown-user strong { display: block; color: #333; font-size: 14px; }
.hdr-dropdown-user small { color: #666; font-size: 12px; }

.hdr-dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: white;
    color: #333;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.hdr-dropdown-item:active { background: #f0f0f0; }

/* ===== RESPONSIVE ===== */

/* Large: ≥1100px - Todo visible, sin hamburguesa */
@media (min-width: 1100px) {
    .show-lg, .show-md, .show-sm { display: flex; }
    .hdr-txt, .show-tablet { display: inline; }
    .hdr-hamburger { display: none; }
    .hdr-dropdown-item { display: none; } /* Menu vacío */
}

/* Medium: 800-1099px - Ocultar nivel 3, mostrar nivel 2 con texto */
@media (min-width: 800px) and (max-width: 1099px) {
    .show-lg { display: none; }
    .show-md, .show-sm { display: flex; }
    .hdr-txt, .show-tablet { display: inline; }
    .hdr-hamburger { display: flex; }
    .hide-lg { display: block; }
    .hide-md { display: none; }
}

/* Small-Medium: 600-799px - Nivel 2 sin texto */
@media (min-width: 600px) and (max-width: 799px) {
    .show-lg { display: none; }
    .show-md, .show-sm { display: flex; }
    .show-tablet { display: none; }
    .show-sm .hdr-txt { display: inline; }
    .hdr-hamburger { display: flex; }
    .hdr-logo { height: 24px; }
    .hide-lg { display: block; }
    .hide-md { display: none; }
}

/* Small: 450-599px - Solo Pre-Order con texto, LOGO VISIBLE */
@media (min-width: 450px) and (max-width: 599px) {
    .show-lg, .show-md { display: none; }
    .show-sm { display: flex; }
    .show-sm .hdr-txt { display: inline; }
    .hdr-hamburger { display: flex; }
    .hdr-logo { height: 22px; }
    .hide-lg, .hide-md { display: block; }
}

/* Extra Small: <450px - Pre-Order solo icono, LOGO VISIBLE */
@media (max-width: 449px) {
    .show-lg, .show-md { display: none; }
    .show-sm { display: flex; }
    .hdr-txt { display: none !important; }
    .hdr-hamburger { display: flex; }
    .hdr-logo { height: 20px; }
    .hdr-parking { font-size: 11px; padding: 4px 8px; }
    .pos-header { padding: 6px 8px; }
    .pos-header-right { gap: 4px; }
    .hide-lg, .hide-md { display: block; }
}

/* ===== LANDSCAPE - CUALQUIER DISPOSITIVO ===== */
@media (orientation: landscape) and (min-width: 900px) {
    /* Header: solo esenciales + hamburguesa */
    .show-lg, .show-md { display: none !important; }
    .show-sm { display: flex !important; }
    .hdr-txt { display: none !important; }
    .hdr-hamburger { display: flex !important; }
    .hide-lg, .hide-md { display: block !important; }
    
    /* Layout horizontal */
    .pos-container {
        flex-direction: row !important;
        height: 100vh;
        height: 100dvh;
    }
    
    .pos-main {
        flex: 1;
        height: 100% !important;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .pos-header {
        flex-shrink: 0;
        padding: 4px 8px;
    }
    
    .scanner-section {
        flex-shrink: 0;
        padding: 5px 8px;
    }
    
    .products-area {
        flex: 1;
        min-height: 0;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    
    .pos-sidebar {
        width: 35%;
        min-width: 200px;
        max-width: 300px;
        height: 100% !important;
        border-left: 1px solid var(--gray-300);
        border-top: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .cart-header {
        flex-shrink: 0;
        padding: 5px 8px;
    }
    
    .cart-items {
        flex: 1;
        min-height: 0;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        padding: 4px;
    }
    
    .customer-section {
        flex-shrink: 0;
        padding: 4px 8px;
    }
    
    .cart-totals {
        flex-shrink: 0;
        padding: 4px 8px;
    }
    
    .cart-actions {
        flex-shrink: 0;
        padding: 5px 8px;
    }
    
    /* Compactar elementos */
    .hdr-logo { height: 20px; }
    .hdr-parking { font-size: 10px; padding: 3px 6px; }
    .hdr-btn { padding: 5px 8px; font-size: 12px; }
    .hdr-hamburger { width: 32px; height: 32px; font-size: 16px; }
    
    .cart-item { padding: 4px 6px; margin-bottom: 2px; }
    .cart-item-name { font-size: 11px; white-space: normal; overflow: visible; }
    .cart-item-sku { font-size: 9px; }
    .cart-item-price { font-size: 11px; }
    .qty-btn { width: 24px; height: 24px; font-size: 12px; }
    .qty-value { font-size: 11px; min-width: 18px; }
    .cart-total-row { font-size: 11px; margin-bottom: 2px; }
    .cart-total-row.grand-total { font-size: 13px; }
    .btn-pay { padding: 8px; font-size: 13px; }
    .btn-clear-cart { padding: 8px; font-size: 11px; }
    .customer-empty { padding: 5px; font-size: 11px; }
    
    .scanner-input-group input { padding: 6px 8px; font-size: 12px; }
    .scanner-input-group button { padding: 6px 10px; font-size: 11px; }
    .btn-scan { width: 32px; height: 32px; font-size: 14px; }
}

/* Offline Controls - deprecated */
.offline-controls {
    display: none;
}

.btn-sync,
.btn-pending {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-sync:hover,
.btn-pending:hover {
    background: #138496;
}

.btn-pending {
    background: #6c757d;
}

.pending-badge {
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: pulse-badge 2s infinite;
}

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

/* ==================== SCANNER SECTION ==================== */

.scanner-section {
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid var(--gray-300);
}

.scanner-input-group {
    display: flex;
    gap: 10px;
}

.scanner-input {
    flex: 1;
    padding: 14px 16px;
    font-size: 18px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
}

.scanner-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-scan {
    padding: 14px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 20px;
    cursor: pointer;
}

.btn-scan:active {
    background: var(--secondary-dark);
}

/* ==================== PRODUCTS AREA ==================== */

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

.product-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.product-card:active {
    border-color: var(--primary-color);
    transform: scale(0.98);
}

.product-card-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-sku {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Product Catalog Modal */
.catalog-product-item {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.catalog-product-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.catalog-product-item:active {
    background: #e9ecef;
    transform: scale(0.99);
}

.catalog-product-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 6px;
}

.catalog-product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.catalog-product-sku,
.catalog-product-barcode {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.catalog-product-price {
    margin-left: auto;
    font-weight: 700;
    color: var(--primary-color);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* ==================== CART SIDEBAR ==================== */

.cart-header {
    padding: 15px 20px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-size: 18px;
    font-weight: 600;
}

.cart-count {
    background: var(--secondary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
    min-height: 0; /* Importante para flexbox scroll */
}

.cart-item {
    background: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    overflow: visible;
}

.cart-item-sku {
    font-size: 11px;
    color: var(--gray-500);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.qty-btn:active {
    background: var(--gray-200);
}

.qty-value {
    font-size: 16px;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* ==================== CART TOTALS ==================== */

.cart-totals {
    padding: 15px 20px;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-300);
    flex-shrink: 0;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.cart-total-row.grand-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    padding-top: 10px;
    border-top: 2px solid var(--gray-300);
    margin-top: 10px;
}

.cart-actions {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: white;
}

.btn-pay {
    background: var(--success-color);
    color: white;
    padding: 18px;
    font-size: 20px;
    font-weight: 700;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    touch-action: manipulation;
}

.btn-pay:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.btn-pay:not(:disabled):active {
    background: #218838;
}

.btn-clear-cart {
    background: var(--gray-200);
    color: var(--gray-600);
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

/* ==================== MODAL ==================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

/* Customer modal siempre encima de otros modales */
#customerModal.modal-overlay {
    z-index: 1100;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-300);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ==================== PAYMENT MODAL ==================== */

.payment-amount-display {
    text-align: center;
    padding: 20px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.payment-label {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 5px;
}

.payment-total {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.payment-method-btn {
    padding: 15px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.payment-method-btn.selected {
    border-color: var(--primary-color);
    background: rgba(48, 53, 92, 0.1);
}

.payment-method-btn:active {
    transform: scale(0.98);
}

.payment-method-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.payment-method-name {
    font-size: 14px;
    font-weight: 500;
}

.payment-inputs {
    margin-bottom: 20px;
}

.payment-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.payment-input-label {
    flex: 1;
    font-weight: 500;
}

.payment-input-amount {
    width: 120px;
    padding: 10px;
    font-size: 18px;
    text-align: right;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
}

.payment-input-amount:focus {
    outline: none;
    border-color: var(--primary-color);
}

.payment-summary {
    background: var(--gray-100);
    padding: 15px;
    border-radius: var(--border-radius);
}

.payment-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.payment-summary-row.change {
    font-size: 20px;
    font-weight: 700;
    color: var(--success-color);
    padding-top: 10px;
    border-top: 1px solid var(--gray-300);
}

.payment-summary-row.remaining {
    color: var(--danger-color);
    font-weight: 600;
}

/* ==================== SCANNER MODAL ==================== */

.scanner-modal .modal {
    max-width: 400px;
}

.scanner-preview {
    width: 100%;
    aspect-ratio: 1;
    background: black;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

.scanner-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    border: 3px solid var(--secondary-color);
    border-radius: 10px;
}

.scanner-status {
    text-align: center;
    padding: 15px;
    font-size: 14px;
    color: var(--gray-600);
}

/* ==================== POS SELECTION ==================== */

.pos-selection-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pos-selection-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

.pos-selection-header .header-logo {
    height: 40px;
    vertical-align: middle;
    margin-right: 10px;
}

.pos-selection-content {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pos-selection-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--dark-color);
}

.pos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 800px;
}

.pos-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    border: 3px solid transparent;
}

.pos-card:hover, .pos-card:focus {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pos-card:active {
    transform: scale(0.98);
}

.pos-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.pos-card-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.pos-card-status {
    font-size: 14px;
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
}

.pos-card-status.available {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.pos-card-status.in-use {
    background: rgba(255, 193, 7, 0.1);
    color: #d39e00;
}

.pos-card-status.resume {
    background: rgba(23, 162, 184, 0.15);
    color: #117a8b;
    font-weight: 600;
}

.pos-card-status.closing-control {
    background: rgba(255, 152, 0, 0.15);
    color: #e65100;
    font-weight: 500;
}

.pos-card-status.closing-control-mine {
    background: rgba(46, 125, 50, 0.15);
    color: #2e7d32;
    font-weight: 600;
}

.pos-card-user {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 5px;
}

/* ==================== ALERTS / TOAST ==================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    animation: slideIn 0.3s ease;
}

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

.toast.success {
    background: var(--success-color);
    color: white;
}

.toast.error {
    background: var(--danger-color);
    color: white;
}

.toast.warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

.toast.info {
    background: var(--info-color);
    color: white;
}

/* ==================== LOADING ==================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    font-size: 16px;
    color: var(--gray-600);
}

/* ==================== RECEIPT PREVIEW ==================== */

.receipt-preview {
    background: white;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-width: 300px;
    margin: 0 auto;
    border: 1px dashed var(--gray-400);
}

.receipt-header {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-logo {
    max-width: 150px;
    margin-bottom: 10px;
}

.receipt-divider {
    border-top: 1px dashed var(--gray-400);
    margin: 10px 0;
}

/* ==================== NUMPAD ==================== */

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 15px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.numpad-btn {
    padding: 20px;
    font-size: 24px;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.numpad-btn:active {
    background: var(--gray-200);
}

.numpad-btn.action {
    background: var(--primary-color);
    color: white;
}

.numpad-btn.clear {
    background: var(--danger-color);
    color: white;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
    /* Tablet landscape */
    .pos-sidebar {
        width: 320px;
    }
    
    .product-result {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-result-price {
        margin-top: 5px;
    }
}

@media (max-width: 768px) {
    .pos-container {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
    }
    
    .pos-main {
        flex: 0 0 auto !important;
        max-height: 20vh !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .pos-sidebar {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        width: 100% !important;
        border-left: none !important;
        border-top: 2px solid var(--primary-color) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    .cart-header { flex: 0 0 auto !important; padding: 6px 10px; }
    
    .cart-items { 
        flex: 1 1 auto !important; 
        min-height: 0 !important; 
        overflow-y: auto !important; 
        -webkit-overflow-scrolling: touch; 
        padding: 6px; 
    }
    
    .customer-section { flex: 0 0 auto !important; padding: 4px 10px; }
    .cart-totals { flex: 0 0 auto !important; padding: 6px 10px; }
    .cart-actions { flex: 0 0 auto !important; padding: 8px 10px; display: flex; gap: 8px; }
    
    .btn-pay { flex: 2; padding: 12px; font-size: 15px; }
    .btn-clear-cart { flex: 1; padding: 12px; font-size: 12px; }
    
    .cart-item { padding: 4px 6px; margin-bottom: 3px; }
    .cart-item-name { font-size: 11px; white-space: normal; overflow: visible; }
    .cart-item-sku { font-size: 9px; }
    .cart-item-price { font-size: 12px; }
    .cart-total-row { font-size: 12px; margin-bottom: 2px; }
    .cart-total-row.grand-total { font-size: 14px; padding-top: 4px; margin-top: 4px; }
    .qty-btn { width: 26px; height: 26px; font-size: 13px; }
    .qty-value { font-size: 12px; min-width: 18px; }
    .scanner-section { padding: 6px; }
    .scanner-input { padding: 8px; font-size: 13px; }
    .product-results { max-height: 100px; overflow-y: auto; }
    .customer-empty { padding: 4px; font-size: 11px; }
    .cart-header .cart-title { font-size: 13px; }
    .cart-header .cart-count { font-size: 11px; padding: 2px 6px; }
}

/* ==================== TOUCH SCROLL GLOBAL ==================== */

.products-area,
.cart-items,
.modal-body,
.product-search-results {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ==================== PRINT STYLES ==================== */

@media print {
    body * {
        visibility: hidden;
    }
    
    .receipt-preview, .receipt-preview * {
        visibility: visible;
    }
    
    .receipt-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        padding: 5mm;
        border: none;
    }
}

/* ==================== CUSTOMER MODULE ==================== */

.customer-section {
    padding: 10px 15px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.customer-empty {
    padding: 12px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    text-align: center;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s ease;
}

.customer-empty:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(48, 53, 92, 0.05);
}

.customer-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-details {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.wallet-badge {
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 11px;
}

.wallet-badge.low {
    background: var(--warning-color);
}

.wallet-badge.empty {
    background: var(--danger-color);
}

.btn-change-customer {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--gray-600);
}

.btn-change-customer:hover {
    background: var(--gray-200);
}

.btn-remove-customer {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-customer:hover {
    background: #c82333;
}

/* Customer List */
.customer-list {
    padding: 0;
}

/* Company Type Toggle */
.company-type-toggle {
    display: flex;
    gap: 10px;
}

.btn-type {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--gray-300);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.btn-type:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-type.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Customer Search Input (Professional) */
.customer-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.customer-search-icon {
    position: absolute;
    left: 16px;
    font-size: 18px;
    color: #666;
    pointer-events: none;
}

.customer-search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    transition: all 0.2s ease;
    outline: none;
}

.customer-search-input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(48, 53, 92, 0.1);
}

.customer-search-input::placeholder {
    color: #999;
}

/* Wallet PIN Modal */
.wallet-pin-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.wallet-pin-digit {
    width: 55px;
    height: 65px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    transition: all 0.2s ease;
    outline: none;
}

.wallet-pin-digit:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(48, 53, 92, 0.1);
}

.wallet-pin-digit.error {
    border-color: #e74c3c;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Customer No Wallet Message */
.customer-no-wallet {
    background: #fff3e0;
    color: #e65100;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin: 10px 20px;
}

.customer-list-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s ease;
}

.customer-list-item:hover {
    background: var(--gray-50);
}

.customer-list-item:active {
    background: var(--gray-100);
}

.customer-list-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.customer-list-info {
    flex: 1;
    min-width: 0;
}

.customer-list-name {
    font-weight: 600;
    color: var(--gray-800);
}

.customer-list-meta {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.customer-list-wallet {
    text-align: right;
}

.customer-list-wallet-amount {
    font-weight: 600;
    color: var(--success-color);
}

.customer-list-wallet-label {
    font-size: 11px;
    color: var(--gray-500);
}

/* No results */
.customer-no-results {
    padding: 30px 20px;
    text-align: center;
    color: var(--gray-500);
}

.customer-no-results-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* ==================== RETURNS MODULE ==================== */

.return-step {
    min-height: 200px;
}

.return-items-list {
    max-height: 250px;
    overflow-y: auto;
}

.return-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    background: white;
}

.return-item:hover {
    border-color: var(--primary-color);
}

.return-item-info {
    flex: 1;
    min-width: 0;
}

.return-item-name {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-item-details {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.return-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
}

.return-item-qty label {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}

.return-item-qty input {
    width: 70px;
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
}

.return-item-qty input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.return-item-price {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--gray-800);
    margin-left: 15px;
}

.refund-method-buttons {
    display: flex;
    gap: 10px;
}

.refund-method-buttons .btn-type {
    flex: 1;
}

/* Already returned badge */
.return-item.fully-returned {
    opacity: 0.5;
    background: var(--gray-100);
}

.badge-returned {
    background: #6c757d;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

/* ==================== PARKING VIEW ==================== */

.parking-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a1d3a 100%);
    color: white;
}

.parking-header {
    text-align: center;
    padding: 30px 20px 20px;
}

.parking-header h1 {
    font-size: 28px;
    margin: 0 0 10px 0;
}

.parking-header .header-logo {
    height: 40px;
    vertical-align: middle;
    margin-right: 10px;
}

.parking-header p {
    margin: 0;
    opacity: 0.8;
    font-size: 14px;
}

.parking-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.parking-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.parking-content h2 {
    font-size: 24px;
    margin: 0 0 15px 0;
}

.parking-instruction {
    font-size: 16px;
    opacity: 0.8;
    margin: 0 0 30px 0;
    max-width: 300px;
}

.parking-scanner-container {
    width: 100%;
    max-width: 350px;
    margin-top: 20px;
}

.parking-scanner-preview {
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 15px;
}

.parking-scanner-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.parking-footer {
    padding: 30px 20px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    margin-top: auto;
}

.parking-footer .btn-outline {
    color: white;
    border-color: rgba(255,255,255,0.5);
    padding: 12px 30px;
    font-size: 16px;
}

.parking-footer .btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

/* Parking badge en header del POS */
.parking-badge {
    background: #28a745;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Back button */
.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    margin-right: 10px;
    font-size: 12px;
    padding: 6px 12px;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .parking-icon {
        font-size: 60px;
    }
    
    .parking-content h2 {
        font-size: 20px;
    }
    
    .parking-scanner-preview {
        height: 250px;
    }
}

/* Parking manual selection grid */
.parking-manual-section {
    margin-top: 20px;
}

.parking-manual-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 350px;
    margin: 0 auto;
}

.parking-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 15px 10px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.parking-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.05);
}

.parking-btn:active {
    transform: scale(0.95);
}

@media (max-width: 400px) {
    .parking-manual-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .parking-btn {
        padding: 12px 8px;
        font-size: 14px;
    }
}
/* ==================== PRE-ORDER STYLES ==================== */

.preorder-section {
    margin-bottom: 20px;
}

.preorder-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.preorder-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.preorder-card-icon {
    font-size: 40px;
    margin-right: 20px;
}

.preorder-card-content h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
}

.preorder-card-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.preorder-card-arrow {
    margin-left: auto;
    font-size: 24px;
    opacity: 0.8;
}

.section-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: #888;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.section-divider span {
    padding: 0 15px;
    font-size: 14px;
}

/* Pre-order menu modal */
.preorder-menu-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preorder-menu-btn {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.preorder-menu-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.preorder-menu-icon {
    font-size: 24px;
    margin-right: 15px;
}

.preorder-menu-text strong {
    display: block;
    margin-bottom: 3px;
}

.preorder-menu-text small {
    color: #666;
    font-size: 12px;
}

/* Pre-order list items */
.preorder-list-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.preorder-list-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.preorder-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.preorder-number {
    font-weight: bold;
    font-size: 14px;
    color: #667eea;
}

.preorder-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.preorder-status.open {
    background: #d4edda;
    color: #155724;
}

.preorder-status.done {
    background: #cce5ff;
    color: #004085;
}

.preorder-status.cancelled {
    background: #f8d7da;
    color: #721c24;
}

.preorder-list-customer {
    font-size: 14px;
    margin-bottom: 5px;
}

.preorder-list-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666;
}

/* Pre-order detail */
.preorder-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.preorder-detail-header h3 {
    margin: 0;
    color: #667eea;
}

.preorder-detail-customer p {
    margin: 5px 0;
}

.preorder-detail-lines {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.preorder-detail-lines h4 {
    margin: 0 0 10px 0;
}

.preorder-detail-line {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.preorder-detail-line .line-qty {
    width: 50px;
    font-weight: bold;
}

.preorder-detail-line .line-product {
    flex: 1;
}

.preorder-detail-line .line-price {
    width: 80px;
    text-align: right;
}

.preorder-detail-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #333;
    text-align: right;
    font-size: 18px;
}

/* Empty state */
.preorder-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.preorder-empty-state .spinner {
    margin: 0 auto 15px auto;
}

/* Modal fixes for pre-order */
#preorderDetailModal .modal-footer {
    display: flex;
    gap: 10px;
}

#cancelPreorderBtn {
    background: #dc3545;
    border-color: #dc3545;
}

#cancelPreorderBtn:hover {
    background: #c82333;
}

/* Search input group - History modal */
.search-input-group {
    display: flex;
    gap: 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-input-group:focus-within {
    border-color: var(--primary-color, #3d5a80);
}

.search-input-full {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 16px;
    outline: none;
}

.search-input-full::placeholder {
    color: #999;
}

.search-btn-inline {
    padding: 12px 20px;
    background: var(--primary-color, #3d5a80);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn-inline:hover {
    background: var(--primary-dark, #2c4a6e);
}

.search-btn-inline:active {
    transform: scale(0.98);
}

/* User header - parking view */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.user-icon {
    font-size: 24px;
}

.logout-btn {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(220, 53, 69, 1);
}

/* Logged user display - simple text */
.logged-user-display {
    text-align: center;
    color: white;
    font-size: 16px;
    padding: 10px;
    margin-bottom: 10px;
    opacity: 0.9;
}

/* ==================== REPRINT SEARCH RESULTS ==================== */

.reprint-result-item {
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.reprint-result-item:hover {
    border-color: #e67e22;
    background: #fef9f5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.15);
}

.reprint-result-item:active {
    transform: scale(0.99);
}