/* 
 * Styles pour la consultation de commande archivée 
 */

/* Conteneur principal */
.view-order-page {
    font-family: 'Open Sans', sans-serif;
    padding: 15px;
    background-color: #fff;
    min-height: 100vh;
}

.view-order-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
}

/* Order timing information */
.order-timing-info {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}

.timing-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.timing-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.timing-value {
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

/* En-tête de la commande */
.view-order-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.view-order-number {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.view-order-meta {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px 0;
}

.view-customer-info {
    font-size: 15px;
    display: flex;
    align-items: center;
    margin: 10px 0 0 0;
}

.view-info-icon, 
.view-comment-icon {
    cursor: pointer;
    width: 20px;
    height: 20px;
    margin-left: 8px;
}

.view-comment-icon {
    color: #f44336;
}

/* Bouton retour */
.view-order-back {
    margin-bottom: 20px;
}

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

.back-button:hover {
    background-color: #e0e0e0;
}

.back-button svg {
    margin-right: 5px;
}

/* Sections */
.view-order-section-title {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

/* Liste des produits */
.view-order-products {
    margin-bottom: 30px;
}

.view-products-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.view-product-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.view-product-quantity {
    width: 40px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
}

.view-product-image {
    width: 60px;
    height: 60px;
    margin: 0 15px;
    object-fit: contain;
    background-color: #fff;
    border-radius: 4px;
}

.view-product-details {
    flex: 1;
}

.view-product-name {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 5px;
}

.view-product-price,
.view-product-unit-price {
    font-size: 13px;
    color: #666;
}

/* Informations client */
.view-customer-section {
    margin-bottom: 30px;
}

.view-customer-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.view-address-section {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
}

.view-address-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 10px 0;
    color: #333;
}

.view-address-content {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.view-carrier-section {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Notes de commande */
.view-notes-section {
    margin-bottom: 30px;
}

.view-note-item {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.view-note-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 10px 0;
    color: #333;
}

.view-note-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-style: italic;
}

.view-note-content {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.customer-note {
    border-left: 3px solid #f44336;
}

/* Historique client */
.view-customer-history {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-top: 30px;
}

.customer-orders-count {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    color: #333;
}

/* Modales */
.view-info-modal,
.view-comment-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.view-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    overflow: hidden;
    max-height: 90vh; /* repli navigateurs sans dvh */
    max-height: min(90dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.view-modal-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
}

.view-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.view-modal-body {
    padding: 15px;
    overflow-y: auto;
}

/* Info blocks styling for modal */
.info-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: background-color 0.2s ease;
}

.info-block:hover {
    background-color: #f1f3f4;
}

.info-block:last-child {
    margin-bottom: 0;
}

.info-block-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-block-content {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

.info-block-amount {
    font-weight: 600;
    color: var(--op-ink);
    font-size: 16px;
}

.info-block-promo {
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.info-block-promo .info-block-title {
    color: #856404;
}

.info-block-promo .info-block-content {
    color: #856404;
}

/* Statuts de commande */
.order-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 5px;
}

.order-status-completed {
    background-color: #4CAF50;
    color: white;
}

.order-status-processing {
    background-color: #2196F3;
    color: white;
}

.order-status-on-hold {
    background-color: #FF9800;
    color: white;
}

.order-status-cancelled {
    background-color: #F44336;
    color: white;
}

.order-status-refunded {
    background-color: #9E9E9E;
    color: white;
}

.order-status-failed {
    background-color: #d32f2f;
    color: white;
}

/* Responsive design */
@media (max-width: 600px) {
    .view-order-container {
        padding: 10px;
    }
    
    .order-timing-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .view-product-item {
        flex-wrap: wrap;
    }
    
    .view-product-image {
        margin: 0 10px 0 0;
    }
    
    .view-info-modal,
    .view-comment-modal {
        padding: 10px;
    }
    
    .view-modal-content {
        width: 100%;
    }
    
    .view-order-meta {
        font-size: 12px;
    }
}

/* Ajustements pour pagination */
.order-prep-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination-links {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-link,
.pagination-prev,
.pagination-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.pagination-link.current {
    background-color: var(--op-ink);
    color: white;
}

.pagination-link:hover,
.pagination-prev:hover,
.pagination-next:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

/* Bouton de recherche */
.order-prep-search-button-container {
    text-align: right;
}

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

.order-prep-search-button svg {
    margin-right: 5px;
}

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

.order-prep-search-info {
    background-color: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-prep-clear-search {
    color: #f44336;
    text-decoration: none;
    font-size: 13px;
}

/* Bouton Voir */
.view-button {
    background-color: var(--op-ink);
    color: #fff !important;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: normal;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

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


/* 
 * Styles supplémentaires pour la recherche améliorée
 * À ajouter à order-prep-view.css
 */

/* Style pour l'affichage du montant total des recherches */
.search-total-amount {
    margin: 8px 0;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
}

.search-total-amount strong {
    color: #00a32a;
    font-size: 15px;
    font-weight: 600;
}

.search-total-amount em {
    font-style: italic;
    font-size: 12px;
    color: #666;
}

/* Améliorer l'espacement dans la zone d'info de recherche */
.order-prep-search-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.order-prep-search-info p:first-child {
    margin-right: 15px;
    margin-bottom: 0;
}

.order-prep-search-info p {
    margin: 5px 0;
}

.order-prep-clear-search {
    white-space: nowrap;
    margin-left: auto;
    color: #d63638;
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 3px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.order-prep-clear-search:hover {
    background-color: #f0f0f0;
    text-decoration: none;
}

/* Améliorer la visibilité des résultats de recherche */
.order-item.search-result {
    border-left: 3px solid var(--op-ink);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Animation pour mettre en évidence les résultats */
@keyframes highlight-search-result {
    0% { background-color: rgba(0, 0, 0, 0.2); }
    100% { background-color: rgba(0, 0, 0, 0.05); }
}

.order-item.search-highlight {
    animation: highlight-search-result 1.5s ease-out;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .order-prep-search-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-total-amount {
        margin: 8px 0;
        width: 100%;
    }
    
    .order-prep-clear-search {
        margin-top: 10px;
        margin-left: 0;
        align-self: flex-end;
    }
}

/*
 * Le bouton « i » de l'en-tete.
 *
 * Il mesure trente-deux pixels, ce qui est juste pour un doigt : la cible
 * recommandee est de quarante-quatre. Plutot que de grossir le rond, qui
 * deborderait de l'en-tete, on etend sa zone sensible autour de lui. Le dessin
 * ne bouge pas, la zone atteinte au doigt fait quarante-quatre pixels.
 */
#order-info-button {
    position: relative;
}

#order-info-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

/*
 * Detail du total de la commande.
 *
 * Un tableau et non une liste : les montants doivent s'aligner a droite pour se
 * comparer d'un coup d'oeil, et les libelles rester lisibles a gauche.
 */
.op-totals {
    width: 100%;
    border-collapse: collapse;
}

.op-totals-row th {
    padding: 4px 0;
    text-align: left;
    font-weight: 400;
    color: #6b7280;
    font-size: 13px;
}

.op-totals-row td {
    padding: 4px 0;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

/* La remise est le seul montant qui retranche : elle se distingue. */
.op-totals-row--discount th,
.op-totals-row--discount td {
    color: #1b7a43;
}

/* La derniere ligne porte le montant que le client a paye. */
.op-totals-row--total th,
.op-totals-row--total td {
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    color: var(--op-ink, #16181b);
    font-size: 15px;
    font-weight: 700;
}

.op-totals-row--total th {
    font-weight: 600;
}

/*
 * Ouvrir une fiche de service client depuis une commande.
 *
 * Le bouton ferme la fiche : il se pose donc en pied, apres les produits et les
 * notes, la ou l'on a fini de lire.
 */
.view-order-actions {
    padding: 16px 0 8px;
}

.view-order-create-sav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 10px;
    background-color: var(--op-ink, #16181b);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.view-order-create-sav:hover,
.view-order-create-sav:focus {
    background-color: var(--op-ink-hover, #000000);
    color: #ffffff;
}

.view-order-create-sav svg {
    flex: 0 0 auto;
}
