/*
 * Customer order history, rendered into the account dashboard's Orders tab.
 * Reuses dehai-common's tokens rather than defining its own.
 */

.order-history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.order-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.order-card__ident {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.order-card__number {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    color: var(--ink);
}

.order-card__status {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.order-card__status--new {
    background: rgba(255, 31, 75, 0.1);
    color: var(--accent-dark);
}

.order-card__status--processing {
    background: #FEF3C7;
    color: #B45309;
}

.order-card__status--shipped {
    background: #DBEAFE;
    color: #1D4ED8;
}

.order-card__status--completed {
    background: #D1FAE5;
    color: #047857;
}

.order-card__status--cancelled {
    background: var(--line);
    color: var(--muted);
}

.order-card__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.order-card__total {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    color: var(--ink);
    white-space: nowrap;
}

.order-card__items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}

.order-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.order-line__media {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--paper);
    font-size: 20px;
    color: var(--muted);
    transition: opacity 0.2s;
}

a.order-line__media:hover {
    opacity: 0.8;
}

.order-line__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.order-line__info {
    flex: 1;
    min-width: 0;
}

.order-line__title {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

a.order-line__title:hover {
    color: var(--accent);
}

/* A product that is no longer in the catalogue — the order still names it. */
.order-line__title--gone {
    color: var(--muted);
}

.order-line__meta {
    margin: 0.125rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.order-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
}

.order-card__delivery {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.order-card__delivery svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.order-card__repeat {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    transition: color 0.2s;
}

.order-card__repeat:hover {
    color: var(--accent-dark);
}

.order-card__repeat.is-done {
    color: #047857;
}

.order-history-empty {
    padding: 4rem 1.5rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
}

.order-history-empty__icon {
    margin: 0 0 0.75rem;
    font-size: 1.875rem;
}

.order-history-empty__text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.order-history-empty__cta {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: background 0.2s;
}

.order-history-empty__cta:hover {
    background: var(--accent-dark);
}

@media (max-width: 480px) {
    .order-card__head,
    .order-card__foot {
        align-items: flex-start;
        flex-direction: column;
    }
}
