/* ── Upload preview strip ─────────────────── */
#upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 4px;
}
.upload-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 12px;
    color: var(--color-primary);
    max-width: 180px;
}
.upload-chip .chip-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.upload-chip .chip-remove {
    font-size: 16px;
    color: var(--color-danger);
    line-height: 1;
    flex-shrink: 0;
    padding: 0 2px;
}
.upload-chip .chip-thumb {
    width: 28px; height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ── Upload progress ──────────────────────── */
.upload-progress {
    height: 3px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}
.upload-progress-bar {
    height: 100%;
    background: var(--color-primary);
    transition: width .2s ease;
    width: 0%;
}

/* ── Drop zone overlay ────────────────────── */
#drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(41,128,185,.12);
    border: 3px dashed var(--color-primary);
    border-radius: var(--radius-md);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
    gap: 12px;
}
#drop-overlay.show { display: flex; }
#drop-overlay .drop-icon { font-size: 48px; opacity: .6; }
#drop-overlay p { font-size: 16px; color: var(--color-primary); font-weight: 500; }

/* ── Image lightbox ───────────────────────── */
#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}
#lightbox[hidden] { display: none; }
#lightbox img {
    max-width: 88vw;
    max-height: 82vh;
    border-radius: var(--radius-md);
    object-fit: contain;
    user-select: none;
    cursor: zoom-in;
    will-change: transform;
    transform-origin: center center;
}
#lightbox-close {
    position: absolute;
    top: 16px; right: 20px;
    color: #fff; font-size: 32px;
    cursor: pointer; opacity: .75;
    background: none; border: none;
}
#lightbox-close:hover { opacity: 1; }
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.15); color: #fff; border: none;
    font-size: 40px; width: 52px; height: 72px;
    cursor: pointer; border-radius: 6px; display: flex;
    align-items: center; justify-content: center;
    transition: background .15s; user-select: none; z-index: 2;
}
.lb-nav:hover { background: rgba(255,255,255,.3); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-footer {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 20px; align-items: center;
    background: rgba(0,0,0,.55); padding: 6px 18px; border-radius: 99px;
}
.lb-counter { color: #fff; font-size: 13px; }
.lb-dl-btn  { color: #fff; font-size: 13px; text-decoration: none; opacity: .85; }
.lb-dl-btn:hover { opacity: 1; }

/* ── Image attachment wrapper ─────────────── */
.attach-img-wrap { position: relative; display: inline-block; }
.img-dl-btn {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.55); color: #fff;
    border-radius: 50%;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; text-decoration: none;
    opacity: .85;
}
.img-dl-btn:hover { opacity: 1; background: rgba(0,0,0,.78); }

/* ── Voice recorder ───────────────────────── */
#voice-recorder {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffebee;
    border-radius: var(--radius-full);
    flex: 1;
    min-width: 0;
}
#voice-recorder.show { display: flex; }
.rec-dot {
    width: 10px; height: 10px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-danger);
    animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}
#rec-timer {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-danger);
    font-variant-numeric: tabular-nums;
    flex: 1;
    min-width: 40px;
}
#rec-cancel, #rec-send {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition: opacity .15s;
}
#rec-cancel:hover, #rec-send:hover { opacity: .85; }
#rec-cancel {
    background: rgba(0,0,0,.1);
    color: var(--text-primary);
}
#rec-send {
    background: var(--color-primary);
    color: #fff;
}

/* ── Inline audio player ─────────────────── */
.attach-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.attach-audio audio {
    height: 36px;
    max-width: 240px;
    border-radius: 20px;
    outline: none;
}
.attach-audio .attach-dl-btn {
    font-size: 16px;
    text-decoration: none;
    opacity: .7;
    flex-shrink: 0;
}
.attach-audio .attach-dl-btn:hover { opacity: 1; }
