/**
 * Tasko Chat Upgrade CSS — v3.0
 * ფაილი: assets/css/chat-upgrade.css
 * Messenger სტილი
 */

/* ===== ONLINE STATUS DOT ===== */
.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    border: 2px solid #fff;
    transition: background 0.3s;
    z-index: 2;
}
.online-dot.on {
    background: #22b865;
    box-shadow: 0 0 8px rgba(34,184,101, 0.6);
}
.chat-item-ava {
    position: relative !important;
}

/* ===== MESSAGE TIME + STATUS ===== */
.msg-time {
    font-size: 11px !important;
    color: #94a3b8 !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}
.msg-status {
    font-size: 11px !important;
}
.chat-msg-time {
    font-size: 11px !important;
    color: #94a3b8;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

/* ===== FILE PREVIEW AREA ===== */
.file-preview-area {
    display: none;
    padding: 10px 16px;
    border-bottom: 1px solid var(--cbd, #e8ecf1);
    background: #fff;
}
.file-preview-area.show {
    display: block;
}
.fp-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cb, #f8f9fb);
    border: 1px solid var(--cbd, #e8ecf1);
    border-radius: 12px;
    padding: 10px 14px;
    position: relative;
}
.fp-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.fp-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e3163, #152448);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}
.fp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fp-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ct, #1a1a2e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fp-size {
    font-size: 11px;
    color: var(--ct2, #64748b);
}
.fp-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.06);
    color: var(--ct2, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}
.fp-close:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

/* ===== UPLOAD PROGRESS BAR ===== */
.upload-progress {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-bottom: 6px;
    overflow: hidden;
}
.upload-bar {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
    transition: width 0.2s ease;
}
.msg-row.other .upload-progress {
    background: rgba(0,0,0,0.08);
}
.msg-row.other .upload-bar {
    background: var(--cm, #1e3163);
}

/* ===== EMBED MODE — popup iframe fixes ===== */
body.embed-mode {
    overflow: hidden;
}
body.embed-mode .chat-wrap {
    height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
}
body.embed-mode .chat-sidebar {
    display: none !important;
}
body.embed-mode .chat-main {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
}
body.embed-mode .chat-header {
    display: none !important;
}
body.embed-mode .chat-input-area {
    padding: 10px 12px !important;
    gap: 8px !important;
    border-radius: 0 !important;
}
body.embed-mode .chat-input-area input,
body.embed-mode .chat-input-area textarea,
body.embed-mode #chatInput {
    font-size: 14px !important;
    padding: 9px 14px !important;
    min-height: auto !important;
    height: 40px !important;
    border-radius: 20px !important;
    flex: 1 !important;
    min-width: 0 !important;
    width: auto !important;
    box-sizing: border-box !important;
}
body.embed-mode .chat-input-area button,
body.embed-mode .chat-input-area .chat-send-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    border-radius: 50% !important;
}
body.embed-mode .chat-input-area label {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
body.embed-mode .chat-body,
body.embed-mode #chatBody {
    padding: 10px !important;
}
body.embed-mode .msg-bubble {
    max-width: 85% !important;
    font-size: 13px !important;
}
body.embed-mode .msg-time {
    font-size: 9px !important;
}
body.embed-mode .msg-status {
    font-size: 9px !important;
}
body.embed-mode .msg-sender {
    font-size: 10px !important;
}
body.embed-mode .chat-msg-time {
    font-size: 9px !important;
}
body.embed-mode .file-preview-area {
    padding: 6px 10px !important;
}
body.embed-mode .fp-thumb {
    width: 44px !important;
    height: 44px !important;
}
body.embed-mode .pin-banner {
    margin-top: 0 !important;
}

/* ===== MEDIA GALLERY BUTTON — ფოტო/ვიდეო გალერეა ===== */
.chat-header-tools .gallery-btn {
    position: relative;
}
.chat-header-tools .gallery-btn .gallery-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ===== CHAT BACKGROUND OPTIONS ===== */
.chat-bg-picker {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--cbd, #e8ecf1);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 200px;
}
.chat-bg-picker.show {
    display: block;
}
.chat-bg-picker-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--ct, #1a1a2e);
    margin-bottom: 10px;
}
.chat-bg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.chat-bg-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}
.chat-bg-option:hover {
    transform: scale(1.1);
}
.chat-bg-option.active {
    border-color: var(--cm, #1e3163);
    box-shadow: 0 0 0 2px rgba(30,49,99, 0.2);
}

/* Preset backgrounds */
.chat-bg-white { background: #ffffff; }
.chat-bg-light { background: #f0f2f5; }
.chat-bg-cream { background: #faf8f5; }
.chat-bg-mint { background: #e8f5f0; }
.chat-bg-blue { background: #e3f2fd; }
.chat-bg-pink { background: #fce4ec; }
.chat-bg-dark { background: #1a1a2e; }
.chat-bg-gradient { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .file-preview-area {
        padding: 8px 10px;
    }
    .fp-thumb {
        width: 48px;
        height: 48px;
    }
    .fp-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .msg-time {
        font-size: 10px !important;
    }
    .msg-status {
        font-size: 10px !important;
    }
    .chat-msg-time {
        font-size: 10px !important;
    }
    
    /* Online dot smaller on mobile */
    .online-dot {
        width: 10px;
        height: 10px;
        border-width: 1.5px;
    }
}

/* ============================================
   VOICE PLAYER — message bubble-ის შიგნით
   ============================================ */
.voice-player{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:180px;
    max-width:240px;
    padding:4px 2px
}
.voice-player .vp-play{
    width:34px;
    height:34px;
    min-width:34px;
    border-radius:50%;
    background:rgba(255,255,255,0.22);
    border:none;
    color:inherit;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:13px;
    transition:background .15s, transform .1s
}
.voice-player .vp-play:active{
    transform:scale(0.92)
}
.msg-row.other .voice-player .vp-play{
    background:rgba(30,49,99,0.12);
    color:#1e3163
}
.voice-player .vp-bar{
    flex:1;
    height:4px;
    background:rgba(255,255,255,0.32);
    border-radius:2px;
    overflow:hidden;
    position:relative;
    cursor:pointer
}
.msg-row.other .voice-player .vp-bar{
    background:rgba(0,0,0,0.08)
}
.voice-player .vp-progress{
    height:100%;
    background:currentColor;
    border-radius:2px;
    width:0%;
    transition:width .1s linear
}
.msg-row.other .voice-player .vp-progress{
    background:#1e3163
}
.voice-player .vp-dur{
    font-size:11px;
    min-width:36px;
    text-align:right;
    font-variant-numeric:tabular-nums;
    opacity:0.85
}

/* ============================================
   ATTACH MENU — slide-up animation
   ============================================ */
.attach-menu{
    transform-origin:bottom right;
    animation:attachSlideUp .18s cubic-bezier(0.4, 0.0, 0.2, 1)
}
@keyframes attachSlideUp{
    from{opacity:0;transform:translateY(8px) scale(0.95)}
    to{opacity:1;transform:translateY(0) scale(1)}
}

/* ============================================
   MIC BUTTON — z-index ფიქსი
   ============================================ */
#micBtn{
    position:relative;
    z-index:auto !important;
    transition:transform .15s, background .15s, color .15s
}
#micBtn.recording{
    background:#ef4444 !important;
    color:#fff !important;
    transform:scale(1.15);
    box-shadow:0 4px 12px rgba(239,68,68,0.4)
}
#micBtn.recording i{
    animation:micPulse 0.8s infinite
}
@keyframes micPulse{
    0%,100%{opacity:1}
    50%{opacity:0.6}
}

/* ============================================
   CHAT INPUT ROW — gap და alignment
   ============================================ */
.chat-input-row{
    display:flex;
    align-items:center;
    gap:6px
}
.chat-input-row .chat-tool-btn{
    width:38px;
    height:38px;
    min-width:38px;
    border-radius:50%;
    flex-shrink:0;
    display:flex;
    align-items:center;
    justify-content:center
}
.chat-input-row > div{
    flex-shrink:0
}