/* =======================================================================
   ZOL — Admin orders + Driver app
   ======================================================================= */

/* Admin orders inbox tabs */
.orders-tabs {
    display: flex;
    gap: 6px;
    background: var(--paper-2);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    overflow-x: auto;
}
.orders-tab {
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: rgba(14, 31, 20, 0.7);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.orders-tab.is-active {
    background: #ffffff;
    color: var(--forest);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.orders-tab .badge {
    background: var(--accent);
    color: #fff;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
}
.orders-tab.is-active .badge {
    background: var(--shop-primary);
}

.admin-orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-order-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--paper-3);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 120ms ease;
}
.admin-order-row:hover { border-color: var(--shop-primary); }
.admin-order-row.is-flagged { border-left: 4px solid var(--error); }
.admin-order-row.status-new {
    background: rgba(74, 124, 89, 0.04);
    border-color: rgba(74, 124, 89, 0.3);
}
.admin-order-meta {
    font-size: 13px;
    color: rgba(14, 31, 20, 0.6);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    align-items: center;
}
.admin-order-meta .num {
    font-family: monospace;
    color: var(--forest);
    font-weight: 500;
}
.admin-order-customer {
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 2px;
}
.admin-order-summary {
    font-size: 13px;
    color: rgba(14, 31, 20, 0.65);
}
.admin-order-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}
.admin-order-total {
    font-family: var(--font-display);
    color: var(--forest);
    font-weight: 500;
    font-size: 17px;
}

/* Order detail */
.admin-order-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.aod-section {
    background: #fff;
    border: 1px solid var(--paper-3);
    border-radius: var(--radius-md);
    padding: 16px;
}
.aod-section h4 {
    font-size: 13px;
    color: rgba(14, 31, 20, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin: 0 0 10px;
}
.aod-status {
    background: var(--shop-primary);
    color: var(--shop-on-primary);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.aod-status .num {
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
}
.aod-status .pill {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}
.aod-flag-banner {
    background: rgba(181, 74, 61, 0.1);
    color: var(--error);
    border: 1px solid rgba(181, 74, 61, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
}
.aod-customer {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.aod-customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paper-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.aod-customer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.aod-customer-avatar .placeholder {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--forest);
    font-weight: 600;
}
.aod-customer-info { flex: 1; min-width: 0; }
.aod-customer-name { font-weight: 500; }
.aod-customer-meta { font-size: 13px; color: rgba(14,31,20,0.6); }

.aod-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aod-action-bar .btn {
    flex: 1;
    min-width: 130px;
}

.aod-history-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--paper-3);
}
.aod-history-row:last-child { border-bottom: none; }
.aod-history-row .when { color: rgba(14,31,20,0.55); white-space: nowrap; padding-left: 10px; }

/* Driver app ------------------------------------------------------- */
.driver-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--paper);
}
.driver-header {
    background: var(--shop-primary);
    color: var(--shop-on-primary);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}
.driver-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    margin: 0;
    color: currentColor;
    font-weight: 500;
}
.driver-header .btn-ghost {
    background: rgba(255,255,255,0.1);
    color: var(--shop-on-primary);
    border-color: rgba(255,255,255,0.2);
}
.driver-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--paper-3);
}
.driver-tab {
    flex: 1;
    background: var(--paper);
    color: rgba(14,31,20,0.7);
    border: 1px solid var(--paper-3);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
}
.driver-tab.is-active {
    background: var(--shop-primary);
    color: var(--shop-on-primary);
    border-color: var(--shop-primary);
}

.driver-orders {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.driver-order-card {
    background: #fff;
    border: 1px solid var(--paper-3);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 120ms ease;
}
.driver-order-card.out_for_delivery { border-left: 4px solid var(--accent); }
.driver-order-card.ready_for_delivery { border-left: 4px solid var(--success); }
.driver-order-card:hover { border-color: var(--shop-primary); }
.driver-order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.driver-order-head .num {
    font-family: monospace;
    font-weight: 600;
    color: var(--forest);
}
.driver-order-card .order-status-pill {
    font-size: 11px;
}
.driver-order-name {
    font-weight: 500;
    margin-bottom: 4px;
}
.driver-order-addr {
    font-size: 13px;
    color: rgba(14,31,20,0.65);
    line-height: 1.4;
    margin-bottom: 8px;
}
.driver-order-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.driver-order-foot .total {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--forest);
    font-size: 17px;
}

.driver-detail-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--paper);
    padding-bottom: 100px;
}
.driver-detail-section {
    background: #fff;
    border: 1px solid var(--paper-3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 14px 16px;
}
.driver-detail-section h4 {
    font-size: 13px;
    color: rgba(14, 31, 20, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin: 0 0 10px;
}
.driver-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid var(--paper-3);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.driver-action-bar .btn { width: 100%; }
.driver-actions-secondary {
    display: flex;
    gap: 8px;
}
.driver-actions-secondary .btn { flex: 1; }

/* Driver inline action: tappable tel/maps link */
.driver-tap-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.driver-tap-link {
    flex: 1;
    background: var(--paper);
    border: 1px solid var(--paper-3);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--forest);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.driver-tap-link:hover { background: #fff; text-decoration: none; }
.driver-tap-link svg { flex-shrink: 0; }

/* Drivers admin view (re-uses staff styles) */
.drivers-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 600px) {
    .aod-action-bar .btn { min-width: 100%; }
}
