/* 
 * Styles pour la page de gestion du stock
 */

.stock-page {
    padding: 15px 15px 20px; /* Ajout de padding en haut */
}

.order-prep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.order-prep-header h1 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.order-prep-button-secondary {
    display: inline-flex;
    align-items: center;
    background-color: #f5f5f5;
    color: #333;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.order-prep-button-secondary svg {
    margin-right: 8px;
}

.order-prep-button-secondary:hover {
    background-color: #e0e0e0;
}

.stock-products-list {
    margin-bottom: 20px;
}

.stock-product-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 50px;
    height: 50px;
    overflow: hidden;
    margin-right: 15px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex: 1;
}

.product-name {
    font-size: 16px;
    margin: 0 0 5px;
    font-weight: 500;
    color: #333;
}

.product-meta {
    font-size: 13px;
    color: #666;
}

.product-stock {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    margin-left: 15px;
}

.stock-display {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
}

.negative-stock {
    color: #f44336;
}

.stock-input {
    width: 70px;
    padding: 8px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.update-stock-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
}

.order-prep-button {
    background-color: var(--op-ink);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.order-prep-button:hover {
    background-color: var(--op-ink-hover);
}

.order-prep-button:disabled {
    background-color: #b0b0b0;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .order-prep-header {
        flex-direction: column;
        align-items: center; /* Centre les éléments horizontalement */
        text-align: center;
    }
    
    .order-prep-header h1 {
        margin-bottom: 15px; /* Ajoute de l'espace entre le titre et les boutons */
    }
    
    .stock-product-item {
        flex-wrap: wrap;
    }
    
    .product-image {
        width: 40px;
        height: 40px;
    }
    
    .product-stock {
        margin-top: 10px;
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
    
    .stock-input {
        width: 60px;
    }
}

/*
 * Ecran vide de la liste de stock.
 *
 * Centre dans la hauteur disponible et en gris : c'est un etat, pas un
 * contenu. La largeur du texte est bornee, une ligne qui court sur toute la
 * largeur d'une tablette se lisant mal.
 */
.no-products {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /*
     * La hauteur visible, moins l'en-tete et le menu du bas : une valeur en
     * pourcentage de l'ecran seul aurait centre le bloc dans le tiers haut,
     * ces deux barres n'etant pas comptees.
     */
    min-height: calc(100vh - var(--order-prep-nav-total, 60px) - 130px);
    min-height: calc(100dvh - var(--order-prep-nav-total, 60px) - 130px);
    padding: 24px 24px 40px;
    box-sizing: border-box;
}

.no-products-icon {
    color: #c7cbd1;
    margin-bottom: 18px;
}

.no-products-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #6b7280;
}

.no-products-text {
    margin: 0 0 8px;
    max-width: 330px;
    font-size: 14px;
    line-height: 1.5;
    color: #9096a1;
}

.no-products-text:last-child {
    margin-bottom: 0;
}

/*
 * Avis de modifications non enregistrees, et marquage des nombres modifies.
 *
 * Le vert distingue ce qui a ete touche de ce qui ne l'a pas ete : sur une
 * liste de vingt produits, retrouver a l'oeil les trois nombres que l'on vient
 * de changer etait impossible.
 */
.stock-pending {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background-color: #e8f7ee;
    border: 1px solid #b7e4c7;
    color: #1b7a43;
    font-size: 14px;
    font-weight: 600;
}

.stock-pending[hidden] {
    display: none;
}

.stock-pending svg {
    flex: 0 0 auto;
}

.stock-input.is-modified {
    color: #1b7a43 !important;
    border-color: #1b7a43 !important;
    font-weight: 700 !important;
}

/* Le bord gauche signale la ligne concernee sans deplacer quoi que ce soit. */
.stock-product-item.has-change {
    box-shadow: inset 3px 0 0 0 #1b7a43;
}

/*
 * L'avis qui dit que la main est ailleurs.
 *
 * En rouge, parce qu'il annonce un refus d'ecrire, et non un simple
 * renseignement : le preparateur doit comprendre tout de suite que ce qu'il
 * comptait saisir ne partira pas.
 */
.stock-lock-notice {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #f0b4b0;
    border-left: 4px solid #d93025;
    border-radius: 8px;
    background: #fdeceb;
    color: #8a1c14;
    font-size: 14px;
    line-height: 1.35;
}
