/* Styles CSS pour l'application POS */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
}

/* Layout POS */
.pos-container {
    height: calc(100vh - 56px); /* Hauteur moins navbar */
    display: flex;
    flex-direction: column;
}

.pos-toolbar {
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pos-main {
    flex: 1;
    overflow: hidden;
}

.pos-products {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.categories-bar {
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.category-btn {
    white-space: nowrap;
    min-width: 120px;
}

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

.products-grid {
    flex: 1;
    overflow-y: auto;
}

/* Cartes produits */
.product-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    min-height: 180px;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* État rupture de stock */
.product-card.out-of-stock {
    opacity: 0.5;
    filter: grayscale(100%);
    cursor: not-allowed;
    position: relative;
    pointer-events: none; /* bloque le clic */
}

.product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.product-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
    border-radius: 4px;
    margin: 0 auto;
}

.product-name {
    font-size: 0.9rem;
    line-height: 1.2;
    height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1rem;
    color: var(--success-color) !important;
}

/* Panneau panier */
.pos-cart {
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1);
}

.cart-header {
    flex-shrink: 0;
}

.customer-section {
    flex-shrink: 0;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
}

.cart-totals {
    flex-shrink: 0;
}

.cart-actions {
    flex-shrink: 0;
}

/* Articles du panier */
.cart-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.cart-item:hover {
    background-color: var(--light-color);
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.cart-item-price {
    color: var(--success-color);
    font-weight: 600;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.qty-input {
    width: 60px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 4px;
}

/* Modal de paiement */
.payment-method {
    text-align: left;
    padding: 12px 16px;
    margin-bottom: 5px;
}

.payment-method.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.payment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--light-color);
    border-radius: 4px;
    margin-bottom: 5px;
}

.payment-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Pavé numérique */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
}

.numpad-btn {
    aspect-ratio: 1;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
}

.numpad-btn-wide {
    grid-column: span 2;
}

/* États et badges */
.stock-low {
    color: var(--warning-color);
}

.stock-out {
    color: var(--danger-color);
}

.session-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cart-item {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .pos-main {
        flex-direction: column;
    }
    
    .pos-cart {
        width: 100% !important;
        height: 50vh;
        border-start: none !important;
        border-top: 1px solid #dee2e6;
    }
    
    .products-grid {
        height: 50vh;
    }
    
    .product-card {
        min-height: 140px;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2d3748;
        --dark-color: #f7fafc;
    }
    
    body {
        background-color: var(--dark-color);
        color: var(--light-color);
    }
}

/* Impression */
@media print {
    .pos-toolbar,
    .pos-cart,
    .navbar {
        display: none !important;
    }
    
    .pos-products {
        width: 100% !important;
    }
}
