/* =============================================================================
   chat.css — Rideshare Chat UI
   ============================================================================= */

/* Wrap */
.chat-wrap {
    display: flex;
    flex-direction: column;
    max-width: 720px;
    margin: 0 auto;
    height: calc(100vh - 80px); /* adjust to your nav height */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ---- Header ---- */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.btn-back {
    font-size: 14px;
    color: #555;
    text-decoration: none;
    white-space: nowrap;
}

.chat-with {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #4a90d9;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-with strong { display: block; font-size: 15px; }
.chat-with small  { color: #999; font-size: 12px; }

/* ---- Message Counter ---- */
.msg-counter {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f0f0f0;
    font-weight: 600;
}

.msg-counter.counter-warning {
    background: #fff3cd;
    color: #856404;
}

.msg-counter.counter-locked {
    background: #f8d7da;
    color: #842029;
}

/* ---- Banners ---- */
.chat-locked-banner,
.chat-warning-banner {
    padding: 12px 18px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-locked-banner  { background: #f8d7da; color: #842029; }
.chat-warning-banner { background: #fff3cd; color: #856404; }

.btn-share-contact {
    padding: 6px 14px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-share-contact:hover { background: #357abd; }

/* ---- Messages Window ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f7fa;
}

.chat-no-messages {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    margin-top: 40px;
}

/* ---- Bubbles ---- */
.chat-bubble {
    max-width: 72%;
    display: flex;
    flex-direction: column;
}

.bubble-mine   { align-self: flex-end;  align-items: flex-end; }
.bubble-theirs { align-self: flex-start; align-items: flex-start; }

.bubble-content {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.bubble-mine   .bubble-content { background: #4a90d9; color: #fff; border-bottom-right-radius: 4px; }
.bubble-theirs .bubble-content { background: #fff;    color: #333; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.bubble-meta {
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
    padding: 0 4px;
}

.read-status { color: #4a90d9; font-size: 11px; }
.bubble-mine .read-status { color: #a8cff5; }

/* ---- Input Area ---- */
.chat-input-area {
    border-top: 1px solid #eee;
    padding: 12px 16px;
    background: #fff;
}

.char-counter {
    font-size: 11px;
    color: #bbb;
    text-align: right;
    margin-bottom: 6px;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-row textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-row textarea:focus { border-color: #4a90d9; }

.btn-send {
    padding: 10px 22px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-send:hover    { background: #357abd; }
.btn-send:disabled { background: #aac9ec; cursor: not-allowed; }

/* ---- Inbox ---- */
.chat-inbox { max-width: 720px; margin: 0 auto; padding: 20px; }
.chat-inbox h2 { margin-bottom: 20px; font-size: 22px; }

.conversation-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

.conversation-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s;
}

.conversation-item a:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.12); }
.conversation-item.is-locked a { opacity: 0.7; }

.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #4a90d9;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conv-body   { flex: 1; min-width: 0; }
.conv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.conv-name   { font-weight: 600; font-size: 15px; }
.conv-time   { font-size: 11px; color: #aaa; white-space: nowrap; }
.conv-preview { font-size: 13px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conv-meta    { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.msg-count    { font-size: 11px; color: #bbb; }

.badge-locked {
    font-size: 10px;
    padding: 2px 8px;
    background: #f8d7da;
    color: #842029;
    border-radius: 20px;
    font-weight: 600;
}

.chat-empty { text-align: center; color: #aaa; padding: 60px 20px; font-size: 15px; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .chat-wrap { height: calc(100vh - 60px); border-radius: 0; }
    .chat-bubble { max-width: 88%; }
}