/* Chat screen specific styles */
.chat-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color, #f8fafc);
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    z-index: 20;
    flex-shrink: 0;
}

.chat-header .back-btn-dark {
    color: var(--text-dark, #0f172a);
    text-decoration: none;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-header .back-btn-dark svg { width: 20px; height: 20px; fill: currentColor; }

.chat-header .top-bar-icons {
    display: flex;
    align-items: center;
    gap: 16px;
}
.chat-header .top-bar-icons svg { width: 20px; height: 20px; fill: var(--text-dark, #0f172a); }
.chat-header .top-bar-icons a { text-decoration: none; color: inherit; display: flex; align-items: center;}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 16px 14px 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.msg-time {
    font-size: 10px;
    margin-top: 4px;
    text-align: right;
    display: block;
    opacity: 0.75;
}

.msg-received {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-dark, #1e293b);
    border-bottom-left-radius: 4px;
    border: 1px solid #f1f5f9;
}
.msg-received .msg-time { color: var(--text-light, #64748b); }

.msg-sent {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.12), rgba(192, 108, 132, 0.18));
    color: #1e293b;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(192, 108, 132, 0.2);
}
.msg-sent .msg-time { color: #8C7B76; }

.proposal-bubble {
    background: #fffbeb !important;
    border: 1.5px solid #fde68a !important;
    color: #92400e !important;
    max-width: 90% !important;
}

/* Fixed Bottom Chat Input Area */
.chat-input-area {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    z-index: 60;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.chat-icon-btn {
    background: #f1f5f9;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.chat-icon-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.chat-icon-btn:active {
    transform: scale(0.92);
}

.chat-mic-btn {
    color: #ef4444;
}
.chat-mic-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.input-box {
    flex: 1;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 25px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.input-box:focus-within {
    border-color: #A26DF8;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(162, 109, 248, 0.15);
}
.input-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13.5px;
    color: #1e293b;
    background: transparent;
    min-width: 0;
}
.input-box input::placeholder {
    color: #94a3b8;
}

.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B6B 0%, #C06C84 50%, #6C5B7B 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 3px 10px rgba(192, 108, 132, 0.35);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.send-btn:active {
    transform: scale(0.92);
}
.send-btn svg { width: 16px; height: 16px; fill: white; margin-left: -2px;}

/* Attachment Preview Strip */
.attachment-preview-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 6px 10px;
    gap: 10px;
}
.attachment-preview-bar.active {
    display: flex;
}
.attachment-preview-bar .thumb-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.attachment-preview-bar .thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.attachment-preview-bar .thumb-wrap i {
    font-size: 18px;
    color: #2563eb;
}
.attachment-preview-bar .file-meta {
    flex: 1;
    min-width: 0;
}
.attachment-preview-bar .file-name {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-preview-bar .file-size {
    font-size: 10.5px;
    color: #64748b;
}
.attachment-preview-bar .remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice Recording Status Bar */
.voice-recording-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 25px;
    padding: 6px 12px;
    width: 100%;
    box-sizing: border-box;
}
.voice-recording-bar.active {
    display: flex;
}
.record-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}
.record-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc2626;
    animation: blinkDot 0.8s infinite;
}
@keyframes blinkDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.85); }
}
.record-timer {
    font-size: 13px;
    font-weight: 800;
    color: #b91c1c;
    font-variant-numeric: tabular-nums;
}
.record-label {
    font-size: 12px;
    color: #991b1b;
    font-weight: 600;
}
.record-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.record-cancel-btn {
    background: #fee2e2;
    border: none;
    color: #b91c1c;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 12px;
}
.record-send-btn {
    background: #dc2626;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    font-size: 12px;
}

/* Media Messages (Images, Audio, Files) */
.chat-media-img {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
    max-width: 250px;
    background: #e2e8f0;
}
.chat-media-img img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    border-radius: 12px;
    transition: opacity 0.2s ease;
}
.chat-media-img img:hover {
    opacity: 0.92;
}

.chat-audio-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    min-width: 210px;
    max-width: 270px;
}
.audio-play-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #A26DF8, #E37482);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(162, 109, 248, 0.3);
}
.audio-track-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.audio-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.audio-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #A26DF8, #E37482);
    border-radius: 10px;
    transition: width 0.1s linear;
}
.audio-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
}

.chat-media-file {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    text-decoration: none;
    color: inherit;
    margin-bottom: 4px;
    transition: background 0.15s ease;
}
.chat-media-file:hover {
    background: #ffffff;
}
.chat-file-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #eff6ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.chat-file-details {
    flex: 1;
    min-width: 0;
}
.chat-file-name {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-file-size {
    font-size: 10px;
    color: #64748b;
}
.chat-file-down {
    font-size: 13px;
    color: #64748b;
    margin-left: 4px;
}

/* Floating Scroll to Bottom Button */
.scroll-bottom-btn {
    position: absolute;
    bottom: 72px;
    right: 16px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 12px;
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: #1e293b;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    cursor: pointer;
    z-index: 55;
    transition: all 0.2s ease;
}
.scroll-bottom-btn:hover {
    background: #f8fafc;
    transform: translateY(-2px);
}
.scroll-bottom-btn .badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    display: none;
}

