/* Seller Chat - Frontend Styles */

#seller-chat-app {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* وقتی adminbar وردپرس هست (32px) زیرش شروع می‌شه */
    top: var(--sc-top, 0px);
    z-index: 9990;
    background: #fff;
}

/* adminbar استاندارد وردپرس */
body.admin-bar #seller-chat-app  { --sc-top: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar #seller-chat-app { --sc-top: 46px; }
}

#sc-main {
    display: flex;
    height: 100%;
    width: 100%;
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: none;
}

/* ===== SIDEBAR ===== */
.sc-sidebar {
    width: 280px;
    min-width: 280px;
    border-left: 1px solid #eeeeee;
    display: flex;
    flex-direction: column;
    background: #f9f9f7;
}

.sc-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eeeeee;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: bold;
    color: #222;
}

.sc-search-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid #eeeeee;
}

.sc-search-wrap input {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    background: #fff;
    color: #333;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.sc-list {
    flex: 1;
    overflow-y: auto;
}

/* ===== SELLER ITEM ===== */
.sc-seller-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0ee;
    transition: background 0.15s;
    position: relative;
}

.sc-seller-item:hover { background: #f0f0ee; }
.sc-seller-item.active {
    background: #fff;
    border-right: 3px solid #1D9E75;
}

.sc-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
    background: #E1F5EE;
    color: #0F6E56;
}

.sc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-avatar-me { width: 32px; height: 32px; font-size: 12px; }

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

.sc-seller-name {
    font-size: 14px;
    font-weight: bold;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-seller-preview {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.sc-seller-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.sc-time { font-size: 11px; color: #aaa; }

.sc-badge {
    background: #1D9E75;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.sc-online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1D9E75;
    position: absolute;
    bottom: 14px;
    right: 48px;
    border: 2px solid #f9f9f7;
}

/* ===== MAIN PANEL ===== */
.sc-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #aaa;
    gap: 8px;
}

.sc-empty-icon { font-size: 56px; }
.sc-empty p { font-size: 15px; color: #888; margin: 0; }
.sc-empty small { font-size: 12px; }

.sc-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* ===== CHAT HEADER ===== */
.sc-chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
}

.sc-chat-header-info { flex: 1; }
.sc-chat-header-name { font-size: 15px; font-weight: bold; color: #222; }
.sc-chat-header-sub { font-size: 12px; color: #1D9E75; margin-top: 2px; }

/* ===== CHAT BODY ===== */
.sc-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sc-day-label {
    font-size: 12px;
    color: #888;
    text-align: center;
    background: #fff;
    border-radius: 20px;
    padding: 4px 14px;
    margin: 4px auto;
    width: fit-content;
}

/* ===== FILE CARD ===== */
.sc-file-wrap {
    display: flex;
    flex-direction: column;
    max-width: 230px;
}

.sc-file-wrap.left { align-self: flex-start; align-items: flex-start; }
.sc-file-wrap.right { align-self: flex-end; align-items: flex-end; }

.sc-file-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    width: 230px;
    cursor: pointer;
    transition: box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.sc-file-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.12); }

.sc-file-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.sc-file-thumb-placeholder {
    width: 100%;
    height: 140px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.sc-file-info {
    padding: 10px 12px;
}

.sc-file-title {
    font-size: 13px;
    font-weight: bold;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 4px;
}

.sc-file-meta {
    font-size: 11px;
    color: #999;
}

.sc-file-time {
    font-size: 11px;
    color: #bbb;
    margin-top: 4px;
    padding: 0 4px;
}

/* ===== DELETE BUTTON ===== */
.sc-file-card-wrap {
    position: relative;
    width: 230px;
}

.sc-delete-btn {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 2;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s, background 0.18s, transform 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    color: #cc3333;
    line-height: 1;
}
.sc-file-card-wrap:hover .sc-delete-btn { opacity: 1; }
.sc-delete-btn:hover { background: #ffe4e4; transform: scale(1.1); }
.sc-delete-btn svg { display: block; }

/* ===== TITLE VALIDATION ===== */
.sc-title-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sc-title-hint {
    font-size: 11px;
    color: #e04444;
    padding: 0 4px;
    animation: sc-shake 0.3s ease;
}

.sc-input-error {
    border-color: #e04444 !important;
    background: #fff8f8 !important;
}

@keyframes sc-shake {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ===== UNREAD DIVIDER ===== */
.sc-unread-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    color: #e06020;
    font-size: 12px;
    font-weight: bold;
}
.sc-unread-divider::before,
.sc-unread-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #f0c090;
}
.sc-unread-divider span {
    white-space: nowrap;
    background: #fff8f0;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid #f0c090;
}

/* ===== UPLOAD BAR ===== */
.sc-upload-bar {
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* پیش‌نمایش فایل انتخاب‌شده */
.sc-preview-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 6px;
    background: #f0faf5;
    border-bottom: 1px solid #d8f0e5;
    font-size: 13px;
    color: #333;
}

.sc-preview-bar img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.sc-preview-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #555;
}

.sc-preview-cancel {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 50%;
    line-height: 1;
    flex-shrink: 0;
}
.sc-preview-cancel:hover { background: #eee; color: #555; }

/* ردیف اصلی */
.sc-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px;
}

/* دکمه کلیپس */
.sc-clip-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.sc-clip-btn:hover { background: #f0f0f0; color: #1D9E75; }

/* فیلد عنوان */
.sc-title-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 22px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    direction: rtl;
    background: #f7f7f7;
    color: #333;
    transition: border-color 0.15s, background 0.15s;
}
.sc-title-input:focus { border-color: #1D9E75; background: #fff; }

/* دکمه ارسال */
.sc-send-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: #1D9E75;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}
.sc-send-btn:hover  { background: #0F6E56; }
.sc-send-btn:active { transform: scale(0.93); }
.sc-send-btn:disabled { background: #b2dfcf; cursor: not-allowed; }

.sc-upload-status {
    font-size: 12px;
    color: #888;
    padding: 0 14px 6px;
    min-height: 16px;
}

/* ===== SPINNER ===== */
.sc-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #1D9E75;
    border-radius: 50%;
    animation: sc-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ===== LOADING SKELETON ===== */
.sc-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sc-shimmer 1.4s infinite;
    border-radius: 6px;
}

@keyframes sc-shimmer { to { background-position: -200% 0; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    #sc-main { flex-direction: column; height: auto; }
    .sc-sidebar { width: 100%; min-width: unset; height: 220px; border-left: none; border-bottom: 1px solid #eee; }
    .sc-chat-body { min-height: 300px; }
}
