﻿/* ============================================
   ALVI - Orders  v2
   Clean order cards, receipt-style detail modal
   ============================================ */

.orders-page { animation: fadeIn .3s var(--ease); }
.orders-page > .page-header { margin-bottom: var(--space-6); }
.orders-page > .page-header h1 {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

/* ── Filters ── */
.orders-filters {
    display: flex; flex-wrap: wrap; gap: var(--space-3);
    align-items: center; margin-bottom: var(--space-6);
    background: var(--white); padding: var(--space-4);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-100);
}
.orders-filters .form-group { margin-bottom: 0; min-width: 200px; }

/* ── Order list grid ── */
.order-list {
    display: grid; gap: var(--space-4);
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* ── Order card ── */
.order-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); cursor: pointer;
    transition: all .25s var(--ease);
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
}
.order-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.order-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--gray-100);
}
.order-id {
    font-family: var(--font-display); font-weight: 800;
    color: var(--gray-900); font-size: var(--text-lg);
}
.order-date {
    font-size: var(--text-xs); color: var(--gray-400);
    font-weight: 500; display: block; margin-top: 2px;
}
.order-card-body {
    display: flex; align-items: flex-end; justify-content: space-between;
    padding: var(--space-4) var(--space-5); flex: 1;
}
.order-card-items { font-size: var(--text-sm); color: var(--gray-500); line-height: 1.5; }
.item-count {
    font-weight: 700; color: var(--gray-700);
    background: var(--gray-100); padding: 2px 7px;
    border-radius: var(--radius); font-size: 11px;
    margin-right: 4px;
}
.order-card-total {
    font-family: var(--font-display); font-weight: 800;
    color: var(--gray-900); font-size: var(--text-xl);
    white-space: nowrap;
}
.order-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

/* ── Status badges (order context) ── */
.order-card .badge, .order-detail-header .badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .03em; white-space: nowrap;
    border: 1px solid transparent;
}
.order-card .badge-info, .order-detail-header .badge-info { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.15); color: #3b82f6; }
.order-card .badge-primary, .order-detail-header .badge-primary { background: rgba(201,168,76,.08); border-color: rgba(201,168,76,.15); color: var(--gold-dark); }
.order-card .badge-warning, .order-detail-header .badge-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.15); color: #d97706; }
.order-card .badge-success, .order-detail-header .badge-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.15); color: #059669; }
.order-card .badge-danger, .order-detail-header .badge-danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.15); color: #dc2626; }
.order-card .badge-secondary, .order-detail-header .badge-secondary { background: rgba(107,114,128,.08); border-color: rgba(107,114,128,.15); color: #4b5563; }

.order-card .order-delivery-type, .order-detail-info .order-delivery-type {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .03em;
    background: var(--gray-100); color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

/* ── Order detail modal ── */
.order-detail { padding: var(--space-2) 0; }
.order-detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: var(--space-5); padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}
.order-detail-header h3 {
    font-family: var(--font-display); color: var(--gray-900);
    font-size: var(--text-2xl);
}

/* ── Info grid ── */
.order-detail-info {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3); margin-bottom: var(--space-6);
    background: var(--gray-50); padding: var(--space-4);
    border-radius: var(--radius-xl); border: 1px solid var(--gray-100);
}
.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--gray-400);
}
.info-value { font-size: var(--text-sm); font-weight: 700; color: var(--gray-900); }

/* ── Item rows ── */
.order-detail-items { margin-bottom: var(--space-6); }
.order-detail-items h4 {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--gray-400); margin-bottom: var(--space-3);
    display: flex; align-items: center; gap: var(--space-3);
}
.order-detail-items h4::after { content: ''; flex: 1; height: 1px; background: var(--gray-100); }

.order-item-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) 0; font-size: var(--text-sm);
    border-bottom: 1px solid var(--gray-50);
}
.order-item-row:last-child { border-bottom: none; }
.order-item-name { font-weight: 600; color: var(--gray-800); flex: 1; }
.order-item-qty {
    color: var(--gray-500); font-weight: 700; margin: 0 var(--space-3);
    background: var(--gray-50); border: 1px solid var(--gray-100);
    padding: 2px 8px; border-radius: var(--radius); font-size: 12px;
}
.order-item-price {
    font-family: var(--font-display); font-weight: 800;
    color: var(--gray-900); min-width: 64px; text-align: right;
}

/* ── Total bar ── */
.order-detail-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-5); margin-top: var(--space-4);
    background: var(--gray-900); color: var(--white);
    border-radius: var(--radius-xl); font-weight: 800;
}
.order-detail-total span:first-child {
    color: var(--gray-400); font-size: var(--text-sm);
    text-transform: uppercase; letter-spacing: .04em;
}
.order-detail-total span:last-child {
    font-family: var(--font-display);
    font-size: var(--text-2xl); color: var(--gold);
}

/* ── Status timeline ── */
.status-history {
    margin-top: var(--space-6); background: var(--gray-50);
    padding: var(--space-5); border-radius: var(--radius-xl);
}
.status-history h4 {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--gray-400); margin-bottom: var(--space-4);
}
.status-timeline { position: relative; padding-left: var(--space-7); }
.status-timeline::before {
    content: ''; position: absolute; left: 14px; top: 6px; bottom: 6px;
    width: 2px; background: var(--gray-200);
}
.timeline-item {
    position: relative; padding-bottom: var(--space-5);
    animation: fadeIn .3s var(--ease) both;
}
.timeline-item:nth-child(1) { animation-delay: .05s; }
.timeline-item:nth-child(2) { animation-delay: .1s; }
.timeline-item:nth-child(3) { animation-delay: .15s; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute; left: calc(-1 * var(--space-7) + 7px); top: 4px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--white); border: 3px solid var(--gray-300);
    z-index: 1;
}
.timeline-item.active .timeline-dot {
    border-color: var(--gold); background: var(--white);
    box-shadow: 0 0 0 4px rgba(201,168,76,.12);
}
.timeline-item.completed .timeline-dot {
    border-color: var(--success); background: var(--success);
}
.timeline-content {
    background: var(--white); padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg); border: 1px solid var(--gray-100);
}
.timeline-status { font-weight: 700; font-size: var(--text-sm); color: var(--gray-900); }
.timeline-date {
    font-size: 11px; font-weight: 500; color: var(--gray-400);
    margin-left: var(--space-2); display: inline;
}
.timeline-note {
    font-size: var(--text-xs); color: var(--gray-500);
    margin-top: var(--space-2); padding-top: var(--space-2);
    border-top: 1px solid var(--gray-100);
}

/* ── Filter tabs ── */
.order-filters {
    display: flex; gap: var(--space-2); flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .order-list { grid-template-columns: 1fr; }
    .orders-filters { flex-direction: column; align-items: stretch; }
    .orders-filters .form-group { min-width: 100%; }
}
@media (max-width: 640px) {
    .order-detail-info { grid-template-columns: 1fr 1fr; }
    .order-detail-total {
        padding: var(--space-4);
        flex-direction: column; align-items: flex-start; gap: var(--space-2);
    }
    .order-detail-header { flex-direction: column; gap: var(--space-3); }
}
