/* =====================
   客满科技 Supplier Portal Theme
   Brand Colors:
   - Orange: #FF6B35 (accent)
   - Deep Gray: #2D2D2D (text/header)
   - Light Gray: #F5F6F8 (background)
   - White: #FFFFFF (card)
===================== */

/* Global Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F5F6F8;
    color: #2D2D2D;
    font-size: 14px;
    line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* =====================
   HEADER / NAVBAR
===================== */
.header {
    background: #2D2D2D;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-brand {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-brand .logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-company {
    flex: 1;
    text-align: center;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-info { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-info span { font-size: 14px; color: rgba(255,255,255,0.85); }

.btn-header,
.btn-logout {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.btn-header:hover,
.btn-logout:hover { background: rgba(255,255,255,0.22); }

/* =====================
   STATS CARDS
===================== */
.stats-section { padding: 20px 0; }
.stats-section-header {
    font-size: 13px;
    font-weight: 600;
    color: #2D2D2D;
    margin-bottom: 10px;
    margin-top: 2px;
    letter-spacing: 0.3px;
}
.stats-row { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.stats-row:last-child { margin-bottom: 0; }

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    flex: 1;
    min-width: 160px;
    position: relative;
    overflow: hidden;
    border-left: 4px solid transparent;
}

/* Row-level stripe color: use CSS var on the row, apply to all cards in it */
.stats-row[data-stripe] .stat-card::before,
.stats-row-batch .stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}
.stats-row[data-stripe="blue"] .stat-card::before { background: #4a90d9; }
.stats-row[data-stripe="purple"] .stat-card::before { background: #9b59b6; }
.stats-row-batch .stat-card::before { background: #9b59b6; }

/* Default: orange stripe */
.stats-row:not([data-stripe]) .stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #FF6B35;
}

.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: #2D2D2D; line-height: 1.2; }
.stat-value.highlight-orange { color: #FF6B35; }
.stat-value.highlight-green { color: #27ae60; }
.stat-value.highlight-red { color: #e74c3c; }
.stat-value.highlight-blue { color: #2D2D2D; }
.stat-sub { font-size: 12px; color: #888; margin-top: 4px; }

/* =====================
   ACTION BAR
===================== */
.action-bar {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =====================
   BUTTONS
===================== */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    color: #2D2D2D;
}
.btn:hover { background: #f5f5f5; border-color: #bbb; }

.btn-primary {
    background: #FF6B35;
    color: #fff;
    border-color: #FF6B35;
    font-weight: 500;
}
.btn-primary:hover { background: #e55a27; border-color: #e55a27; }

.btn-secondary {
    background: #fff;
    color: #2D2D2D;
    border: 1px solid #ddd;
}
.btn-secondary:hover { background: #f0f0f0; }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; }

.btn-outline {
    background: #fff;
    color: #374151;
    border: 1.5px solid #d1d5db;
}
.btn-outline:hover { background: #f9fafb; border-color: #9ca3af; }

.btn-accent {
    background: #fff;
    color: #FF6B35;
    border: 1.5px solid #FF6B35;
}
.btn-accent:hover { background: #fff5f2; }

.shipment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* =====================
   UPLOAD SECTION
===================== */
.upload-section {
    background: #fff;
    border: 1px solid #FFE5D9;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    display: none;
}
.upload-section.active { display: block; }
.upload-hint { color: #92400e; font-size: 13px; margin-bottom: 12px; }
.upload-form { display: flex; align-items: center; gap: 12px; }
.upload-form input[type="file"] { flex: 1; }
.btn-upload { background: #FF6B35; color: #fff; border-color: #FF6B35; }
.btn-upload:hover { background: #e55a27; }

/* =====================
   FILTER BAR
===================== */
.filter-bar {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-row.main { margin-bottom: 12px; }
.filter-toolbar { justify-content: space-between; }
.filter-left,
.filter-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-actions { margin-left: auto; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: #888; }
.filter-group input, .filter-group select {
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    min-width: 140px;
    color: #2D2D2D;
}
.filter-group input:focus, .filter-group select:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 2px rgba(255,107,53,0.1);
}
.btn-more-filter {
    background: none;
    border: none;
    color: #FF6B35;
    cursor: pointer;
    font-size: 13px;
    padding: 7px 0;
    font-weight: 500;
}
.extra-filters { display: none; }
.extra-filters.active { display: flex; }

/* =====================
   TABLE
===================== */
.table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }

th {
    background: #F5F6F8;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8e8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #2D2D2D;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: #faf8f7; }
tbody tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-pending { background: #fff3cd; color: #856404; }
.status-returned { background: #d4edda; color: #155724; }
.status-shipped { background: #cce5ff; color: #004085; }

/* =====================
   PAGINATION
===================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #666;
}
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.page-size-label { display: inline-flex; align-items: center; gap: 6px; }
.page-size-label select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #2D2D2D;
}
.pagination-controls button {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #2D2D2D;
}
.pagination-controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-controls button:not(:disabled):hover { background: #f0f0f0; }
.pagination-controls input {
    width: 50px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}

/* =====================
   MODAL
===================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(45,45,45,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    overflow: hidden;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: #2D2D2D; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #999; line-height: 1; }
.modal-close:hover { color: #2D2D2D; }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafafa;
}

/* =====================
   FORM
===================== */
.form-row { margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-row label { display: block; margin-bottom: 5px; font-size: 13px; color: #555; font-weight: 500; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #2D2D2D;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}
.form-hint { font-size: 11px; color: #999; margin-top: 3px; }

/* =====================
   UPLOAD RESULT
===================== */
.upload-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
}
.upload-result.success { background: #d4edda; color: #155724; }
.upload-result.warning { background: #fff3cd; color: #856404; }
.upload-result.error { background: #f8d7da; color: #721c24; }

/* =====================
   TOAST
===================== */
.toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
}
.toast.success { background: #27ae60; color: #fff; }
.toast.error { background: #e74c3c; color: #fff; }
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 768px) {
    .header { padding: 0 16px; }
    .container { padding: 0 12px; }
    .stats-row { flex-direction: column; }
    .stat-card { min-width: unset; }
    .filter-row { flex-direction: column; }
    .filter-group input, .filter-group select { min-width: unset; width: 100%; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .action-bar .btn { justify-content: center; }
}
