/* ==========================================================================
   Design refresh (Nov 2026)
   Loaded after style.css on customer pages only. Keeps the existing mobile
   layout and HTML; only restyles it. Colours come from admin settings
   (--primary-color = theme colour, --status-* = status colours).
   Delete the <link> to refresh.css in includes/header.php to go back.
   ========================================================================== */

:root {
    --rf-bg: #f4f2f0;
    --rf-surface: #ffffff;
    --rf-text: #1c1917;
    --rf-muted: #78716c;
    --rf-border: rgba(28, 25, 23, 0.08);
    --rf-radius: 20px;
    --rf-radius-sm: 14px;
    --rf-shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px -12px rgba(28, 25, 23, 0.18);
    --rf-shadow-lg: 0 18px 40px -18px rgba(28, 25, 23, 0.35);
    --rf-primary-deep: color-mix(in srgb, var(--primary-color) 72%, #000);
    --rf-primary-soft: color-mix(in srgb, var(--primary-color) 10%, #fff);
}

/* ---------- Base ---------- */
body {
    background: var(--rf-bg);
    color: var(--rf-text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
.app-main, .app-content { background: transparent !important; }
.app-frame { border-color: transparent; }
.app-content { padding-left: 16px; padding-right: 16px; }

/* ---------- Header ---------- */
.app-header {
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--rf-border);
}
.app-header .page-title {
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--rf-text);
}
.app-header .logo-circle {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--rf-border);
}
.btn-login-header {
    border-radius: 999px !important;
    background: linear-gradient(135deg, var(--primary-color), var(--rf-primary-deep)) !important;
    box-shadow: 0 6px 16px -6px var(--primary-color);
    font-weight: 600;
}
.notification-icon {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--rf-primary-soft);
    color: var(--primary-color);
}

/* ---------- Home hero ---------- */
.home-hero {
    position: relative;
    overflow: hidden;
    margin: 14px 0 18px;
    padding: 22px 18px 18px;
    border-radius: 24px;
    color: #fff;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 55%),
        linear-gradient(140deg, var(--primary-color) 0%, var(--rf-primary-deep) 100%);
    box-shadow: var(--rf-shadow-lg);
}
.home-hero::before, .home-hero::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, 0.07); pointer-events: none;
}
.home-hero::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.home-hero::after { width: 140px; height: 140px; left: -50px; bottom: -70px; }
.home-hero-text { position: relative; z-index: 1; padding-right: 64px; }
.home-hero-eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 600; opacity: 0.85; }
.home-hero-title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.home-hero-sub { margin: 6px 0 16px; font-size: 13.5px; opacity: 0.85; line-height: 1.45; }
.home-hero-truck {
    position: absolute; right: 18px; top: 20px; z-index: 1;
    width: 54px; height: 54px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    animation: rf-float 4s ease-in-out infinite;
}
@keyframes rf-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.home-hero .search-container { position: relative; z-index: 1; margin: 0; padding: 0; }
.home-hero .search-input-wrapper {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45);
}
.home-hero .track-search-input { font-size: 15px; height: 52px; }
.home-hero .search-icon { color: var(--primary-color) !important; }

/* ---------- Search (other pages) ---------- */
.search-input-wrapper, .cargo-search-compact {
    border-radius: 16px;
    border-color: var(--rf-border);
    box-shadow: var(--rf-shadow);
}
.track-search-input:focus, .cargo-search-input:focus { outline: none; }
.search-input-wrapper:focus-within, .cargo-search-compact:focus-within {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent), var(--rf-shadow);
}

/* ---------- Quick actions ---------- */
.quick-actions-grid {
    background: transparent;
    box-shadow: none;
    padding: 0;
    gap: 10px;
    margin-bottom: 22px;
}
.quick-action-btn {
    background: var(--rf-surface);
    border: 1px solid var(--rf-border);
    border-radius: 18px;
    padding: 14px 4px 12px;
    box-shadow: var(--rf-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quick-action-btn:active { transform: scale(0.96); }
.quick-action-btn .action-icon-wrapper {
    width: 46px; height: 46px; border-radius: 15px;
    margin-bottom: 8px;
}
.quick-action-btn .action-label { font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--rf-text); }
.action-icon-wrapper.blue   { background: linear-gradient(135deg, #e0ecff, #c7dbff); color: #2563eb; }
.action-icon-wrapper.orange { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #ea580c; }
.action-icon-wrapper.green  { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #16a34a; }
.action-icon-wrapper.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #7c3aed; }

/* ---------- Notifications (colour chosen per notification in admin) ---------- */
.home-notification-section-header { margin-bottom: 12px; }
.home-notification-heading h2 { font-weight: 800; letter-spacing: -0.01em; }
.home-notification-heading p { color: var(--rf-muted); }
.home-notification-heading-icon {
    background: var(--rf-primary-soft) !important;
    color: var(--primary-color) !important;
    border-radius: 14px !important;
}
.home-notification-open-btn {
    border-radius: 999px !important;
    background: var(--rf-primary-soft) !important;
    color: var(--primary-color) !important;
    border: none !important;
    font-weight: 600;
}
.home-notification-list { gap: 14px; }
.home-notification-card {
    --notif-bg: #16a34a;
    --notif-fg: #fff;
    background:
        radial-gradient(130% 80% at 100% 0%, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 60%),
        linear-gradient(150deg, var(--notif-bg) 0%, color-mix(in srgb, var(--notif-bg) 75%, #000) 100%);
    color: var(--notif-fg);
    border-radius: var(--rf-radius);
    padding: 18px 18px 14px;
    box-shadow: 0 16px 32px -18px var(--notif-bg);
}
.home-notification-card::after { background: rgba(255, 255, 255, 0.08); }
.home-notification-card-title { color: var(--notif-fg); font-size: 17px; line-height: 1.3; }
.home-notification-card-icon { border-color: currentColor; color: var(--notif-fg); background: rgba(255,255,255,0.14); }
.home-notification-card-badge { background: rgba(255,255,255,0.2); color: var(--notif-fg); }
.home-notification-close { color: var(--notif-fg); background: rgba(255,255,255,0.14); border-radius: 50%; }
.home-notification-card-content { color: var(--notif-fg); font-size: 14.5px; line-height: 1.6; opacity: 0.96; }
.home-notification-card-time { color: var(--notif-fg); opacity: 0.75; }

.home-notification-card.is-collapsible .home-notification-card-content {
    max-height: 132px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
    mask-image: linear-gradient(180deg, #000 55%, transparent);
    transition: max-height 0.3s ease;
}
.home-notification-card.is-collapsible.is-expanded .home-notification-card-content {
    max-height: 4000px;
    -webkit-mask-image: none;
    mask-image: none;
}
.home-notification-more {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 8px 0 6px;
    padding: 7px 14px;
    border: none; border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--notif-fg);
    font-size: 13px; font-weight: 700;
    cursor: pointer;
}
.home-notification-more i { transition: transform 0.2s; }
.home-notification-more .less-label { display: none; }
.home-notification-card.is-expanded .home-notification-more .less-label { display: inline; }
.home-notification-card.is-expanded .home-notification-more .more-label { display: none; }
.home-notification-card.is-expanded .home-notification-more i { transform: rotate(180deg); }

.notif-link-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 4px 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: color-mix(in srgb, var(--notif-bg) 80%, #000) !important;
    font-weight: 700; font-size: 13px;
    text-decoration: none !important;
    word-break: normal;
}

/* Notification sidebar items get the same colour as a left accent */
.notification-item { border-radius: var(--rf-radius-sm); border-left: 4px solid var(--notif-accent, var(--primary-color)); }

/* ---------- Empty / locked states ---------- */
.locked-state-section, .cargo-login-prompt, .cargo-status-section {
    background: var(--rf-surface);
    border: 1px solid var(--rf-border);
    border-radius: var(--rf-radius);
    box-shadow: var(--rf-shadow);
}
.locked-icon-wrapper {
    width: 84px; height: 84px; margin-left: auto; margin-right: auto;
    border-radius: 26px;
    display: flex; align-items: center; justify-content: center;
    background: var(--rf-primary-soft);
    color: var(--primary-color);
}
.locked-icon-wrapper svg { width: 42px; height: 42px; color: var(--primary-color); }
.locked-title { font-weight: 800; letter-spacing: -0.01em; }
.btn-login-content, .btn-add-track, .ant-btn-primary {
    border-radius: 14px !important;
    background: linear-gradient(135deg, var(--primary-color), var(--rf-primary-deep)) !important;
    border: none !important;
    box-shadow: 0 10px 22px -10px var(--primary-color);
    font-weight: 700;
}

/* ---------- My cargo: status filter chips ---------- */
.status-pills-bar {
    gap: 8px;
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
}
.status-pills-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 6px 16px 10px !important;
    scroll-padding: 16px;
}
.status-pills-bar::-webkit-scrollbar { display: none; }
.status-pill {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    padding: 9px 14px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border: 1px solid transparent !important;
    box-shadow: var(--rf-shadow);
}
.cargo-section-header { margin: 6px 2px 10px; }

/* ---------- Cargo cards with a progress stepper ---------- */
.track-list { gap: 12px; }
.track-card {
    border-radius: 18px;
    padding: 14px 14px 12px;
    border: 1px solid var(--rf-border);
    box-shadow: var(--rf-shadow);
}
.track-card-header { flex-wrap: wrap; row-gap: 4px; }
.track-card-code {
    white-space: nowrap;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}
.track-card-statuses {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 0 !important;
    margin: 12px 0 6px;
    position: relative;
}
.track-status-pill {
    position: relative;
    background: transparent !important;
    padding: 20px 2px 0 !important;
    border-radius: 0 !important;
    text-align: center;
    font-size: 10.5px !important;
    line-height: 1.25;
    color: #a8a29e !important;
    font-weight: 500;
}
/* dot */
.track-status-pill::before {
    content: '';
    position: absolute; top: 2px; left: 50%;
    width: 12px; height: 12px; margin-left: -6px;
    border-radius: 50%;
    background: #e7e5e4;
    box-shadow: 0 0 0 3px #fff;
    z-index: 1;
}
/* line to the next step */
.track-status-pill:not(:last-child)::after {
    content: '';
    position: absolute; top: 7px; left: 50%; right: -50%;
    height: 2px;
    background: #e7e5e4;
}
/* steps already passed */
.track-status-pill:has(~ .track-status-pill.active) { color: var(--rf-muted) !important; }
.track-status-pill:has(~ .track-status-pill.active)::before,
.track-status-pill:has(~ .track-status-pill.active)::after { background: var(--primary-color); }
/* current step */
.track-status-pill.active {
    color: var(--rf-text) !important;
    font-weight: 800 !important;
}
.track-status-pill.active::before {
    width: 16px; height: 16px; margin-left: -8px; top: 0;
    background: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 22%, #fff);
}
.track-card-price { font-weight: 700; }
.track-card-footer { border-top: 1px dashed var(--rf-border); padding-top: 8px; }

/* ---------- Help / FAQ ---------- */
.faq-item, .accordion-item, .help-faq-item {
    border-radius: var(--rf-radius-sm) !important;
    border: 1px solid var(--rf-border) !important;
    box-shadow: var(--rf-shadow);
    overflow: hidden;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
    left: 12px; right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: 616px;
    border: 1px solid var(--rf-border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 18px 40px -16px rgba(28, 25, 23, 0.35);
}
.bottom-nav-container { padding: 10px 16px; }
.nav-icon { color: #a8a29e; }
.nav-icon.active {
    width: 46px; height: 46px;
    border-radius: 16px;
    background: var(--rf-primary-soft);
    color: var(--primary-color);
    box-shadow: none;
}
/* "+" товч: навигацийн дээр бүтэн гарсан тул доорх "Миний ачаа" (ачааны машин) товчийг хаахгүй */
.floating-action-btn {
    width: 56px; height: 56px;
    top: -68px;
    border: 4px solid var(--rf-bg);
    background: linear-gradient(135deg, var(--primary-color), var(--rf-primary-deep));
    color: #fff;
    box-shadow: 0 12px 24px -8px var(--primary-color);
}
.floating-action-btn:active { transform: translateX(-50%) scale(0.94); }
.app-main { padding-bottom: 170px; }

/* ---------- Drawers & modals ---------- */
.branch-modal-content, .user-modal-content,
.delivery-sidebar-content, .notification-sidebar-content, .profile-sidebar-content {
    border-radius: 24px 24px 0 0;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
    .home-hero, .quick-actions-grid, .home-notification-card, .track-card {
        animation: rf-rise 0.45s cubic-bezier(.2,.7,.2,1) both;
    }
    .quick-actions-grid { animation-delay: 0.05s; }
    .home-notification-card:nth-child(2) { animation-delay: 0.08s; }
    .home-notification-card:nth-child(3) { animation-delay: 0.12s; }
}
@media (prefers-reduced-motion: reduce) {
    .home-hero-truck { animation: none; }
}
@keyframes rf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Forms in drawers / modals ---------- */
.btn.btn-primary, .btn-login-submit, .profile-auth-submit-btn {
    min-height: 48px;
    border-radius: 14px !important;
    border: none !important;
    background: linear-gradient(135deg, var(--primary-color), var(--rf-primary-deep)) !important;
    box-shadow: 0 10px 22px -12px var(--primary-color);
    font-weight: 700 !important;
    letter-spacing: 0.01em;
}
.btn.btn-primary:active { transform: scale(0.98); }
.form-input, .login-input, .form-control, .form-select {
    border-radius: 12px !important;
}
.form-input:focus, .form-control:focus, .form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 18%, transparent) !important;
}
.notification-item-content, .notification-item-title { overflow-wrap: anywhere; }
