/* Paleta de colores y fuentes base */
:root {
    --primary-bg: #2F4050;
    --secondary-bg: #f3f3f4;
    --text-color: #676a6c;
    --header-bg: #fff;
    --border-color: #e7eaec;
    --accent-color: #1ab394; /* Un verde como acento */
    --danger-color: #ed5565;
    --font-family: 'Open Sans', helvetica, arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--secondary-bg);
    color: var(--text-color);
    margin: 0;
    font-size: 14px;
}

.pos-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.pos-header {
    background: var(--header-bg);
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
}
.company-info h1 {
    margin: 0;
    font-size: 24px;
    color: var(--primary-bg);
}
.company-info p {
    margin: 5px 0 0;
    font-size: 13px;
}
.header-actions .action-btn {
    margin-left: 10px;
}

/* Main Content */
.pos-main {
    flex-grow: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow-y: auto;
}
.product-section {
    flex-basis: 50%;
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.cart-section {
    flex-basis: 50%;
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

h2 {
    color: var(--primary-bg);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 0;
}
h2 i {
    margin-right: 10px;
}

/* Buscador de Productos */
.search-container {
    position: relative;
    width: 100%;
}
#product-search {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.autocomplete-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    z-index: 100;
}
.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div:hover {
    background-color: #e9e9e9;
}
.autocomplete-active {
    background-color: var(--accent-color) !important;
    color: #ffffff;
}
.search-container input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
}

/* Carrito de Compras */
.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}
.cart-item:last-child {
    border-bottom: none;
}
.item-details {
    flex-grow: 1;
}
.item-quantity {
    display: flex;
    align-items: center;
}
.item-quantity input {
    width: 50px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    margin: 0 5px;
}
.remove-item-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 10px;
}
.cart-summary {
    text-align: right;
    font-size: 24px;
    margin-top: 20px;
    color: var(--primary-bg);
    border-top: 2px solid var(--border-color);
    padding-top: 15px;
}

/* Footer y Controles */
.pos-footer {
    background: var(--header-bg);
    padding: 15px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cash-control, .sale-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.cash-btn, .sale-btn, .action-btn {
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 5px;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}
.cash-btn.open { background-color: var(--accent-color); }
.cash-btn.close { background-color: #f8ac59; } /* Naranja */
.sale-btn.cancel { background-color: var(--danger-color); }
.sale-btn.process { background-color: #23c6c8; } /* Cyan */
.action-btn { background-color: #1c84c6; } /* Azul */

button:disabled {
    background-color: #c0c0c0;
    cursor: not-allowed;
}
#cash-status {
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 15px;
}
.status-open {
    color: var(--accent-color);
    background-color: rgba(26, 179, 148, 0.1);
}
.status-closed {
    color: var(--danger-color);
    background-color: rgba(237, 85, 101, 0.1);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-content.large {
    max-width: 800px;
}
.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
#company-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
}
#report-content ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
#report-content li {
    padding: 8px;
    border-bottom: 1px dashed var(--border-color);
}
.report-actions, .history-filters {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}
#history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
}
#history-stats {
    display: flex;
    justify-content: space-around;
    background: var(--secondary-bg);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
}

/* Estilos para impresión */
@media print {
    body, .pos-container {
        visibility: hidden;
    }
    #ticket-print, #ticket-print * {
        visibility: visible;
    }
    #ticket-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}
.ticket {
    width: 300px; /* Ancho típico de ticket */
    font-size: 12px;
    color: #000;
}
.ticket-header { text-align: center; }
.ticket-header h2 { font-size: 16px; margin: 0; }
.ticket-items table { width: 100%; border-collapse: collapse; }
.ticket-items th, .ticket-items td { padding: 2px 0; }
.ticket-items .qty { text-align: center; }
.ticket-items .price { text-align: right; }
.ticket-total { text-align: right; font-size: 14px; margin-top: 10px;}

/* Diseño Responsivo */
@media (max-width: 768px) {
    .pos-main {
        flex-direction: column;
    }
    .pos-footer {
        flex-direction: column;
        gap: 15px;
    }
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

/* Estilos para el nuevo Catálogo de Productos */
.product-catalog-container {
    margin-top: 25px;
}

.product-catalog-container h3 {
    color: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-size: 16px;
}

.product-list {
    max-height: 400px; /* Ajusta la altura máxima según necesites */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 10px;
}

.catalog-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

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

.catalog-item:hover {
    background-color: #f7f7f7;
}

.catalog-item strong {
    color: #333;
}

.catalog-item span {
    font-weight: bold;
    color: var(--accent-color);
}

/* Estilos para el Selector de Moneda */
.currency-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    font-weight: bold;
    margin-right: 15px;
}

.currency-selector-container select {
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #fff;
    font-weight: bold;
}