/* Styles pour le système POS */
.eticket-pos-system {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.pos-header {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.pos-header h2 {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
}

.pos-user-info {
    text-align: right;
    font-size: 0.95em;
}

.pos-user-info span {
    display: block;
    margin-bottom: 5px;
}

#pos-date {
    font-weight: 600;
    font-size: 1.1em;
}

.pos-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    height: 70vh;
}

@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Section Produits */
.pos-products-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    max-height: 600px;
    overflow-y: auto;
}

.pos-products-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 3px solid #27ae60;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    border-color: #27ae60;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.15);
}

.product-image {
    text-align: center;
    margin-bottom: 15px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 8px;
}

.no-image {
    font-size: 3em;
    color: #bdc3c7;
}

.product-info h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.1em;
    line-height: 1.3;
}

.product-description {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-price {
    margin-bottom: 10px;
}

.current-price, .sale-price {
    font-size: 1.3em;
    font-weight: bold;
    color: #27ae60;
}

.regular-price {
    text-decoration: line-through;
    color: #e74c3c;
    margin-left: 8px;
    font-size: 1em;
}

.product-stock {
    font-size: 0.85em;
    color: #7f8c8d;
}

.product-actions {
    margin-top: 15px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.add-to-cart-btn:hover {
    background: #2980b9;
}

/* Section Panier */
.pos-cart-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    max-height: 600px;
    overflow-y: auto;
}

.pos-cart-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.cart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.empty-cart {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.item-info {
    flex: 1;
}

.item-name {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.item-price {
    font-size: 0.9em;
    color: #7f8c8d;
}

.item-total {
    font-weight: bold;
    color: #27ae60;
    margin: 0 15px;
}

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

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #bdc3c7;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #ecf0f1;
}

.quantity {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.8em;
}

.remove-btn:hover {
    background: #c0392b;
}

.cart-totals {
    border-top: 2px solid #e1e5e9;
    padding-top: 15px;
    margin-bottom: 20px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.grand-total {
    border-top: 1px solid #bdc3c7;
    padding-top: 8px;
    font-size: 1.3em;
    color: #2c3e50;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.pos-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pos-btn-primary {
    background: #3498db;
    color: white;
}

.pos-btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
}

.pos-btn-secondary {
    background: #95a5a6;
    color: white;
}

.pos-btn-secondary:hover {
    background: #7f8c8d;
}

.pos-btn-success {
    background: #27ae60;
    color: white;
}

.pos-btn-success:hover:not(:disabled) {
    background: #219653;
}

.pos-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Modals */
.pos-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

.receipt-content {
    max-width: 500px;
}

.modal-header {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4em;
}

.close-modal {
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #ecf0f1;
}

.modal-body {
    padding: 25px;
}

/* --- Style amélioré du reçu --- */
.receipt {
    font-family: 'Courier New', Courier, monospace;
    color: #333;
    padding: 15px;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed #ccc;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.receipt-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.receipt-product-group h3 {
    background-color: #f0f0f0;
    padding: 5px;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
}

.receipt-ticket {
    display: flex;
    justify-content: space-between;
    border: 2px dotted #3498db;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #f8f9fa;
    page-break-inside: avoid;
}

.ticket-info {
    flex: 1;
    padding-right: 15px;
}

.ticket-info p {
    margin: 4px 0;
}

.ticket-qr {
    flex-basis: 160px;
    text-align: center;
    border-left: 2px dashed #ccc;
    padding-left: 15px;
}

.ticket-qr img {
    max-width: 140px;
    height: auto;
}

.ticket-number-main {
    font-family: monospace;
    background: #2c3e50;
    color: white;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}

.instructions {
    font-style: italic;
    color: #7f8c8d;
    font-size: 12px;
    border-left: 3px solid #f39c12;
    padding-left: 10px;
    margin-top: 10px;
}

.receipt-total {
    text-align: right;
    font-size: 1.2em;
    margin-top: 20px;
    border-top: 2px dashed #ccc;
    padding-top: 10px;
}

.receipt-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9em;
}

.receipt-warning {
    font-weight: bold;
}

/* Notifications POS */
.pos-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    z-index: 10000;
    max-width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
}

.pos-notification-success {
    background: #28a745;
}

.pos-notification-error {
    background: #dc3545;
}

.pos-notification-info {
    background: #17a2b8;
}

/* États de chargement */
.loading-products, .no-products, .error-message {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-style: italic;
    grid-column: 1 / -1;
}

/* Access denied */
.pos-access-denied {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 50px auto;
}

.pos-access-denied h3 {
    color: #e74c3c;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Responsive */

    .receipt {
        font-size: 10px;
    }
    
    .eticket-qr img {
        max-width: 100px;
    }
}

@media (max-width: 768px) {
    .pos-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .modal-content {
        width: 100%;
        margin: 1% auto;
    }
    
    .cart-actions {
        flex-direction: column;
    }
}

/* Styles pour la recherche et les filtres */
.pos-search-filters {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

.search-container {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.search-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    font-size: 1.2em;
}

.filter-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    font-size: 1em;
    min-width: 150px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #3498db;
}

.clear-search {
    padding: 12px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.clear-search:hover {
    background: #7f8c8d;
}

.search-stats {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 10px;
    text-align: center;
}

/* États des produits filtrés */
.product-card.hidden {
    display: none;
}

.product-card.highlight {
    border-color: #27ae60;
    background: #f8fff9;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.2);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    font-style: italic;
}

.no-results .emoji {
    font-size: 3em;
    margin-bottom: 10px;
    display: block;
}

/* Badges de statut */
.product-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 5px;
}

.badge-sale {
    background: #e74c3c;
    color: white;
}

.badge-low-stock {
    background: #f39c12;
    color: white;
}

.badge-out-of-stock {
    background: #95a5a6;
    color: white;
}

/* Animation de recherche */
.products-grid {
    transition: opacity 0.3s ease;
}

.products-grid.searching {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
    }
    
    .search-input {
        min-width: 100%;
    }
    
    .filter-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-select {
        flex: 1;
        min-width: auto;
    }
}

/* Surbrillance des résultats de recherche */
.search-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    color: #856404;
}

/* Animation de pulse pour les nouveaux résultats */
@keyframes pulseHighlight {
    0% { background-color: #f8fff9; }
    50% { background-color: #e8f5e8; }
    100% { background-color: #f8fff9; }
}

.product-card.highlight {
    animation: pulseHighlight 2s ease-in-out;
}

/* Mise en page pour l'impression */
@media print {
    .receipt-ticket {
        border: 2px solid #000 !important;
    }
    
    .ticket-qr {
        border-left: 2px solid #000 !important;
    }
}