/* Styles spécifiques pour la page de commandes */

/* Sélecteurs de quantité */
.quantity-selectors {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.quantity-selectors label {
    font-weight: 600;
    color: var(--text-primary);
}

.qty-buttons {
    display: flex;
    gap: 0.5rem;
}

.qty-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-width: 50px;
}

.qty-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.qty-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(94, 92, 230, 0.4);
    transform: translateY(-2px);
    font-weight: 700;
}

.qty-btn.active::after {
    content: '✓';
    margin-left: 0.3rem;
    font-size: 0.8rem;
}

/* Navigation secondaire */
.secondary-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 8px;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    background: var(--surface);
    border: 1px solid var(--border-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(94, 92, 230, 0.3);
    border-color: var(--primary);
}

/* Résumé de commande */
.order-summary {
    margin-bottom: 2rem;
}

.summary-card {
    background: #1a1a1a;
    color: var(--text-primary);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.summary-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.weight-kg {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.price-total {
    background: rgba(76, 175, 80, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
}

/* Section des filtres */
.filters-section {
    background: #1a1a1a;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
    border: 1px solid #333;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 2px solid #333;
    border-radius: 6px;
    font-size: 1rem;
    background: #2a2a2a;
    color: var(--text-primary);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Styles des cartes */
.card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.card-header {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

.card-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.card-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* Grille des produits */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.product-card {
    background: #1a1a1a;
    border: 2px solid #444;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

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

.product-card.in-order {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.15);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
}

.product-image-container {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Ratio 1:1 */
    position: relative;
    overflow: hidden;
    background: #2a2a2a;
}

.product-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
    border-radius: 4px;
}

.product-image-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: #666;
}

.product-quantity-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.product-info {
    padding: 0.5rem;
    text-align: center;
}

.product-name {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.product-supplier {
    color: var(--text-secondary);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.supplier-icon {
    width: 14px;
    height: 14px;
    object-fit: cover;
    flex-shrink: 0;
}



.product-in-order {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #4CAF50;
    color: white;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Tableau de commande */
.order-table-container {
    overflow-x: auto;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.order-table th,
.order-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.order-table th {
    background: var(--background-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.empty-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.item-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.type-badge {
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.type-badge.produit {
    background: #E3F2FD;
}

.type-badge.recette {
    background: #FFF3E0;
}

/* Contrôles de quantité */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.qty-btn:hover {
    background: var(--accent-dark);
}

.qty-input {
    width: 60px;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.btn-remove {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

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

/* Responsive */
@media (max-width: 768px) {
    .filters-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .secondary-nav {
        flex-direction: column;
    }
}

/* Styles d'impression */
@media print {
    .secondary-nav,
    .filters-section,
    .products-grid,
    .card-header p {
        display: none !important;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 1rem;
    }
    
    .order-summary {
        page-break-inside: avoid;
    }
    
    .order-table {
        page-break-inside: auto;
    }
    
    .order-table tr {
        page-break-inside: avoid;
    }
}

/* Bouton validation dépense Dollar Pills */
.order-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

.btn-validate-expense {
    background: rgba(76, 175, 80, 0.15) !important;
    border-color: #4CAF50 !important;
    color: #4CAF50 !important;
}

.btn-validate-expense:hover {
    background: rgba(76, 175, 80, 0.25) !important;
    border-color: #4CAF50 !important;
    color: #4CAF50 !important;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Indicateur de poids total coloré */
#total-weight-kg {
    transition: all 0.3s ease;
}

#total-weight-kg.weight-normal {
    color: #10b981;
}

#total-weight-kg.weight-warning {
    color: #f59e0b;
    font-weight: 700;
}

#total-weight-kg.weight-danger {
    color: #ef4444;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}