/* ── OrderPulse Design System ── */
:root {
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --topbar-bg: #ffffff;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --blue: #3b82f6;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f97316;
    --purple: #8b5cf6;
    --yellow: #eab308;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ── Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a,
.sidebar-nav button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(59,130,246,0.15);
    border-right: 3px solid var(--sidebar-active);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.main-content {
    flex: 1;
    margin-left: 240px;
}

.topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--content-bg);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    width: 400px;
}

.topbar-search input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-content {
    padding: 2rem;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Status Cards Grid ── */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.status-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.status-card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.status-card-value {
    font-size: 2rem;
    font-weight: 700;
}

.status-card-value.blue { color: var(--blue); }
.status-card-value.red { color: var(--red); }
.status-card-value.orange { color: var(--orange); }
.status-card-value.purple { color: var(--purple); }
.status-card-value.green { color: var(--green); }

/* ── Activity Feed ── */
.activity-feed {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-icon.shipped { background: #dbeafe; color: var(--blue); }
.activity-icon.delivered { background: #dcfce7; color: var(--green); }
.activity-icon.exception { background: #fee2e2; color: var(--red); }
.activity-icon.return { background: #fef3c7; color: var(--orange); }
.activity-icon.refund { background: #f3e8ff; color: var(--purple); }
.activity-icon.placed { background: #e0e7ff; color: #6366f1; }

.activity-text {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* ── Attention Items ── */
.attention-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.attention-item:last-child { border-bottom: none; }

.attention-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    text-transform: uppercase;
}

.attention-tag.urgent { background: #fee2e2; color: var(--red); }
.attention-tag.warning { background: #fef3c7; color: #b45309; }
.attention-tag.info { background: #dbeafe; color: var(--blue); }

/* ── Order Table ── */
.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.orders-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.orders-table tr {
    cursor: pointer;
    transition: background 0.1s;
}

.orders-table tbody tr:hover {
    background: #f8fafc;
}

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge.placed { background: #e0e7ff; color: #4338ca; }
.badge.placed .badge-dot { background: #4338ca; }
.badge.shipped { background: #dbeafe; color: #1d4ed8; }
.badge.shipped .badge-dot { background: #1d4ed8; }
.badge.in-transit { background: #cffafe; color: #0891b2; }
.badge.in-transit .badge-dot { background: #0891b2; }
.badge.out-for-delivery { background: #fef3c7; color: #b45309; }
.badge.out-for-delivery .badge-dot { background: #b45309; }
.badge.delivered { background: #dcfce7; color: #15803d; }
.badge.delivered .badge-dot { background: #15803d; }
.badge.exception { background: #fee2e2; color: #dc2626; }
.badge.exception .badge-dot { background: #dc2626; }
.badge.return { background: #fef3c7; color: #d97706; }
.badge.return .badge-dot { background: #d97706; }
.badge.refunded { background: #f3e8ff; color: #7c3aed; }
.badge.refunded .badge-dot { background: #7c3aed; }
.badge.cancelled { background: #f1f5f9; color: #64748b; }
.badge.cancelled .badge-dot { background: #64748b; }

/* ── Filter Chips ── */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.filter-chip:hover { border-color: var(--blue); color: var(--blue); }
.filter-chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-buttons button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
}

.pagination-buttons button:hover { background: var(--content-bg); }
.pagination-buttons button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Two Column Dashboard Layout ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
}

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}
