/* ================================================================
   ZimLink — delivery.css  (Delivery Chat System)
   Brand: rgb(37,189,37) green | #ffffff white | matches cart.css
   Fonts: 'Inter' (system-style sans-serif)
   ================================================================ */

:root {
    --green:      rgb(37, 189, 37);
    --green-dark: rgb(3, 192, 3);
    --green-mid:  rgb(30, 160, 30);
    --green-soft: rgba(37, 189, 37, 0.08);
    --green-glow: rgba(37, 189, 37, 0.2);
    --white:      #ffffff;
    --dark:       rgb(6, 6, 24);
    --border:     #e0e8e0;
    --bg-color:   #f4f7f4;
    --text-color: #1a1a1a;
    --card-bg:    #ffffff;
    --header-bg:  rgb(37, 189, 37);
    --footer-bg:  rgb(6, 6, 24);

    /* Delivery App Palette — now matches cart.css's light theme.
       Old dark "navy" surfaces (--navy/--navy2/--navy3) are kept as
       variable names so every rule below still resolves, but they now
       point at light card/background tones instead of navy blues. */
    --navy:       #ffffff;
    --navy2:      #f4f7f4;
    --navy3:      #eef2ee;
    --font-head:  'Inter', sans-serif;
    --font-body:  'Inter', sans-serif;
    --text:       #1a1a1a;
    --muted:      #6b7c6b;
    --bubble-them: #eef2ee;
    --bubble-driver: rgba(37, 189, 37, 0.08);
    --bubble-me:  rgb(37, 189, 37);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ================================================================
   NAVBAR — sticky wrapper
   ================================================================ */
.main {
    backdrop-filter: blur(50px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    position: sticky;
    top: 0;
    z-index: 300;
    background: white;
}

/* ---- Top announcement bar ---- */
.Mainheader {
    display: flex;
    flex-direction: column;
    padding: 8px 20px;
    background-color: var(--green);
    color: white;
    text-align: center;
    gap: 2px;
}
.one, .two { font-size: 13px; padding: 2px 0; }

/* ---- Middle row ---- */
.sec {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    padding: 10px 20px;
    gap: 10px;
    background: white;
}

/* Logo link */
.nav-logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}
.nav-logo-link img,
.sec > img {
    border: 1px solid #ddd;
    border-radius: 10px;
    height: 46px;
    width: 46px;
    object-fit: cover;
}
.nav-logo-link h1,
.sec h1 {
    font-size: 20px;
    color: var(--green);
    white-space: nowrap;
    margin-right: 0;
}

/* Spacer */
.plane { display: none; }

/* ---- Search bar ---- */
.nav-search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
    display: flex;
    align-items: center;
}

/* Keep .sec input for backward compat on other pages */
.sec input,
.nav-search-input {
    flex: 1;
    width: 100%;
    height: 46px;
    border: 1px solid rgb(211, 209, 209);
    border-right: none;
    border-radius: 5px 0 0 5px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.nav-search-input:focus,
.sec input:focus { border-color: var(--green); }

/* Live dropdown */
.nav-search-dropdown {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    z-index: 400;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}
.nav-search-dropdown.open { display: block; }
.nav-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 14px;
    color: #222;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.nav-search-item:last-child { border-bottom: none; }
.nav-search-item:hover { background: #f0f9f0; }
.nav-search-item-type {
    font-size: 11px;
    color: #888;
    background: #f5f5f5;
    padding: 2px 7px;
    border-radius: 8px;
}
.nav-search-empty { padding: 12px 14px; color: #999; font-size: 14px; text-align: center; }

/* ---- Search button ---- */
.tony,
.nav-search-btn {
    height: 46px;
    width: auto;
    min-width: 80px;
    padding: 0 16px;
    background-color: var(--green);
    border: 1px solid var(--green);
    border-radius: 0 5px 5px 0;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.tony:hover, .nav-search-btn:hover { background-color: var(--green-mid); }

/* Keep old .btn001 for any pages still using it */
.btn001 {
    color: white;
    text-decoration: none;
    font-size: 15px;
    display: block;
    width: 100%;
    height: 100%;
    line-height: 46px;
}

/* ---- Cart icon in header ---- */
.nav-cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.nav-cart-icon:hover { background: var(--green); color: white; }
.nav-cart-count {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--green);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid white;
}
.nav-cart-icon:hover .nav-cart-count { background: var(--dark); }

/* ---- Auth buttons (logged out) ---- */
.nav-auth-btns { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.muna {
    height: 46px;
    width: 90px;
    background-color: white;
    border: 1px solid var(--green);
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.muna:hover { background: #f0f9f0; }

.juni {
    height: 46px;
    width: 90px;
    background-color: var(--green);
    border: 1px solid var(--green);
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.juni:hover { background-color: var(--green-mid); }

.btn002 {
    color: var(--green);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 15px;
}
.btn003 {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 15px;
}

/* ---- User button (logged in) ---- */
.nav-user-area { position: relative; flex-shrink: 0; }

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px 5px 5px;
    border: 1.5px solid var(--green);
    border-radius: 22px;
    cursor: pointer;
    background: white;
    transition: background 0.2s;
    white-space: nowrap;
}
.nav-user-btn:hover { background: #f0f9f0; }

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

#navUsername {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-chev { color: #888; transition: transform 0.2s; }
.nav-user-btn.open .nav-chev { transform: rotate(180deg); }

.nav-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 170px;
    z-index: 400;
    display: none;
    overflow: hidden;
}
.nav-user-menu.open { display: block; animation: menuDrop 0.18s ease; }

@keyframes menuDrop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-menu-item {
    display: block;
    padding: 11px 16px;
    font-size: 14px;
    color: #222;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: sans-serif;
    transition: background 0.15s, color 0.15s;
}
.nav-menu-item:hover { background: #f0f9f0; color: var(--green); }
.nav-menu-divider { height: 1px; background: #eee; }
.nav-menu-logout { color: #e53935; }
.nav-menu-logout:hover { background: #fff0f0 !important; color: #e53935 !important; }

/* ---- Hamburger (mobile) ---- */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-hamburger span {
    display: block;
    height: 2px;
    width: 20px;
    background: #333;
    border-radius: 2px;
    transition: all 0.25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Bottom nav links ---- */
.secheader {
    padding: 0 20px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    background: white;
    overflow-x: auto;
}

.Tadi {
    text-decoration: none;
    color: black;
    padding: 11px 14px;
    font-size: 14px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s, background 0.2s;
}
.Tadi:hover { color: var(--green); background: #f7fff7; }

.sandy {
    text-decoration: none;
    color: var(--green);
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.sandy:hover { background: #f0f9f0; }

/* Cart badge in secheader */
.nav-cart-link { display: inline-flex; align-items: center; gap: 5px; }
.nav-cart-badge {
    background: var(--green);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Mobile menu extras (injected by navbar.js) */
.nav-mobile-search {
    display: flex;
    padding: 10px 14px;
    gap: 0;
    width: 100%;
    border-bottom: 1px solid #eee;
}
.nav-mobile-search input {
    flex: 1;
    height: 40px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 5px 0 0 5px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}
.nav-mobile-search button {
    height: 40px;
    padding: 0 14px;
    background: var(--green);
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    font-size: 13px;
    cursor: pointer;
}
.nav-mobile-auth {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    width: 100%;
}
.nav-mobile-auth a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.mob-signin { border: 1px solid var(--green); color: var(--green); background: white; }
.mob-join   { background: var(--green); color: white; }
@media (max-width: 768px) {

    .sec {
        flex-wrap: nowrap;
        padding: 10px 12px;
        gap: 8px;
    }

    /* Hide search, auth, cart from middle row on mobile */
    .nav-search-wrap { display: none; }
    .nav-auth-btns   { display: none; }
    .nav-user-area   { display: none; }
    .nav-cart-icon   { display: none; }
    .plane           { display: none !important; }

    /* Show hamburger */
    .nav-hamburger { display: flex; }

    /* Logo stays visible */
    .nav-logo-link h1 { font-size: 17px; }
    .nav-logo-link img { height: 36px; width: 36px; }

    /* Secheader becomes slide-down mobile menu */
    .secheader {
        display: none;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-x: visible;
        padding: 0;
        border-top: 2px solid var(--green);
    }
    .secheader.mobile-open { display: flex; }

    .Tadi, .sandy {
        padding: 14px 20px;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        font-size: 15px;
        justify-content: flex-start;
    }
}

body {
    background: var(--navy);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
}

/* ===== DELIVERY APP CONTAINER ===== */
.delivery-app {
    max-width: 680px;
    margin: 0 auto;
    min-height: calc(100vh - 120px);
    position: relative;
    overflow: hidden;
}

/* ===== ACTIVE NAV LINK ===== */
.active-nav { color: var(--green) !important; font-weight: 600; }

/* ================================================================
   CHAT LIST VIEW
   ================================================================ */
.chat-list-view {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
    padding-bottom: 80px;
}

.chat-list-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--navy2);
}

.chat-list-title {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.02em;
}

.chat-list-title svg { color: var(--green); }

.chat-list-subtitle {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    display: block;
    font-weight: 300;
}

/* Sign-in gate */
.signin-gate, .chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 14px;
    text-align: center;
    flex: 1;
}

.signin-gate svg, .chat-empty-state svg { color: var(--muted); }

.signin-gate p, .chat-empty-state p {
    color: var(--muted);
    font-size: 14px;
    font-weight: 300;
    max-width: 280px;
    line-height: 1.6;
}

.chat-empty-state h3 {
    font-family: var(--font-head);
    font-size: 20px;
    color: var(--text);
    font-weight: 600;
}

.gate-btn {
    background: var(--green);
    color: var(--navy);
    border: none;
    padding: 10px 28px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 6px;
    transition: opacity 0.2s;
}
.gate-btn:hover { opacity: 0.85; }

/* Chat list */
.chat-list { flex: 1; }

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.chat-item:hover { background: rgba(6,6,24,0.03); }
.chat-item:active { background: rgba(6,6,24,0.06); }

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--navy3);
    border: 2px solid var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
}

.chat-item-body { flex: 1; min-width: 0; }

.chat-item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
    font-weight: 300;
}

.chat-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.chat-item-time {
    font-size: 11px;
    color: var(--muted);
    font-weight: 300;
}

.chat-item-status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.cstatus-active    { background: rgba(37,189,37,0.15); color: var(--green); }
.cstatus-packaging { background: rgba(255,165,0,0.15); color: #ffaa00; }
.cstatus-dispatched{ background: rgba(0,120,255,0.15); color: #4da6ff; }
.cstatus-delivered { background: rgba(100,200,100,0.12); color: #7dce7d; }

.chat-unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    position: absolute;
    left: 58px;
    top: 14px;
}

/* Start chat prompt */
.start-chat-prompt {
    background: rgba(37,189,37,0.07);
    border: 1px solid rgba(37,189,37,0.2);
    border-radius: 8px;
    margin: 12px 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.start-chat-prompt:hover { background: rgba(37,189,37,0.12); }
.start-chat-prompt svg { color: var(--green); flex-shrink: 0; }
.scp-text { font-size: 13px; color: var(--text); font-weight: 400; line-height: 1.4; }
.scp-text strong { color: var(--green); }

/* Find agents bar */
.find-agents-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--navy2);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    z-index: 10;
}

.find-agents-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    padding: 12px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.find-agents-btn:hover { border-color: var(--green); color: var(--green); }

/* ================================================================
   CHAT ROOM VIEW
   ================================================================ */
.chat-room-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: var(--navy);
}

/* Chat room header */
.chat-room-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--navy2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 5;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.back-btn:hover { background: rgba(6,6,24,0.06); }

.chat-room-info { flex: 1; min-width: 0; }

.chat-room-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-members {
    font-size: 11px;
    color: var(--muted);
    font-weight: 300;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-header-actions { display: flex; gap: 8px; }

.header-action-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}
.header-action-btn:hover { border-color: var(--green); color: var(--green); }

/* ===== PINNED MAP ===== */
.pinned-map-container {
    position: relative;
    flex-shrink: 0;
    height: 200px;
    background: var(--navy3);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    transition: height 0.3s ease;
}
.pinned-map-container.collapsed { height: 0; border: none; }

#chatMap { width: 100%; height: 100%; }

.map-live-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(6,6,24,0.82);
    border: 1px solid var(--green);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1000;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: livePulse 1.4s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.map-participants-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(6,6,24,0.88);
    padding: 6px 14px;
    display: flex;
    gap: 20px;
    z-index: 1000;
}

.map-part {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}

.part-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== DELIVERY STATUS BAR ===== */
.delivery-status-bar {
    background: var(--navy2);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    flex-shrink: 0;
}

.status-steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.status-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.status-step span {
    font-size: 9px;
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-step.active span { color: var(--green); }
.status-step.done span   { color: rgba(37,189,37,0.6); }

.sstep-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--navy3);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: all 0.3s;
}

.status-step.active .sstep-dot {
    background: var(--green);
    border-color: var(--green);
    color: var(--navy);
    box-shadow: 0 0 12px rgba(37,189,37,0.4);
}

.status-step.done .sstep-dot {
    background: rgba(37,189,37,0.2);
    border-color: rgba(37,189,37,0.4);
    color: var(--green);
}

.status-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    margin-bottom: 14px;
    transition: background 0.3s;
}
.status-line.done { background: rgba(37,189,37,0.4); }

/* Driver status controls */
.driver-status-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.status-ctrl-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 300;
}
.sstatus-btn {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.sstatus-btn:hover { background: var(--green); color: var(--navy); }

/* ===== MESSAGES ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Date divider */
.msg-date-divider {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    padding: 8px 0;
    font-weight: 300;
}

/* Message bubbles */
.msg-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    align-items: flex-end;
}

.msg-row.me { flex-direction: row-reverse; }

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--navy3);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    flex-shrink: 0;
    font-family: var(--font-head);
}
.msg-avatar.driver-avatar { border-color: var(--green); color: var(--green); }
.msg-avatar.seller-avatar { border-color: #ff5a5a; color: #ff5a5a; }
.msg-avatar.buyer-avatar  { border-color: #4da6ff; color: #4da6ff; }

.msg-body { max-width: 72%; }

.msg-sender {
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 3px;
    font-weight: 400;
    padding: 0 4px;
}
.msg-row.me .msg-sender { text-align: right; }

.msg-sender-link,
.msg-avatar-link {
    cursor: pointer;
}
.msg-sender-link:hover {
    color: var(--green);
    text-decoration: underline;
}
.msg-avatar-link:hover {
    filter: brightness(1.25);
    transform: scale(1.05);
}

.msg-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 300;
    word-break: break-word;
    position: relative;
}

/* Them bubbles */
.msg-row:not(.me) .msg-bubble {
    background: var(--bubble-them);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* Driver automated message */
.msg-row.driver-msg .msg-bubble {
    background: var(--bubble-driver);
    border: 1px solid rgba(37,189,37,0.2);
    border-bottom-left-radius: 4px;
}

/* My bubbles */
.msg-row.me .msg-bubble {
    background: var(--bubble-me);
    color: var(--navy);
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 10px;
    color: var(--muted);
    margin-top: 3px;
    padding: 0 4px;
    font-weight: 300;
}
.msg-row.me .msg-time { text-align: right; }

/* System message */
.system-msg {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 6px 12px;
    background: rgba(6,6,24,0.04);
    border-radius: 20px;
    margin: 6px auto;
    max-width: 80%;
    font-weight: 300;
}

/* Status update message */
.status-update-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(37,189,37,0.07);
    border: 1px solid rgba(37,189,37,0.15);
    border-radius: 8px;
    padding: 8px 14px;
    margin: 4px 0;
    font-size: 12px;
    color: var(--text);
    font-weight: 400;
}
.status-update-msg svg { color: var(--green); flex-shrink: 0; }

/* ===== CHAT INPUT ===== */
.chat-input-area {
    padding: 10px 12px 12px;
    background: var(--navy2);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--navy3);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px 8px;
}

.chat-text-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 300;
    padding: 4px 4px;
}
.chat-text-input::placeholder { color: var(--muted); }

.attach-btn, .mic-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    flex-shrink: 0;
}
.attach-btn:hover, .mic-btn:hover { color: var(--text); }

.send-btn {
    width: 34px;
    height: 34px;
    background: var(--green);
    border: none;
    border-radius: 50%;
    color: var(--navy);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.send-btn:hover { opacity: 0.85; }

/* ================================================================
   FIND AGENTS PANEL
   ================================================================ */
.find-agents-panel {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.fap-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--navy2);
    border-bottom: 1px solid var(--border);
}

.fap-title {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.fap-subtitle {
    font-size: 11px;
    color: var(--muted);
    font-weight: 300;
    margin-top: 2px;
}

.fap-notice {
    margin: 14px 20px;
    background: #fffbe6;
    border: 1px solid #f59e0b40;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #92400e;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
    font-weight: 300;
}

.fap-list { flex: 1; padding: 0 20px 20px; }

.fap-loading {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 13px;
}

.agent-card {
    background: var(--navy2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s;
}
.agent-card:hover { border-color: rgba(37,189,37,0.3); }

.agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--navy3);
    border: 2px solid var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    color: var(--green);
    flex-shrink: 0;
}

.agent-info { flex: 1; min-width: 0; }

.agent-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.agent-province {
    font-size: 11px;
    color: var(--muted);
    font-weight: 300;
    margin-top: 2px;
}

.agent-rating {
    font-size: 11px;
    color: #ffaa00;
    margin-top: 3px;
}

.agent-chat-btn {
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.agent-chat-btn:hover { background: var(--green); color: var(--navy); }

/* ================================================================
   LEAFLET MAP OVERRIDES (chat room map)
   ================================================================ */
.leaflet-container { background: var(--navy3); }
.leaflet-control-zoom a {
    background: var(--navy2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.leaflet-control-attribution { display: none !important; }

/* Markers */
.zlm-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.zlm-seller { background: #ff5a5a; }
.zlm-buyer  { background: #0066cc; }
.zlm-driver { background: var(--green); animation: driverPulse 2s ease-in-out infinite; }

@keyframes driverPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 0 rgba(37,189,37,0.4); }
    50%       { box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 0 0 10px rgba(37,189,37,0); }
}

/* ================================================================
   TOAST
   ================================================================ */
.delivery-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--navy2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-family: var(--font-body);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s;
    white-space: nowrap;
    z-index: 9999;
}
.delivery-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 480px) {
    .delivery-app { max-width: 100%; }
    .msg-body { max-width: 82%; }
    .chat-list-header { padding: 16px 14px 12px; }
    .chat-item { padding: 12px 14px; }
    .chat-messages { padding: 10px 12px; }
}