/**
 * Film Chat - استایل فرانت‌اند چت روم
 * نسخه: 1.0.0
 */

/* ============= متغیرها ============= */
.film-chat-wrap {
        --fc-bg-main: #1a1a2e;
        --fc-bg-soft: #16213e;
        --fc-bg-input: #0f3460;
        --fc-bg-msg: #1f2940;
        --fc-bg-msg-self: #2a3f5f;
        --fc-text-main: #e8e8e8;
        --fc-text-soft: #a0a0b0;
        --fc-text-muted: #6b7280;
        --fc-accent: #e94560;
        --fc-accent-disabled: #4a4a5e;
        --fc-accent-2: #4caf50;
        --fc-border: rgba(255, 255, 255, 0.08);
        --fc-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        --fc-radius: 12px;
        --fc-radius-sm: 6px;

        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Vazirmatn", Roboto, sans-serif;
        background: linear-gradient(135deg, var(--fc-bg-main) 0%, var(--fc-bg-soft) 100%);
        border-radius: var(--fc-radius);
        box-shadow: var(--fc-shadow);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        height: var(--fc-height, 500px);
        max-height: var(--fc-height, 500px);
        color: var(--fc-text-main);
        border: 1px solid var(--fc-border);
        margin: 20px 0;
        width: 100%;
        box-sizing: border-box;
}

/* حالت تمام عرض - برای مانیتورهای بزرگ */
.film-chat-wrap.fc-full-width {
        max-width: none !important;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        border-radius: 0;
        border-left: none;
        border-right: none;
}

/* اطمینان از اینکه فرزندان full-width از عرض خارج نشن */
.film-chat-wrap.fc-full-width > * {
        max-width: 100%;
        box-sizing: border-box;
}

/* ============= هدر ============= */
.fc-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 18px;
        background: rgba(0, 0, 0, 0.25);
        border-bottom: 1px solid var(--fc-border);
}

.fc-header-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 16px;
        font-weight: 600;
}

.fc-header-icon {
        font-size: 20px;
}

.fc-online-count {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        margin-right: 10px;
        padding: 2px 10px;
        background: rgba(76, 175, 80, 0.15);
        border-radius: 12px;
        font-size: 12px;
        color: #6ee07a;
}

.fc-online-dot {
        width: 8px;
        height: 8px;
        background: #4caf50;
        border-radius: 50%;
        animation: fc-pulse 2s infinite;
}

@keyframes fc-pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
}

.fc-user-info {
        display: flex;
        align-items: center;
        gap: 10px;
}

.fc-user-name {
        font-size: 13px;
        color: var(--fc-text-soft);
}

/* ============= نشان درجه ============= */
.fc-rank-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.fc-rank-icon {
        font-size: 13px;
        line-height: 1;
}

/* ============= محل نمایش پیام‌ها ============= */
.fc-messages {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        scroll-behavior: smooth;
        background:
                radial-gradient(circle at 20% 30%, rgba(233, 69, 96, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(76, 175, 80, 0.05) 0%, transparent 50%);
}

.fc-messages::-webkit-scrollbar {
        width: 6px;
}

.fc-messages::-webkit-scrollbar-track {
        background: transparent;
}

.fc-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 3px;
}

.fc-messages::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.25);
}

/* ============= پیام‌ها ============= */
.fc-message {
        display: flex;
        gap: 10px;
        margin-bottom: 14px;
        animation: fc-slide-in 0.3s ease-out;
}

@keyframes fc-slide-in {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
}

.fc-message-avatar {
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        overflow: hidden;
        border: 2px solid var(--fc-border);
}

.fc-message-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
}

.fc-message-content {
        flex: 1;
        min-width: 0;
}

.fc-message-header {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 4px;
        flex-wrap: wrap;
}

.fc-message-user {
        font-weight: 600;
        font-size: 13px;
        color: var(--fc-text-main);
}

.fc-message-rank {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 1px 7px;
        border-radius: 10px;
        font-size: 10px;
        font-weight: 600;
        color: #fff;
}

.fc-message-time {
        font-size: 11px;
        color: var(--fc-text-muted);
        margin-right: auto;
}

.fc-message-body {
        background: var(--fc-bg-msg);
        padding: 8px 12px;
        border-radius: var(--fc-radius-sm);
        font-size: 14px;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: inline-block;
        max-width: 100%;
}

.fc-message-body strong,
.fc-message-body b {
        font-weight: 700;
}

/* پیام خود کاربر */
.fc-message.fc-self .fc-message-body {
        background: var(--fc-bg-msg-self);
}

/* پیام استیکر - حذف شد، استیکرها حالا داخل متن پیام هستن */

/* پیام سیستم */
.fc-message-system {
        text-align: center;
        margin: 10px 0;
}

.fc-message-system .fc-message-body {
        display: inline-block;
        background: rgba(255, 255, 255, 0.05);
        color: var(--fc-text-muted);
        font-size: 12px;
        padding: 4px 12px;
        border-radius: 12px;
}

/* ============= دکمه‌های اکشن پیام (reply, delete) ============= */
.fc-message-actions {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        opacity: 0;
        transition: opacity 0.2s;
        margin-right: 8px;
}

.fc-message:hover .fc-message-actions {
        opacity: 1;
}

.fc-action-btn {
        background: rgba(255, 255, 255, 0.08);
        border: none;
        color: var(--fc-text-soft);
        cursor: pointer;
        font-size: 13px;
        padding: 3px 7px;
        border-radius: 4px;
        transition: all 0.15s;
        line-height: 1;
}

.fc-action-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        color: var(--fc-text-main);
}

.fc-delete-msg:hover {
        background: rgba(244, 67, 54, 0.2);
        color: #f44336;
}

.fc-reply-btn:hover {
        background: rgba(33, 150, 243, 0.2);
        color: #2196f3;
}

/* ============= باکس پیش‌نمایش reply در ورودی ============= */
.fc-reply-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 12px;
        background: rgba(33, 150, 243, 0.08);
        border-top: 1px solid var(--fc-border);
        border-right: 3px solid #2196f3;
        animation: fc-slide-down 0.2s ease-out;
}

@keyframes fc-slide-down {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
}

.fc-reply-content {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
}

.fc-reply-icon {
        font-size: 16px;
        color: #2196f3;
}

.fc-reply-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
        flex: 1;
}

.fc-reply-to-name {
        color: #2196f3;
        font-size: 12px;
        font-weight: 600;
}

.fc-reply-msg-preview {
        color: var(--fc-text-soft);
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
}

.fc-reply-cancel {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: var(--fc-text-soft);
        cursor: pointer;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        font-size: 16px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s;
        flex-shrink: 0;
}

.fc-reply-cancel:hover {
        background: rgba(244, 67, 54, 0.2);
        color: #f44336;
}

/* ============= بخش reply در داخل پیام (نمایش پیام پدر) ============= */
.fc-message-reply {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 4px;
        padding: 4px 10px;
        background: rgba(255, 255, 255, 0.04);
        border-right: 2px solid #2196f3;
        border-radius: 4px;
        font-size: 11px;
        color: var(--fc-text-muted);
        overflow: hidden;
}

.fc-reply-arrow {
        color: #2196f3;
        font-weight: bold;
        flex-shrink: 0;
}

.fc-reply-parent-name {
        color: #2196f3;
        font-weight: 600;
        flex-shrink: 0;
}

.fc-reply-parent-text {
        color: var(--fc-text-muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
}

/* ============= نوار ورودی ============= */
.fc-input-bar {
        position: relative;
        display: flex;
        align-items: flex-end;
        gap: 8px;
        padding: 12px;
        background: rgba(0, 0, 0, 0.3);
        border-top: 1px solid var(--fc-border);
}

.fc-input-wrap {
        flex: 1;
        position: relative;
        display: flex;
        align-items: flex-end;
        background: var(--fc-bg-input);
        border-radius: var(--fc-radius-sm);
        border: 1px solid var(--fc-border);
        overflow: hidden;
}

.fc-input {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--fc-text-main);
        padding: 10px 12px;
        font-size: 14px;
        font-family: inherit;
        resize: none;
        outline: none;
        max-height: 120px;
        min-height: 40px;
        line-height: 1.5;
}

.fc-input::placeholder {
        color: var(--fc-text-muted);
}

/* (دکمه‌های فرمت حذف شدند - بولد و رنگ دیگر پشتیبانی نمی‌شوند) */

/* ============= دکمه‌ها ============= */
.fc-btn {
        background: var(--fc-accent);
        border: none;
        color: #fff;
        padding: 10px 16px;
        border-radius: var(--fc-radius-sm);
        cursor: pointer;
        font-size: 14px;
        font-weight: 600;
        transition: all 0.2s;
        display: inline-flex;
        align-items: center;
        gap: 6px;
}

.fc-btn:hover {
        background: #d63851;
        transform: translateY(-1px);
}

.fc-btn:active {
        transform: translateY(0);
}

.fc-btn:disabled,
.fc-btn.fc-disabled {
        background: var(--fc-accent-disabled);
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
}

.fc-btn-sticker {
        background: var(--fc-bg-input);
        font-size: 22px;
        padding: 8px 12px;
}

.fc-btn-sticker.active {
        background: var(--fc-accent);
}

.fc-btn-send .fc-send-icon {
        transform: scaleX(-1);
        font-size: 14px;
}

/* ============= پنل استیکر - overlay در بالای نوار ورودی (فیلد پیام پنهان نمی‌شود) ============= */
.fc-sticker-panel {
        position: absolute;
        bottom: 60px;
        left: 12px;
        right: 12px;
        max-height: 240px;
        background: var(--fc-bg-soft);
        border: 1px solid var(--fc-border);
        border-radius: var(--fc-radius-sm);
        overflow: hidden;
        display: none;
        flex-direction: column;
        z-index: 20;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        animation: fc-slide-up 0.2s ease-out;
}

/* وقتی پنل باز است */
.fc-sticker-panel.open {
        display: flex;
}

@keyframes fc-slide-up {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
}

.fc-sticker-tabs {
        display: flex;
        border-bottom: 1px solid var(--fc-border);
        background: rgba(0, 0, 0, 0.2);
}

.fc-sticker-tab {
        background: transparent;
        border: none;
        color: var(--fc-text-soft);
        padding: 8px 14px;
        cursor: pointer;
        font-size: 12px;
        border-bottom: 2px solid transparent;
        transition: all 0.2s;
}

.fc-sticker-tab.active {
        color: var(--fc-text-main);
        border-bottom-color: var(--fc-accent);
        background: rgba(255, 255, 255, 0.03);
}

.fc-sticker-grid {
        flex: 1;
        overflow-y: auto;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 4px;
        padding: 8px;
}

.fc-sticker-item {
        background: rgba(255, 255, 255, 0.03);
        border: none;
        border-radius: 6px;
        padding: 6px;
        cursor: pointer;
        font-size: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s;
}

.fc-sticker-item:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.15);
}

.fc-sticker-item img {
        max-width: 100%;
        max-height: 40px;
}

/* ============= حالت عدم دسترسی ============= */
.fc-no-permission {
        flex: 1;
        text-align: center;
        color: var(--fc-text-muted);
        padding: 12px;
        font-size: 13px;
        font-style: italic;
        background: rgba(244, 67, 54, 0.05);
        border-radius: var(--fc-radius-sm);
}

.fc-guest-bar {
        justify-content: center;
}

.fc-guest-message {
        color: var(--fc-text-soft);
        font-size: 13px;
}

.fc-guest-message a {
        color: var(--fc-accent);
        text-decoration: none;
        margin-right: 6px;
        font-weight: 600;
}

/* ============= صفحه ورود ============= */
.fc-login-required {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 400px;
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        border-radius: var(--fc-radius);
        margin: 20px 0;
        padding: 30px;
}

.fc-login-box {
        text-align: center;
        max-width: 400px;
}

.fc-login-icon {
        font-size: 60px;
        display: block;
        margin-bottom: 16px;
        opacity: 0.8;
}

.fc-login-box h3 {
        color: #fff;
        font-size: 22px;
        margin: 0 0 12px;
}

.fc-login-box p {
        color: var(--fc-text-soft);
        margin-bottom: 20px;
        line-height: 1.6;
}

.fc-login-btn,
.fc-register-btn {
        display: inline-block;
        padding: 10px 24px;
        margin: 0 6px;
        border-radius: var(--fc-radius-sm);
        text-decoration: none;
        font-weight: 600;
        transition: all 0.2s;
}

.fc-login-btn {
        background: var(--fc-accent);
        color: #fff;
}

.fc-login-btn:hover {
        background: #d63851;
        color: #fff;
}

.fc-register-btn {
        background: transparent;
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.3);
}

.fc-register-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
}

/* ============= Loading ============= */
.fc-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 30px;
        color: var(--fc-text-muted);
}

.fc-spinner {
        width: 18px;
        height: 18px;
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-top-color: var(--fc-accent);
        border-radius: 50%;
        animation: fc-spin 0.8s linear infinite;
}

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

/* ============= Toast Notification ============= */
.fc-toast {
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--fc-bg-soft);
        color: var(--fc-text-main);
        padding: 12px 24px;
        border-radius: var(--fc-radius-sm);
        box-shadow: var(--fc-shadow);
        border-left: 4px solid var(--fc-accent);
        z-index: 9999;
        font-size: 14px;
        animation: fc-toast-in 0.3s ease-out;
}

.fc-toast.fc-toast-error {
        border-left-color: #f44336;
}

.fc-toast.fc-toast-success {
        border-left-color: #4caf50;
}

@keyframes fc-toast-in {
        from { opacity: 0; transform: translate(-50%, 20px); }
        to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============= Responsive ============= */
@media (max-width: 768px) {
        .film-chat-wrap {
                margin: 10px 0;
                border-radius: 8px;
        }

        .fc-header {
                padding: 10px 12px;
        }

        .fc-header-title {
                font-size: 14px;
        }

        .fc-user-name {
                display: none;
        }

        .fc-messages {
                padding: 10px;
        }

        .fc-message-body {
                font-size: 13px;
        }

        .fc-input {
                font-size: 13px;
                padding: 8px 10px;
        }

        .fc-btn-send .fc-send-text {
                display: none;
        }

        .fc-sticker-grid {
                grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
        }
}

@media (max-width: 480px) {
        .fc-message-avatar {
                width: 28px;
                height: 28px;
        }

        .fc-message-rank {
                font-size: 9px;
                padding: 1px 5px;
        }

        .fc-message-time {
                font-size: 10px;
        }
}
