﻿/* ================================================================
   SMG — ORDER HISTORY & TRACKING STYLES (Fase 18)
   Order list, detail, tracking, review, cancel
   ================================================================ */

/* ── Page Layout ── */
.orders-page {
    padding-top: 80px;
    min-height: 100vh;
    background: var(--bg-primary);
}

.orders-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

.orders-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.orders-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color .2s;
}
.orders-breadcrumb a:hover { color: var(--gold-primary); }
.orders-breadcrumb .sep { opacity: .4; }

.orders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.orders-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Filter Tabs ── */
.orders-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.orders-tabs::-webkit-scrollbar { display: none; }

.orders-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
}
.orders-tab:hover {
    color: var(--gold-primary);
}
.orders-tab.active {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}
.orders-tab .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}
.orders-tab.active .tab-badge {
    background: var(--gold-primary);
    color: var(--bg-primary);
}

/* ── Toolbar ── */
.orders-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.orders-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.orders-search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.orders-search-input:focus { border-color: var(--gold-primary); }
.orders-search-input::placeholder { color: var(--text-muted); }
.orders-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.orders-sort {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    min-width: 160px;
}
.orders-sort:focus { border-color: var(--gold-primary); }

/* ── Order Card ── */
.order-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color .2s, box-shadow .2s;
}
.order-card:hover {
    border-color: var(--gold-primary-30);
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.order-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 8px;
}
.order-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.order-card-id {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.order-card-copy {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    width: 18px;
    height: 18px;
    transition: color .2s;
}
.order-card-copy:hover { color: var(--gold-primary); }

.order-card-date {
    font-size: 13px;
    color: var(--text-muted);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}
.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-badge.pending-payment { background: rgba(245,166,35,.12); color: #f5a623; }
.status-badge.pending-payment::before { background: #f5a623; }
.status-badge.payment-verified,
.status-badge.processing { background: rgba(52,152,219,.12); color: #3498db; }
.status-badge.payment-verified::before,
.status-badge.processing::before { background: #3498db; }
.status-badge.shipped { background: rgba(39,174,96,.12); color: #27ae60; }
.status-badge.shipped::before { background: #27ae60; }
.status-badge.delivered { background: rgba(39,174,96,.12); color: #27ae60; }
.status-badge.delivered::before { background: #27ae60; animation: pulse-dot 1.5s infinite; }
.status-badge.completed { background: var(--bg-tertiary); color: var(--text-muted); }
.status-badge.completed::before { background: var(--text-muted); }
.status-badge.cancelled { background: rgba(231,76,60,.12); color: #e74c3c; }
.status-badge.cancelled::before { background: #e74c3c; }
.status-badge.refunded { background: rgba(155,89,182,.12); color: #9b59b6; }
.status-badge.refunded::before { background: #9b59b6; }
.status-badge.problem-reported { background: rgba(231,76,60,.12); color: #e74c3c; }
.status-badge.problem-reported::before { background: #e74c3c; }

@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

.order-card-body {
    padding: 16px 20px;
}

/* Order items mini list */
.order-items-mini {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.order-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.order-item-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gold-primary);
}
.order-item-thumb svg { width: 36px; height: 36px; }

.order-item-info {
    flex: 1;
    min-width: 0;
}
.order-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.order-item-qty {
    font-size: 13px;
    color: var(--text-muted);
}
.order-item-subtotal {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.order-items-more {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 72px;
    font-style: italic;
}

.order-card-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 14px 0;
}

.order-card-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.order-total-label {
    font-size: 13px;
    color: var(--text-muted);
}
.order-total-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-primary);
}

.order-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 8px;
}
.order-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.order-detail-link {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    transition: color .2s;
}
.order-detail-link:hover { color: var(--gold-primary); }

/* ── Empty State ── */
.orders-empty {
    text-align: center;
    padding: 80px 24px;
}
.orders-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: .4;
}
.orders-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.orders-empty-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── Pagination ── */
.orders-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}
.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}
.page-btn:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
.page-btn.active { background: var(--gold-primary); color: var(--bg-primary); border-color: var(--gold-primary); }
.page-btn:disabled { opacity: .4; pointer-events: none; }


/* ══════════════════════════════════════════════════
   ORDER DETAIL VIEW
   ══════════════════════════════════════════════════ */

.order-detail-view {
    max-width: 800px;
    margin: 0 auto;
}

/* Back link */
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 20px;
    cursor: pointer;
    background: none;
    border: none;
    transition: color .2s;
}
.detail-back:hover { color: var(--gold-primary); }
.detail-back svg { width: 18px; height: 18px; }

/* Detail header */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}
.detail-order-id {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.detail-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Detail countdown */
.detail-countdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(245,166,35,.08);
    border: 1px solid rgba(245,166,35,.2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}
.detail-countdown-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.detail-countdown-timer {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: #f5a623;
}

/* Progress Tracker (horizontal) */
.progress-tracker {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}
.tracker-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
    z-index: 1;
}
.tracker-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-subtle);
    z-index: -1;
}
.tracker-step.done:not(:last-child)::after { background: var(--gold-primary); }
.tracker-step.current:not(:last-child)::after {
    background: linear-gradient(90deg, var(--gold-primary) 50%, var(--border-subtle) 50%);
}

.tracker-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    transition: all .3s;
}
.tracker-step.done .tracker-circle {
    background: var(--gold-primary);
    color: var(--bg-primary);
}
.tracker-step.current .tracker-circle {
    border: 2px solid var(--gold-primary);
    color: var(--gold-primary);
    background: rgba(212,175,55,.1);
    animation: pulse-glow 2s infinite;
}
.tracker-step.upcoming .tracker-circle {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

@keyframes pulse-glow {
    0%,100% { box-shadow: 0 0 0 0 rgba(212,175,55,.3); }
    50% { box-shadow: 0 0 0 6px rgba(212,175,55,0); }
}

.tracker-label {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
    max-width: 80px;
}
.tracker-step.done .tracker-label,
.tracker-step.current .tracker-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Detail sections */
.detail-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.detail-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-section-body {
    padding: 20px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 28px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-subtle);
}
.timeline-event {
    position: relative;
    margin-bottom: 20px;
}
.timeline-event:last-child { margin-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}
.timeline-event:first-child .timeline-dot {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}
.timeline-event:first-child .timeline-dot svg { color: var(--bg-primary); }
.timeline-dot svg { width: 10px; height: 10px; color: var(--text-muted); }

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.timeline-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Detail product rows */
.detail-product-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.detail-product-row:last-child { border-bottom: none; }
.detail-product-thumb {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gold-primary);
}
.detail-product-thumb svg { width: 42px; height: 42px; }
.detail-product-info { flex: 1; min-width: 0; }
.detail-product-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.detail-product-name a {
    color: inherit;
    text-decoration: none;
}
.detail-product-name a:hover { color: var(--gold-primary); }
.detail-product-specs {
    font-size: 12px;
    color: var(--text-muted);
}
.detail-product-qty {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.detail-product-subtotal {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Shipping card info */
.shipping-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.shipping-info-block label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.shipping-info-block .value {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}
.resi-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.resi-number {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--gold-primary);
    font-size: 14px;
}
.resi-copy {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    width: 16px; height: 16px;
}
.resi-copy:hover { color: var(--gold-primary); }

/* Payment pricing breakdown */
.pricing-breakdown {
    margin-top: 12px;
}
.pricing-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
}
.pricing-row.discount { color: var(--success); }
.pricing-row.total {
    border-top: 2px solid var(--border-subtle);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-primary);
}

/* Detail actions bar */
.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    margin-bottom: 24px;
}


/* ══════════════════════════════════════════════════
   TRACKING MODAL
   ══════════════════════════════════════════════════ */
.tracking-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.tracking-modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.tracking-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .3s;
}
.tracking-modal-overlay.show .tracking-modal { transform: translateY(0); }

.tracking-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.tracking-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.tracking-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tracking-modal-close:hover { color: var(--text-primary); }
.tracking-modal-close svg { width: 20px; height: 20px; }

.tracking-info {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.tracking-courier {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.tracking-resi {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tracking-resi-number {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-primary);
}

.tracking-timeline {
    padding: 24px;
}
.tracking-event {
    position: relative;
    padding-left: 32px;
    padding-bottom: 24px;
}
.tracking-event:last-child { padding-bottom: 0; }
.tracking-event::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: var(--border-subtle);
}
.tracking-event:last-child::before { display: none; }

.tracking-event-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-subtle);
}
.tracking-event:first-child .tracking-event-dot {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}
.tracking-event-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.tracking-event-location {
    font-size: 12px;
    color: var(--text-muted);
}
.tracking-event-time {
    font-size: 12px;
    color: var(--text-muted);
}

.tracking-actions {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}


/* ══════════════════════════════════════════════════
   REVIEW MODAL
   ══════════════════════════════════════════════════ */
.review-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.review-modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.review-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .3s;
}
.review-modal-overlay.show .review-modal { transform: translateY(0); }

.review-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.review-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.review-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.review-product-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-primary);
}
.review-product-thumb svg { width: 32px; height: 32px; }
.review-product-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.review-form {
    padding: 20px 24px;
}
.review-form-group {
    margin-bottom: 20px;
}
.review-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Star rating input */
.star-rating-input {
    display: flex;
    gap: 4px;
}
.star-rating-input .star-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--text-muted);
    transition: color .15s, transform .15s;
}
.star-rating-input .star-btn.active { color: #F5A623; }
.star-rating-input .star-btn:hover { transform: scale(1.15); }
.star-rating-input .star-btn svg { width: 32px; height: 32px; }
.rating-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.review-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.review-textarea:focus { border-color: var(--gold-primary); }
.review-char-count {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.review-anonymous {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.review-anonymous input { accent-color: var(--gold-primary); }

.review-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}


/* ══════════════════════════════════════════════════
   CANCEL MODAL
   ══════════════════════════════════════════════════ */
.cancel-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.cancel-modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}
.cancel-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .3s;
}
.cancel-modal-overlay.show .cancel-modal { transform: translateY(0); }

.cancel-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.cancel-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.cancel-modal-body {
    padding: 20px 24px;
}
.cancel-warning {
    padding: 12px 16px;
    background: rgba(231,76,60,.08);
    border: 1px solid rgba(231,76,60,.2);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: #e74c3c;
    margin-bottom: 16px;
}
.cancel-select,
.cancel-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 12px;
}
.cancel-select:focus,
.cancel-textarea:focus { border-color: var(--gold-primary); }
.cancel-textarea { min-height: 80px; resize: vertical; }

.cancel-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}


/* ══════════════════════════════════════════════════
   PROBLEM REPORT MODAL
   ══════════════════════════════════════════════════ */
.problem-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.problem-modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}
.problem-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .3s;
}
.problem-modal-overlay.show .problem-modal { transform: translateY(0); }

.problem-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.problem-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.problem-modal-body {
    padding: 20px 24px;
}
.problem-form-group {
    margin-bottom: 16px;
}
.problem-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.problem-select,
.problem-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.problem-textarea { min-height: 80px; resize: vertical; }
.problem-select:focus,
.problem-textarea:focus { border-color: var(--gold-primary); }

.problem-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.problem-radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.problem-radio-option input { accent-color: var(--gold-primary); }

.problem-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}


/* ══════════════════════════════════════════════════
   RECEIVE CONFIRMATION MODAL
   ══════════════════════════════════════════════════ */
.receive-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.receive-modal-overlay.show { opacity: 1; pointer-events: all; }
.receive-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform .3s;
}
.receive-modal-overlay.show .receive-modal { transform: translateY(0); }

.receive-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.receive-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.receive-modal-body {
    padding: 20px 24px;
}
.receive-question {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.receive-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.receive-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.receive-check-item input { accent-color: var(--gold-primary); }

.receive-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}


/* ══════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .orders-container {
        padding: 20px 16px 100px;
    }
    .orders-title { font-size: 22px; }

    .orders-toolbar {
        flex-direction: column;
    }
    .orders-sort { width: 100%; }

    .order-card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
    }
    .order-card-body { padding: 12px 14px; }
    .order-card-footer {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
    }
    .order-card-actions { width: 100%; }
    .order-card-actions .btn { flex: 1; text-align: center; }

    .order-total-value { font-size: 16px; }

    /* Order tabs — wrap on mobile, no scroll */
    .orders-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 6px;
    }
    .orders-tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Detail */
    .detail-order-id { font-size: 18px; }

    .progress-tracker {
        flex-direction: column;
        gap: 0;
    }
    .tracker-step {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 20px;
    }
    .tracker-step:not(:last-child)::after {
        left: 15px;
        top: 32px;
        width: 2px;
        height: calc(100% - 32px);
    }
    .tracker-label {
        max-width: none;
        text-align: left;
    }

    .shipping-info-grid {
        grid-template-columns: 1fr;
    }

    /* Modals — ensure proper centering & containment on mobile */
    .tracking-modal-overlay,
    .review-modal-overlay,
    .cancel-modal-overlay,
    .problem-modal-overlay,
    .receive-modal-overlay {
        padding: 12px;
        align-items: flex-start;
        justify-content: center;
        overflow-y: auto;
    }
    .tracking-modal,
    .review-modal,
    .cancel-modal,
    .problem-modal,
    .receive-modal {
        width: 95%;
        max-height: none;
        overflow-y: visible;
        margin: auto 0;
        flex-shrink: 0;
    }

    .star-rating-input .star-btn svg { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
    .orders-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 4px;
        border-bottom: none;
        margin-bottom: 16px;
    }
    .orders-tab {
        padding: 8px 10px;
        font-size: 12px;
        border-bottom: none;
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        background: var(--bg-tertiary);
    }
    .orders-tab.active {
        border-color: var(--gold-primary);
        background: rgba(212,175,55,0.1);
    }
    .orders-tab .tab-badge {
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        font-size: 10px;
    }

    .order-item-thumb { width: 48px; height: 48px; }
    .order-item-thumb svg { width: 28px; height: 28px; }

    .detail-product-thumb { width: 56px; height: 56px; }

    .detail-actions { flex-direction: column; }
    .detail-actions .btn { width: 100%; text-align: center; }
}
