/* client_app.css — ESH Client Mobile App
   Material Design 3 inspired, Bootstrap 5 RTL, Arabic-first
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --ca-primary:       #4361ee;
    --ca-primary-dark:  #3f37c9;
    --ca-success:       #06d6a0;
    --ca-danger:        #ef476f;
    --ca-warning:       #ffb703;
    --ca-surface:       #ffffff;
    --ca-bg:            #f4f6fb;
    --ca-text:          #1a1a2e;
    --ca-text-muted:    #6b7280;
    --ca-border:        #e5e7eb;
    --ca-nav-height:    64px;
    --ca-topbar-height: 56px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: var(--ca-bg);
    color: var(--ca-text);
    direction: rtl;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout shell ──────────────────────────────────────── */
.ca-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--ca-bg);
    position: relative;
    padding-bottom: var(--ca-nav-height);
}

/* ── Top bar ───────────────────────────────────────────── */
.ca-topbar {
    height: var(--ca-topbar-height);
    background: var(--ca-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--ca-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.ca-topbar h6 {
    margin: 0;
    font-weight: 700;
    font-size: 16px;
}
.ca-topbar .ca-topbar-back {
    color: var(--ca-primary);
    font-size: 20px;
    text-decoration: none;
    padding: 4px;
}

/* ── Bottom navigation ─────────────────────────────────── */
.ca-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--ca-nav-height);
    background: var(--ca-surface);
    border-top: 1px solid var(--ca-border);
    display: flex;
    align-items: stretch;
    z-index: 200;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}
.ca-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--ca-text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 4px;
    transition: color .15s;
    position: relative;
}
.ca-nav-item i { font-size: 22px; }
.ca-nav-item.active { color: var(--ca-primary); }
.ca-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--ca-primary);
    border-radius: 0 0 4px 4px;
}
.ca-nav-badge {
    position: absolute;
    top: 6px;
    left: 50%;
    margin-left: 4px;
    background: var(--ca-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Content area ──────────────────────────────────────── */
.ca-content { padding: 16px; }

/* ── Cards ─────────────────────────────────────────────── */
.ca-card {
    background: var(--ca-surface);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    margin-bottom: 12px;
}
.ca-card-sm {
    background: var(--ca-surface);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ── KPI grid ──────────────────────────────────────────── */
.ca-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.ca-kpi {
    background: var(--ca-surface);
    border-radius: 14px;
    padding: 14px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-decoration: none;
    color: var(--ca-text);
    display: block;
    transition: transform .15s;
}
.ca-kpi:active { transform: scale(0.97); }
.ca-kpi .ca-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    margin-bottom: 8px;
}
.ca-kpi .ca-kpi-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.ca-kpi .ca-kpi-label { font-size: 12px; color: var(--ca-text-muted); margin-top: 2px; }

/* ── Quick actions ─────────────────────────────────────── */
.ca-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.ca-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    background: var(--ca-surface);
    border-radius: 14px;
    text-decoration: none;
    color: var(--ca-text);
    font-size: 11.5px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    text-align: center;
    transition: transform .15s;
}
.ca-quick-btn:active { transform: scale(0.95); color: var(--ca-text); }
.ca-quick-btn .ca-quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

/* ── Shipment card ─────────────────────────────────────── */
.ca-shipment-card {
    background: var(--ca-surface);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-decoration: none;
    display: block;
    color: var(--ca-text);
    transition: transform .15s;
}
.ca-shipment-card:active { transform: scale(0.98); }
.ca-shipment-no { font-weight: 800; font-size: 14px; color: var(--ca-primary); }
.ca-shipment-row { font-size: 13px; color: var(--ca-text); margin-top: 3px; }
.ca-shipment-row i { color: var(--ca-text-muted); width: 16px; }
.ca-amount { font-weight: 800; color: var(--ca-success); font-size: 15px; }

/* ── Status badges ─────────────────────────────────────── */
.ca-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}
.ca-status-7  { background: #fef3c7; color: #b45309; }
.ca-status-8  { background: #dbeafe; color: #1d4ed8; }
.ca-status-2  { background: #e0e7ff; color: #4338ca; }
.ca-status-3  { background: #d1fae5; color: #065f46; }
.ca-status-4  { background: #fee2e2; color: #991b1b; }
.ca-status-5  { background: #f3f4f6; color: #374151; }
.ca-status-6  { background: #fde8ff; color: #7c3aed; }

/* ── Policy badge ──────────────────────────────────────── */
.ca-policy-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    margin-bottom: 8px;
}
.ca-policy-NO_OPEN            { background: #fee2e2; color: #991b1b; }
.ca-policy-INSPECT_NO_SPLIT   { background: #fef3c7; color: #92400e; }
.ca-policy-INSPECT_ALLOW_SPLIT { background: #d1fae5; color: #065f46; }

/* ── Tabs ──────────────────────────────────────────────── */
.ca-tabs {
    display: flex;
    background: var(--ca-surface);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow-x: auto;
    gap: 2px;
}
.ca-tab {
    flex: 1;
    min-width: max-content;
    text-align: center;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ca-text-muted);
    cursor: pointer;
    white-space: nowrap;
    border: none;
    background: transparent;
    transition: all .15s;
}
.ca-tab.active {
    background: var(--ca-primary);
    color: #fff;
}

/* ── Forms ─────────────────────────────────────────────── */
.ca-form-label { font-size: 13px; font-weight: 700; margin-bottom: 5px; display: block; }
.ca-form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--ca-border);
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    background: var(--ca-surface);
    color: var(--ca-text);
    outline: none;
    transition: border-color .15s;
    direction: rtl;
}
.ca-form-control:focus { border-color: var(--ca-primary); }
.ca-form-group { margin-bottom: 14px; }

/* ── Wizard steps ──────────────────────────────────────── */
.ca-steps {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 0;
    background: var(--ca-surface);
    border-bottom: 1px solid var(--ca-border);
}
.ca-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    background: var(--ca-border);
    color: var(--ca-text-muted);
    flex-shrink: 0;
    transition: all .2s;
}
.ca-step-dot.active { background: var(--ca-primary); color: #fff; }
.ca-step-dot.done { background: var(--ca-success); color: #fff; }
.ca-step-line {
    flex: 1;
    height: 2px;
    background: var(--ca-border);
    margin: 0 4px;
}
.ca-step-line.done { background: var(--ca-success); }

/* ── Type selection cards ──────────────────────────────── */
.ca-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.ca-type-card {
    border: 2px solid var(--ca-border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    background: var(--ca-surface);
}
.ca-type-card.selected {
    border-color: var(--ca-primary);
    background: #eef1ff;
}
.ca-type-card i { font-size: 28px; color: var(--ca-primary); display: block; margin-bottom: 6px; }
.ca-type-card span { font-size: 13px; font-weight: 700; }

/* ── Policy selection ──────────────────────────────────── */
.ca-policy-card {
    border: 2px solid var(--ca-border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ca-surface);
    transition: all .15s;
}
.ca-policy-card.selected { border-color: var(--ca-primary); background: #eef1ff; }
.ca-policy-card .ca-policy-em { font-size: 22px; }
.ca-policy-card .ca-policy-title { font-size: 14px; font-weight: 700; }
.ca-policy-card .ca-policy-sub { font-size: 12px; color: var(--ca-text-muted); }

/* ── Buttons ───────────────────────────────────────────── */
.ca-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all .15s;
}
.ca-btn:active { transform: scale(0.98); }
.ca-btn-primary { background: var(--ca-primary); color: #fff; }
.ca-btn-success { background: var(--ca-success); color: #fff; }
.ca-btn-outline { background: transparent; border: 2px solid var(--ca-primary); color: var(--ca-primary); }
.ca-btn-danger  { background: var(--ca-danger); color: #fff; }

.ca-btn-row { display: flex; gap: 10px; }
.ca-btn-row .ca-btn { flex: 1; }

/* ── Timeline ──────────────────────────────────────────── */
.ca-timeline { padding: 4px 0; }
.ca-timeline-item {
    display: flex;
    gap: 12px;
    padding-bottom: 20px;
    position: relative;
}
.ca-timeline-item:last-child { padding-bottom: 0; }
.ca-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    right: 11px;
    top: 24px;
    bottom: 0;
    width: 2px;
    background: var(--ca-border);
}
.ca-timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ca-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    margin-top: 2px;
}
.ca-timeline-content { flex: 1; }
.ca-timeline-title { font-size: 14px; font-weight: 700; }
.ca-timeline-date { font-size: 12px; color: var(--ca-text-muted); margin-top: 2px; }
.ca-timeline-note { font-size: 12px; color: var(--ca-text-muted); margin-top: 3px; background: #f4f6fb; border-radius: 8px; padding: 6px 8px; }

/* ── Empty state ───────────────────────────────────────── */
.ca-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--ca-text-muted);
}
.ca-empty i { font-size: 48px; display: block; margin-bottom: 12px; opacity: .4; }
.ca-empty p { font-size: 14px; }

/* ── Alert ─────────────────────────────────────────────── */
.ca-alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ca-alert-danger  { background: #fee2e2; color: #991b1b; }
.ca-alert-success { background: #d1fae5; color: #065f46; }
.ca-alert-info    { background: #dbeafe; color: #1d4ed8; }

/* ── Search bar ────────────────────────────────────────── */
.ca-search {
    position: relative;
    margin-bottom: 14px;
}
.ca-search i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ca-text-muted);
    font-size: 18px;
}
.ca-search input {
    width: 100%;
    padding: 11px 42px 11px 14px;
    border: 1.5px solid var(--ca-border);
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    background: var(--ca-surface);
    outline: none;
    direction: rtl;
}
.ca-search input:focus { border-color: var(--ca-primary); }

/* ── Success screen ────────────────────────────────────── */
.ca-success-screen {
    text-align: center;
    padding: 40px 20px;
}
.ca-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--ca-success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: #fff;
}
.ca-success-no {
    font-size: 22px;
    font-weight: 800;
    color: var(--ca-primary);
    background: #eef1ff;
    border-radius: 12px;
    padding: 10px 20px;
    display: inline-block;
    margin: 12px 0 24px;
    letter-spacing: 1px;
}

/* ── Mod request badge ─────────────────────────────────── */
.ca-mod-status-pending  { background: #fef3c7; color: #b45309; }
.ca-mod-status-approved { background: #d1fae5; color: #065f46; }
.ca-mod-status-rejected { background: #fee2e2; color: #991b1b; }
