/* orders page */

.orders-page {
    min-height: 100vh;
    background: #fafafa;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.orders-main {
    padding: 2.5rem 1rem 4rem;
}

.orders-container {
    max-width: 780px;
    margin: 0 auto;
}

/* loading / error */
.orders-loading,
.orders-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 1rem;
    color: #525252;
    font-size: 0.9375rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e5e5;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* page header */
.orders-root {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.orders-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.orders-title {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.5rem;
    color: #171717;
    font-weight: 700;
}

.btn-orders-new {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #0a0a0a;
    color: #fff;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.btn-orders-new:hover { background: #262626; }

.btn-orders-signin {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: #0a0a0a;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

/* empty state */
.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 5rem 1rem;
    color: #525252;
    text-align: center;
}

.orders-empty svg { opacity: 0.3; }

/* order card */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

.order-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

/* card header */
.order-card-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    gap: 1rem;
}

.order-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.order-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.order-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a3a3a3;
}

.order-id {
    font-weight: 700;
    font-size: 1rem;
    color: #171717;
}

.order-ee-num {
    font-size: 0.8rem;
    color: #a3a3a3;
}

.order-meta-sub {
    font-size: 0.85rem;
    color: #525252;
}

.order-grand-total {
    font-weight: 600;
    color: #171717;
}

.meta-dot { opacity: 0.3; }

/* status badge */
.order-status-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--badge-color) 12%, transparent);
    color: var(--badge-color);
    white-space: nowrap;
}

/* chevron */
.order-chevron {
    transition: transform 0.2s ease;
    color: #a3a3a3;
    flex-shrink: 0;
}

.order-chevron.open { transform: rotate(180deg); }

/* expanded body */
.order-card-body {
    border-top: 1px solid #e5e5e5;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.order-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.order-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a3a3a3;
}

/* items list */
.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-item-row {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e5e5;
}

.order-item-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* item thumbnail */
.order-item-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    overflow: hidden;
    flex-shrink: 0;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.order-item-thumb--placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a3a3a3;
    opacity: 0.5;
}

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

.order-item-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #171717;
    margin: 0 0 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-item-opts {
    font-size: 0.8rem;
    color: #a3a3a3;
    margin: 0;
}

.order-item-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    white-space: nowrap;
}

.order-item-qty {
    font-size: 0.78rem;
    color: #a3a3a3;
}

.order-item-total {
    font-weight: 600;
    font-size: 0.9rem;
    color: #171717;
}

/* detail grid */
.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* payment block */
.order-payment-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    color: #525252;
}

.payment-card-type {
    font-weight: 600;
    font-size: 0.9rem;
    color: #171717;
    margin: 0;
}

.payment-conf {
    font-size: 0.78rem;
    color: #a3a3a3;
    margin: 0.2rem 0 0;
}

/* address */
.order-address {
    font-style: normal;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.order-address p {
    font-size: 0.875rem;
    color: #171717;
    margin: 0;
    line-height: 1.6;
}

.order-detail-empty {
    font-size: 0.85rem;
    color: #a3a3a3;
}

/* totals */
.order-totals {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #525252;
}

.order-total-row span:last-child {
    font-weight: 500;
    color: #171717;
}

.order-total-row.discount { color: #16a34a; }

.order-total-row.grand {
    font-weight: 700;
    font-size: 0.95rem;
    color: #171717;
    padding-top: 0.4rem;
    margin-top: 0.2rem;
    border-top: 1px solid #e5e5e5;
}

/* responsive */
@media (max-width: 580px) {
    .order-detail-grid { grid-template-columns: 1fr; }
    .order-card-header { padding: 0.9rem 1rem; }
    .order-card-body { padding: 1rem; }
    .orders-title { font-size: 1.25rem; }
    .order-item-thumb { width: 60px; height: 60px; }
}

@media (max-width: 480px) {
    .orders-main {
        padding: 1.5rem 0.875rem 3rem;
    }

    .order-card-header {
        padding: 0.8rem 0.875rem;
    }

    .order-card-body {
        padding: 0.875rem;
        gap: 1rem;
    }

    .order-item-thumb {
        width: 52px;
        height: 52px;
    }

    .order-item-row {
        gap: 0.65rem;
    }

    .order-meta-row {
        gap: 0.35rem;
    }

    .btn-orders-new {
        padding: 0.45rem 0.875rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 380px) {
    .orders-main {
        padding: 1.25rem 0.75rem 2.5rem;
    }

    .order-card-header {
        padding: 0.75rem;
    }

    .order-card-body {
        padding: 0.75rem;
    }

    .order-item-thumb {
        width: 48px;
        height: 48px;
    }

    .order-status-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
    }

    .order-id {
        font-size: 0.9rem;
    }

    .order-meta-sub {
        font-size: 0.78rem;
    }
}
