/* ============================================================
   ORDER HISTORY — REFONTE CORPORATE PREMIUM
   Design System : Solid Colors · Flat Design · Subtle Shadows
   Toutes les classes HTML sont INTACTES.
   ============================================================ */

/* ── 1. TOKENS & VARIABLES ─────────────────────────────────── */
:root {
    /* Brand */
    --primary:        #4361ee;
    --primary-dark:   #2d3a8c;
    --primary-light:  #eef0fd;
    --secondary:      #f72585;

    /* Neutrals */
    --white:          #ffffff;
    --bg:             #f4f5f8;
    --surface:        #ffffff;
    --border:         #e4e7ef;
    --border-strong:  #c9cfe0;

    --text-primary:   #111827;
    --text-secondary: #4b5563;
    --text-muted:     #9ca3af;

    /* Status — fond plein, pas de transparence */
    --status-pending-bg:    #fff7ed;
    --status-pending-fg:    #c2410c;
    --status-pending-bar:   #f97316;

    --status-processing-bg: #eff6ff;
    --status-processing-fg: #1d4ed8;
    --status-processing-bar:#4361ee;

    --status-shipped-bg:    #f0fdf4;
    --status-shipped-fg:    #15803d;
    --status-shipped-bar:   #22c55e;

    --status-delivered-bg:  #f0fdf4;
    --status-delivered-fg:  #14532d;
    --status-delivered-bar: #16a34a;

    --status-canceled-bg:   #fff1f2;
    --status-canceled-fg:   #be123c;
    --status-canceled-bar:  #f43f5e;

    /* Shadows — très subtiles, "corporate" */
    --shadow-xs:  0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-sm:  0 1px 4px rgba(17, 24, 39, 0.06), 0 2px 8px rgba(17, 24, 39, 0.04);
    --shadow-md:  0 4px 12px rgba(17, 24, 39, 0.08), 0 1px 3px rgba(17, 24, 39, 0.05);
    --shadow-hover: 0 8px 24px rgba(67, 97, 238, 0.10), 0 2px 6px rgba(17, 24, 39, 0.06);

    /* Misc */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 14px; /* alias pour compatibilité */
}

/* ── 2. RESET CIBLÉ ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ── 3. LAYOUT WRAPPER ──────────────────────────────────────── */
.order-history-center {
    width: 100%;
    max-width: 940px;
    margin: 2.5rem auto 3.5rem;
    padding: 0 1.25rem;
}

/* ── 4. PAGE HEADER ─────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.25rem;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

/* Trait d'accentuation sous le titre */
.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 56px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    margin-left: 0;
    margin-top: 0;
    line-height: 1.25;
}

/* Lien retour (home-link) */
.home-link {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    background-color: var(--primary-light);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #d0d8fb;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.home-link:hover {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.home-link .material-icons {
    font-size: 1rem;
}

/* ── 5. FILTRES ─────────────────────────────────────────────── */
.filter-controls {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.5rem 2.25rem 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background-color: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    font-size: 0.85rem;
    font-family: 'Roboto', sans-serif;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

.filter-select:hover {
    border-color: var(--primary);
}

/* ── 6. LISTE DES COMMANDES ─────────────────────────────────── */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── 7. CARTE COMMANDE ──────────────────────────────────────── */
.order-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 0 1.75rem 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Barre d'accent gauche — signature visuelle "corporate" */
.order-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-strong);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transition: background var(--transition);
}

.order-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: #c7d0f8;
}

.order-card:hover::before {
    background: var(--primary);
}

/* Barre colorée selon le statut */
.order-card:has(.status-pending)::before    { background: var(--status-pending-bar);    }
.order-card:has(.status-processing)::before { background: var(--status-processing-bar); }
.order-card:has(.status-shipped)::before    { background: var(--status-shipped-bar);    }
.order-card:has(.status-delivered)::before  { background: var(--status-delivered-bar);  }
.order-card:has(.status-canceled)::before   { background: var(--status-canceled-bar);   }

/* ── 7a. EN-TÊTE DE CARTE ───────────────────────────────────── */
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0 1rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.order-id {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.order-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.2rem;
}

/* ── 7b. BADGES STATUT ──────────────────────────────────────── */
.order-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border: 1px solid transparent;
}

/* Dot indicateur devant le texte */
.order-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-fg);
    border-color: #fed7aa;
}
.status-pending::before { background: var(--status-pending-bar); }

.status-processing {
    background-color: var(--status-processing-bg);
    color: var(--status-processing-fg);
    border-color: #bfdbfe;
}
.status-processing::before { background: var(--status-processing-bar); }

.status-shipped {
    background-color: var(--status-shipped-bg);
    color: var(--status-shipped-fg);
    border-color: #bbf7d0;
}
.status-shipped::before { background: var(--status-shipped-bar); }

.status-delivered {
    background-color: var(--status-delivered-bg);
    color: var(--status-delivered-fg);
    border-color: #86efac;
}
.status-delivered::before { background: var(--status-delivered-bar); }

.status-canceled {
    background-color: var(--status-canceled-bg);
    color: var(--status-canceled-fg);
    border-color: #fda4af;
}
.status-canceled::before { background: var(--status-canceled-bar); }

/* ── 7c. RÉSUMÉ COMMANDE ────────────────────────────────────── */
.order-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.35rem 0;
}

/* Séparateur vertical entre les colonnes */
.summary-item + .summary-item {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    margin-left: 1.5rem;
}

.summary-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600;
}

.summary-value {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ── 7d. PRODUITS & TOTAL ───────────────────────────────────── */
.order-products {
    display: flex;
    align-items: center;
    padding: 1rem 0 0;
    gap: 0.75rem;
}

.product-thumbnails {
    display: flex;
    align-items: center;
}

.product-thumb {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 2px solid var(--white);
    margin-left: -10px;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), z-index var(--transition);
}

.product-thumb:first-child { margin-left: 0; }

.product-thumb:hover {
    transform: scale(1.12) translateY(-2px);
    z-index: 2;
}

.product-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    background: var(--bg);
    border-radius: 50px;
    border: 1px solid var(--border);
}

.order-total {
    margin-left: auto;
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.1rem;
    letter-spacing: -0.3px;
}

/* ── 7e. ACTIONS ────────────────────────────────────────────── */
.order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}

/* ── 8. BOUTONS ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 1.05rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition),
                transform var(--transition);
    white-space: nowrap;
    letter-spacing: 0.1px;
    line-height: 1;
}

.btn:active { transform: translateY(1px); }

.btn .material-icons {
    font-size: 0.95rem;
    line-height: 1;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(67, 97, 238, 0.30);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(67, 97, 238, 0.35);
}

.btn-outline {
    background-color: var(--white);
    border-color: var(--border-strong);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
}

.btn-outline:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ── 9. ÉTAT VIDE ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 3.5rem;
    color: var(--border-strong);
    display: block;
    margin-bottom: 1.25rem;
}

.empty-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.empty-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.65;
}

/* ── 10. PAGINATION ─────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2.5rem;
    gap: 0.35rem;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition);
    text-decoration: none;
}

.pagination-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: #c7d0f8;
}

.pagination-item.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.30);
    cursor: default;
}

/* ── 11. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .order-history-center {
        margin: 1.5rem auto 2.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1.5rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .filter-controls {
        width: 100%;
    }

    .filter-select {
        flex: 1;
        min-width: 0;
    }

    .order-card-header {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .order-summary {
        grid-template-columns: 1fr;
    }

    .summary-item + .summary-item {
        padding-left: 0;
        border-left: none;
        margin-left: 0;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }

    .order-actions {
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        justify-content: center;
    }

    .home-link {
        position: static;
    }
}

@media (max-width: 576px) {
    .order-card {
        padding: 0 1.1rem 1.1rem;
    }

    .order-products {
        flex-wrap: wrap;
    }

    .order-total {
        margin-left: 0;
        font-size: 1rem;
    }

    .order-card-header {
        padding: 1rem 0 0.85rem;
    }

    .page-title {
        font-size: 1.25rem;
    }
}

/* ── 12. ANIMATION D'ENTRÉE DES CARTES ──────────────────────── */
@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.order-card {
    animation: card-in 380ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Délai en cascade — CSS pur, sans JS */
.order-card:nth-child(1)  { animation-delay:  0ms; }
.order-card:nth-child(2)  { animation-delay: 55ms; }
.order-card:nth-child(3)  { animation-delay: 110ms; }
.order-card:nth-child(4)  { animation-delay: 165ms; }
.order-card:nth-child(5)  { animation-delay: 220ms; }
.order-card:nth-child(6)  { animation-delay: 275ms; }
.order-card:nth-child(7)  { animation-delay: 330ms; }
.order-card:nth-child(8)  { animation-delay: 385ms; }
.order-card:nth-child(9)  { animation-delay: 440ms; }
.order-card:nth-child(10) { animation-delay: 495ms; }

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .order-card {
        animation: none;
    }
    .product-thumb:hover {
        transform: none;
    }
}