﻿/* ══════════════════════════════════════════════════════════════
   shipper-dashboard.css
   Design system: Plus Jakarta Sans · same tokens as carrier-dashboard
   Shipper accent: indigo/violet instead of teal
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Tokens ── */
:root {
    --f: 'Plus Jakarta Sans', sans-serif;
    --ink: #0d1117;
    --ink-1: #0d1117;
    --ink-2: #374151;
    --ink-3: #6b7280;
    --ink-4: #9ca3af;
    --border: #e5e7eb;
    --border-2: #f3f4f6;
    --surface: #ffffff;
    --bg: #f9fafb;
    /* Shipper brand accent: indigo */
    --shipper: #4f46e5;
    --shipper-mid: #7c3aed;
    --shipper-light: #eef2ff;
    --shipper-border: #c7d2fe;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --blue-border: #bfdbfe;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --green-border: #bbf7d0;
    --amber: #d97706;
    --amber-light: #fffbeb;
    --amber-border: #fde68a;
    --red: #dc2626;
    --red-light: #fef2f2;
    --red-border: #fecaca;
    --indigo: #4f46e5;
    --indigo-light: #eef2ff;
    --indigo-border: #c7d2fe;
    --teal: #0f766e;
    --teal-light: #f0fdfa;
    --teal-border: #99f6e4;
}

/* ── Page shell ── */
.page-container {
    font-family: var(--f);
    background: var(--bg);
    min-height: 100vh;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════════════
   CONNECTION STATUS  (fixed pill top-right)
   ══════════════════════════════════════════════════════════════ */
.connection-status {
    position: fixed;
    top: 62px;
    right: 1.25rem;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.connection-badge {
    font-family: var(--f) !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ══════════════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════════════ */
.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 2rem;
    min-height: 76px;
    flex-wrap: wrap;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 1.22rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.page-title-icon {
    width: 42px;
    height: 42px;
    background: var(--shipper-light);
    border: 1px solid var(--shipper-border);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .page-title-icon i {
        font-size: 1rem;
        color: var(--shipper);
    }

.page-subtitle {
    font-size: 0.76rem;
    color: var(--ink-4);
    margin: 3px 0 0 52px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Shipper identity strip — same classes as carrier ── */
.cid-strip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 2rem;
    background: var(--bg);
    border-top: 1px solid var(--border-2);
    overflow-x: auto;
    scrollbar-width: none;
    min-height: 56px;
}

    .cid-strip::-webkit-scrollbar {
        display: none;
    }

.cid-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.1rem;
    border-right: 1px solid var(--border-2);
    flex-shrink: 0;
    min-width: 0;
}

    .cid-item:first-child {
        padding-left: 0;
    }

.cid-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .cid-icon i {
        font-size: 0.72rem;
        color: white;
    }

.cid-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--ink-4);
    margin-bottom: 1px;
    line-height: 1;
}

.cid-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.3px;
}

    .cid-value.normal {
        font-size: 0.82rem;
        font-weight: 600;
        letter-spacing: 0;
    }

/* ══════════════════════════════════════════════════════════════
   SHIPPER SELECTOR (admin)
   ══════════════════════════════════════════════════════════════ */
.shipper-selector-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 1.5rem 2rem 0;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    flex-wrap: wrap;
}

.selector-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
}

.selector-icon {
    width: 38px;
    height: 38px;
    background: var(--shipper-light);
    border: 1px solid var(--shipper-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .selector-icon i {
        font-size: 0.9rem;
        color: var(--shipper);
    }

.selector-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 2px;
    letter-spacing: -0.2px;
}

.selector-subtitle {
    font-size: 0.72rem;
    color: var(--ink-4);
    margin: 0;
}

/* ══════════════════════════════════════════════════════════════
   STATS GRIDS
   ══════════════════════════════════════════════════════════════ */
.stats-grid,
.stats-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 1.5rem 2rem 0;
}

.stats-grid-2 {
    padding-top: 0.75rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.14s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--stat-accent, var(--shipper));
        border-radius: 12px 12px 0 0;
    }

    .stat-card:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    }

.stat-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    margin-bottom: 0.15rem;
    flex-shrink: 0;
}

.stat-number {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.6px;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-delta {
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .stat-delta i {
        font-size: 0.55rem;
    }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ══════════════════════════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 260px;
    gap: 0.75rem;
    padding: 1rem 2rem;
    align-items: start;
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}

.dash-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border-2);
    background: var(--bg);
}

.dch-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .dch-icon i {
        font-size: 0.82rem;
        color: white;
    }

.dch-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
}

.dch-sub {
    font-size: 0.68rem;
    color: var(--ink-4);
    margin-top: 1px;
}

.dash-card-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

/* shipments hero */
.shipments-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--shipper-light);
    border: 1px solid var(--shipper-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.sh-total {
    font-size: 2rem;
    font-weight: 800;
    color: var(--shipper);
    line-height: 1;
    letter-spacing: -0.8px;
}

.sh-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--shipper);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.sh-today {
    font-size: 0.72rem;
    color: var(--ink-4);
    margin-top: 3px;
}

/* mini bar */
.mini-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.mini-bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 28px;
    align-items: center;
    gap: 0.5rem;
}

.mini-bar-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-3);
}

.mini-bar-track {
    height: 6px;
    background: var(--border-2);
    border-radius: 3px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.mini-bar-val {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-2);
    text-align: right;
}

/* problem banner */
.problem-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: var(--red-light);
    border: 1px solid var(--red-border);
    font-size: 0.75rem;
}

.problem-banner-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--red);
}

/* perf score ring */
.perf-score {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
}

.perf-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}

.perf-label {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--ink-2);
}

.perf-sub {
    font-size: 0.68rem;
    margin-top: 1px;
}

/* data rows */
.dc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-2);
}

    .dc-row:last-child {
        border-bottom: none;
    }

.dc-row-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.dc-row-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    flex-shrink: 0;
}

.dc-label {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink);
    flex-shrink: 0;
}

    .dc-value.green {
        color: var(--green);
    }

    .dc-value.mono {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.72rem;
    }

/* balance hero */
.balance-hero {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    color: white;
    margin-bottom: 0.25rem;
}

.balance-hero-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 4px;
}

.balance-hero-amount {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.balance-hero-held {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════════
   JOBS LIST CARD
   ══════════════════════════════════════════════════════════════ */
.jobs-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 0 2rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
}

.jobs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-2);
    background: var(--bg);
}

.jobs-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.job-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border-2);
    transition: background 0.12s;
}

    .job-row:last-child {
        border-bottom: none;
    }

    .job-row:hover {
        background: #f8faff;
    }

.job-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--shipper-light);
    border: 1px solid var(--shipper-border);
    color: var(--shipper);
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.job-name {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
}

.job-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.71rem;
    color: var(--ink-4);
    margin-top: 2px;
}

    .job-sub i {
        font-size: 0.6rem;
    }

/* ══════════════════════════════════════════════════════════════
   PILLS / BADGES
   ══════════════════════════════════════════════════════════════ */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.2px;
    font-family: var(--f);
    white-space: nowrap;
}

    .pill i {
        font-size: 0.5rem;
    }

.pill-green {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.pill-amber {
    background: var(--amber-light);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

.pill-red {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.pill-blue {
    background: var(--blue-light);
    color: var(--blue);
    border: 1px solid var(--blue-border);
}

.pill-indigo {
    background: var(--indigo-light);
    color: var(--indigo);
    border: 1px solid var(--indigo-border);
}

.pill-teal {
    background: var(--teal-light);
    color: var(--teal);
    border: 1px solid var(--teal-border);
}

.pill-gray {
    background: var(--bg);
    color: var(--ink-4);
    border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn-base {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.79rem;
    font-weight: 600;
    font-family: var(--f);
    border: none;
    cursor: pointer;
    transition: all 0.14s;
    letter-spacing: -0.1px;
    line-height: 1;
}

    .btn-base i {
        font-size: 0.7rem;
    }

    .btn-base.btn-sm {
        padding: 0.35rem 0.8rem;
        font-size: 0.74rem;
    }

    .btn-base.w-100 {
        width: 100%;
        justify-content: center;
    }

.btn-primary {
    background: var(--shipper);
    color: white;
    box-shadow: 0 1px 3px rgba(79,70,229,0.3), 0 4px 12px rgba(79,70,229,0.2);
}

    .btn-primary:hover:not(:disabled) {
        background: #4338ca;
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(79,70,229,0.4), 0 6px 16px rgba(79,70,229,0.25);
    }

.btn-shipper {
    background: var(--shipper);
    color: white;
}

    .btn-shipper:hover:not(:disabled) {
        background: #4338ca;
    }

.btn-ghost {
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

    .btn-ghost:hover:not(:disabled) {
        background: var(--bg);
        border-color: #d1d5db;
        color: var(--ink);
    }

.btn-danger {
    background: var(--red);
    color: white;
    font-size: 0.74rem;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: var(--f);
    font-weight: 600;
    transition: all 0.14s;
}

    .btn-danger:hover {
        background: #b91c1c;
    }

.btn-base:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ══════════════════════════════════════════════════════════════
   LOADING
   ══════════════════════════════════════════════════════════════ */
.loading-container-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    gap: 1.25rem;
}

.loading-spinner {
    display: flex;
    gap: 6px;
}

    .loading-spinner span {
        width: 10px;
        height: 10px;
        background: var(--shipper);
        border-radius: 50%;
        animation: sd-bounce 1.2s ease-in-out infinite;
        opacity: 0.6;
    }

        .loading-spinner span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .loading-spinner span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes sd-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-4);
}

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 0.5rem;
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--ink-4);
    margin-bottom: 0.25rem;
}

/* ── notification badge (fixed bottom-right) ── */
.notification-badge {
    position: fixed !important;
    bottom: 1.5rem !important;
    right: 1.5rem !important;
    top: auto !important;
    left: auto !important;
    min-width: 300px;
    max-width: 380px;
    z-index: 9999;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05), 0 12px 32px rgba(0,0,0,0.1) !important;
    border: none !important;
    font-family: var(--f);
    animation: sd-slideup 0.2s ease-out;
}

@keyframes sd-slideup {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── animations ── */
.fade-in-up {
    animation: sd-fadeup 0.3s ease-out both;
}

@keyframes sd-fadeup {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

        .dashboard-grid > div:last-child {
            grid-column: 1 / -1;
        }
}

@media (max-width: 900px) {
    .page-header-inner, .shipper-selector-section {
        padding: 0.85rem 1rem;
    }

    .cid-strip {
        padding: 0 1rem;
    }

    .stats-grid, .stats-grid-2 {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 0.75rem 1rem;
    }

    .jobs-card {
        margin: 0.75rem 1rem;
    }
}

@media (max-width: 600px) {
    .page-title {
        font-size: 1rem;
    }

    .stats-grid, .stats-grid-2 {
        grid-template-columns: repeat(2, 1fr);
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .sid-item {
        padding: 0.5rem 0.7rem;
    }
}
