/* 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;
    transition: opacity 0.3s ease;
}

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

.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-card.hidden {
    display: none;
}

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

@keyframes pulseHighlight {
    0% { background-color: #f8fff9; }
    50% { background-color: #e8f5e8; }
    100% { background-color: #f8fff9; }
}

.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;
}

/* 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;
}

.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;
}

/* --- STYLES POUR LE RECU AFFICHE A L'ECRAN --- */
.receipt {
    font-family: 'Courier New', Courier, monospace;
    color: #333;
    padding: 15px;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.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 solid #3498db;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    page-break-inside: avoid;
}

.receipt-ticket:hover {
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    transform: translateY(-2px);
}

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

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

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

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

.ticket-qr img {
    max-width: 140px;
    height: auto;
    border: 1px solid #ddd;
    padding: 5px;
    background: white;
}

/* BADGES DE VALIDITÉ */
.badge-multi {
    background: #3498db;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 10px;
    display: inline-block;
}

.badge-validity-once {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
    color: white !important;
    border: 1px solid #c0392b !important;
}

.badge-validity-period {
    background: linear-gradient(135deg, #27ae60, #229954) !important;
    color: white !important;
    border: 1px solid #1e8449 !important;
}

.badge-validity-day {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    color: white !important;
    border: 1px solid #1c5d99 !important;
}

.ticket-validity {
    background: #e8f4f8;
    padding: 5px 10px;
    border-radius: 5px;
    margin: 10px 0;
    border-left: 3px solid #3498db;
    font-weight: bold;
    color: #2c3e50;
}

.ticket-validity.validity-once {
    background: #fdf2e9;
    color: #e67e22;
    border-left: 4px solid #e67e22;
}

.ticket-validity.validity-period {
    background: #eafaf1;
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

.ticket-validity.validity-day {
    background: #e8f4f8;
    color: #3498db;
    border-left: 4px solid #3498db;
}

/* DÉTAILS ÉVÉNEMENT MULTI-JOURS */
.event-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.event-detail {
    padding: 10px;
    background: white;
    border-radius: 5px;
    border-left: 4px solid #3498db;
    transition: all 0.3s ease;
}

.event-detail:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.event-detail .detail-label {
    font-weight: bold;
    color: #2c3e50;
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
}

.event-detail .detail-value {
    color: #7f8c8d;
    font-size: 13px;
}

/* INSTRUCTIONS SPÉCIALES POUR VALIDITÉ */
.special-instructions {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
}

.special-instructions.validity-once {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 3px solid #e67e22;
    color: #d35400;
}

.special-instructions.validity-period {
    background: linear-gradient(135deg, #d1f2eb, #a3e4d7);
    border: 3px solid #27ae60;
    color: #229954;
}

.special-instructions h5 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

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

/* STYLES POUR LA VALIDITÉ ET LES PÉRIODES */
.receipt-validity {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 5px;
    text-align: center;
    border-left: 5px solid #1c5d99;
}

.validity-label {
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.validity-value {
    font-size: 13px;
    font-weight: bold;
}

.period-display {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    color: #d35400;
    padding: 8px;
    margin: 10px 0;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    border: 2px solid #e67e22;
    font-size: 12px;
    text-transform: uppercase;
}

/* CATÉGORIES DE TICKETS */
.category-vip { 
    background: #f39c12 !important; 
    color: white !important; 
}
.category-vvip { 
    background: #d35400 !important; 
    color: white !important; 
}
.category-premium { 
    background: #c0392b !important; 
    color: white !important; 
}
.category-normal { 
    background: #95a5a6 !important; 
    color: white !important; 
}

.ticket-category {
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    margin-left: 10px;
}

/* INFORMATIONS ÉVÉNEMENT */
.receipt-event-info {
    background: linear-gradient(135deg, #e8f4f8, #d1ecf1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #3498db;
}

.receipt-event-info h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.receipt-event-info h3 .ticket-category {
    margin-left: 15px;
}

/* MISE EN PAGE AMÉLIORÉE POUR LE RECU */
.receipt-instructions .instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.instruction-icon {
    font-size: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.instruction-item p {
    margin: 0;
    color: #2c3e50;
}

.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;
}

/* ============================================
   SECTION IMPRESSION RECU POS
   ============================================ */
@media print {
    /* MASQUER LES ÉLÉMENTS INTERACTIFS */
    .pos-btn, 
    .modal-actions, 
    .no-print {
        display: none !important;
    }
    
    /* OPTIMISATION POUR L'IMPRESSION */
    body {
        background: white !important;
        color: black !important;
        font-size: 11px !important;
    }
    
    /* ASSURER QUE LE LAYOUT RESTE CORRECT */
    .receipt-ticket {
        display: flex !important;
        page-break-inside: avoid !important;
        border: 2px solid #000 !important;
        margin: 10px 0 !important;
        padding: 10px !important;
    }
    
    .ticket-info {
        flex: 1 !important;
        padding-right: 15px !important;
    }
    
    .ticket-qr {
        flex: 0 0 120px !important;
        border-left: 2px dashed #ccc !important;
        padding-left: 15px !important;
        text-align: center !important;
    }
    
    .ticket-qr img {
        max-width: 100px !important;
        height: auto !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* AMÉLIORER LA LISIBILITÉ DES TEXTES */
    .detail-label {
        font-weight: bold !important;
        color: black !important;
    }
    
    /* FORCER LES COULEURS DES BADGES */
    .badge-multi {
        background: #3498db !important;
        color: white !important;
        border: 1px solid #000 !important;
    }
    
    .badge-validity-once,
    .badge-validity-period,
    .badge-validity-day {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
    
    .ticket-category {
        border: 1px solid #000 !important;
        font-weight: bold !important;
    }
    
    .ticket-validity {
        border: 1px solid #000 !important;
        background: white !important;
        color: #000 !important;
    }
    
    /* ÉVITER LES COUPURES DANS LES SECTIONS IMPORTANTES */
    .receipt-product-group {
        page-break-inside: avoid !important;
    }
    
    /* MARGES D'IMPRESSION */
    @page {
        margin: 15mm;
    }
    
    /* STYLE POUR LES ÉVÉNEMENTS MULTI-JOURS */
    .event-details-grid {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .special-instructions {
        background: #fff3cd !important;
        border: 2px solid #ffeaa7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .period-display {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        border: 2px solid #000 !important;
        color: #000 !important;
    }
}

/* 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 */
.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;
}

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

/* 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;
    }
}