@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* ===== ریست و متغیرها ===== */
:root {
    --fc-primary: #1a5276;
    --fc-primary-light: #2980b9;
    --fc-bg: #f0f2f5;
    --fc-white: #ffffff;
    --fc-border: #e0e0e0;
    --fc-text: #333;
    --fc-muted: #888;
    --fc-radius: 20px;
    --fc-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.fc-wrap, .fc-login-wrap {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    max-width: 720px;
    margin: 20px auto;
}

/* ===== صفحه لاگین ===== */
.fc-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    padding: 16px;
}

.fc-login-box {
    background: var(--fc-white);
    border-radius: var(--fc-radius);
    box-shadow: var(--fc-shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
}

.fc-login-logo {
    text-align: center;
    margin-bottom: 16px;
}
.fc-login-logo img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: contain;
}

.fc-login-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--fc-primary);
    margin: 0 0 6px;
}
.fc-login-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--fc-muted);
    margin: 0 0 28px;
}

.fc-form-group {
    margin-bottom: 16px;
}
.fc-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--fc-text);
    margin-bottom: 6px;
}

.fc-input-wrap { position: relative; }
.fc-input {
    width: 100%;
    border: 1.5px solid var(--fc-border);
    border-radius: 12px;
    padding: 11px 14px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
    background: #fafafa;
}
.fc-input:focus { border-color: var(--fc-primary-light); background: #fff; }
.fc-toggle-pass {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fc-muted);
    padding: 4px;
    border-radius: 6px;
    transition: color .2s, background .2s;
}
.fc-toggle-pass:hover { color: var(--fc-primary-light); background: #eaf3fb; }

.fc-btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--fc-primary), var(--fc-primary-light));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity .2s, transform .2s;
}
.fc-btn-login:hover { opacity: .92; transform: translateY(-1px); }
.fc-btn-login:disabled { opacity: .6; cursor: not-allowed; }

.fc-register-note {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--fc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.fc-register-note a { color: var(--fc-primary); font-weight: 600; text-decoration: none; }

.fc-alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.fc-alert-error { background: #fde8e8; color: #c0392b; }

/* ===== انتخاب گروه ===== */
.fc-group-select {
    background: var(--fc-white);
    border-radius: var(--fc-radius);
    box-shadow: var(--fc-shadow);
    overflow: hidden;
}
.fc-group-header {
    background: linear-gradient(135deg, var(--fc-primary), var(--fc-primary-light));
    padding: 28px 24px;
    text-align: center;
    color: #fff;
}
.fc-group-logo img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    border: 3px solid rgba(255,255,255,.3);
    object-fit: contain;
    margin-bottom: 10px;
}
.fc-group-header h3 { margin: 0 0 6px; font-size: 17px; }
.fc-group-header p { margin: 4px 0; font-size: 13px; opacity: .85; }
.fc-group-hint { font-weight: 600; opacity: 1 !important; margin-top: 10px !important; }

.fc-group-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.fc-group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--fc-border);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--fc-text);
    transition: all .2s;
    text-align: right;
}
.fc-group-item:hover { border-color: var(--fc-primary-light); background: #f0f6fc; transform: translateX(-2px); }
.fc-group-item svg { margin-right: auto; color: var(--fc-muted); flex-shrink: 0; }
.fc-group-icon { font-size: 20px; }

.fc-logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 16px;
    padding: 8px 16px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    color: var(--fc-muted);
    cursor: pointer;
    transition: all .2s;
}
.fc-logout-btn:hover { color: #fff !important; border-color: var(--fc-primary-light) !important; background: var(--fc-primary-light) !important; }

/* ===== چت ===== */
.fc-chat-wrap {
    background: var(--fc-bg);
    border-radius: var(--fc-radius);
    box-shadow: var(--fc-shadow);
    display: flex;
    flex-direction: column;
    height: 620px;
    overflow: hidden;
    position: relative;
}

/* هدر چت */
.fc-header {
    background: linear-gradient(135deg, var(--fc-primary), var(--fc-primary-light));
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.fc-back-btn {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
    transition: background .2s;
}
.fc-back-btn svg { width: 26px; height: 26px; }
.fc-back-btn:hover { background: rgba(255,255,255,.35); }
.fc-header-logo {
    position: relative;
    flex-shrink: 0;
}
.fc-header-logo img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4);
    object-fit: contain;
    background: rgba(255,255,255,.15);
}
.fc-online-dot {
    position: absolute;
    bottom: 1px;
    left: 1px;
    width: 11px;
    height: 11px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2px solid var(--fc-primary);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
.fc-header-info { flex: 1; }
.fc-header-title { color: #fff; font-weight: 700; font-size: 14px; }
.fc-header-group { color: rgba(255,255,255,.8); font-size: 12px; margin-top: 2px; }
.fc-header .fc-logout-btn { margin: 0; padding: 6px 12px; color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.3); }
.fc-header .fc-logout-btn:hover { color: #fff; border-color: #fff; }

/* بدنه */
.fc-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}
.fc-body::-webkit-scrollbar { width: 4px; }
.fc-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.fc-loading {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 30px; color: var(--fc-muted); font-size: 13px;
}
.fc-spinner {
    width: 22px; height: 22px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--fc-primary-light);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* پیام */
.fc-msg {
    display: flex; flex-direction: column; max-width: 75%;
    animation: msgIn .22s ease;
}
@keyframes msgIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
.fc-msg.user { align-self: flex-end; align-items: flex-end; }
.fc-msg.support { align-self: flex-start; align-items: flex-start; }

.fc-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}
.fc-msg.user .fc-bubble {
    background: linear-gradient(135deg, var(--fc-primary), var(--fc-primary-light));
    color: #fff;
    border-bottom-left-radius: 4px;
}
.fc-msg.support .fc-bubble {
    background: #fff;
    color: var(--fc-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.fc-msg-time { font-size: 11px; color: var(--fc-muted); margin-top: 3px; padding: 0 4px; }

.fc-msg-img { max-width: 220px; max-height: 190px; border-radius: 12px; cursor: pointer; display: block; }
.fc-msg-voice { display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.fc-voice-play {
    width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: transform .2s;
}
.fc-msg.user .fc-voice-play { background: rgba(255,255,255,.2); color: #fff; }
.fc-msg.support .fc-voice-play { background: var(--fc-primary-light); color: #fff; }
.fc-voice-play:hover { transform: scale(1.1); }
.fc-voice-waves { display: flex; align-items: center; gap: 2px; height: 22px; }
.fc-voice-waves span { display: block; width: 3px; border-radius: 2px; background: currentColor; opacity: .6; }
.fc-voice-waves span:nth-child(1){height:8px}.fc-voice-waves span:nth-child(2){height:16px}
.fc-voice-waves span:nth-child(3){height:20px}.fc-voice-waves span:nth-child(4){height:12px}
.fc-voice-waves span:nth-child(5){height:18px}.fc-voice-waves span:nth-child(6){height:10px}

.fc-welcome {
    text-align: center; padding: 30px 20px;
    color: var(--fc-muted); font-size: 13px;
}
.fc-welcome-icon { font-size: 42px; margin-bottom: 10px; }

/* نوار ویس */
.fc-voice-bar {
    background: #fff; padding: 10px 14px;
    display: flex; align-items: center; gap: 10px;
    border-top: 1px solid var(--fc-border);
}
.fc-voice-info { display: flex; align-items: center; gap: 8px; flex: 1; color: var(--fc-primary-light); font-size: 13px; font-weight: 500; }
.fc-voice-dot { width: 9px; height: 9px; background: var(--fc-primary-light); border-radius: 50%; animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.2} }
.fc-voice-cancel, .fc-voice-send {
    padding: 6px 14px; border-radius: 20px; border: none;
    cursor: pointer; font-family: 'Vazirmatn', sans-serif; font-size: 13px; font-weight: 500;
}
.fc-voice-cancel { background: #f0f0f0; color: #666; }
.fc-voice-send { background: var(--fc-primary-light); color: #fff; }

/* فوتر */
.fc-footer {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; background: #fff; border-top: 1px solid var(--fc-border);
}
.fc-footer .fc-input {
    flex: 1; border-radius: 24px; padding: 10px 14px; font-size: 14px;
    background: #f8f9fa; border: 1.5px solid var(--fc-border);
}
.fc-footer .fc-input:focus { border-color: var(--fc-primary-light); background: #fff; }
.fc-icon-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--fc-bg); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #444; transition: all .2s; flex-shrink: 0;
}
.fc-icon-btn svg { width: 22px; height: 22px; }
.fc-send-btn svg { width: 22px; height: 22px; }
.fc-icon-btn:hover { background: #dde1e5; color: var(--fc-primary-light); }
.fc-icon-btn.recording { background: #d6eaf8; color: var(--fc-primary-light); }
.fc-send-btn {
    width: 46px; height: 46px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--fc-primary), var(--fc-primary-light));
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #fff; transition: all .2s; flex-shrink: 0;
}
.fc-send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(41,128,185,.4); }

.fc-no-groups {
    text-align: center; padding: 60px 20px;
    background: #fff; border-radius: var(--fc-radius);
    box-shadow: var(--fc-shadow); color: var(--fc-muted);
}

/* ===== موبایل ===== */
@media (max-width: 600px) {
    .fc-wrap, .fc-login-wrap { margin: 0; }
    .fc-login-box { border-radius: 0; box-shadow: none; padding: 32px 20px; }
    .fc-group-select { border-radius: 0; }
    .fc-chat-wrap {
        border-radius: 0;
        height: 100svh;
        height: calc(var(--vh, 1vh) * 100);
    }
    .fc-footer { padding: 8px 10px; gap: 6px; }
    .fc-footer .fc-input { font-size: 13px; }
    .fc-icon-btn { width: 42px; height: 42px; }
    .fc-send-btn { width: 44px; height: 44px; }
    .fc-body { padding: 12px 10px; }
    .fc-voice-bar { padding: 8px 10px; }
    .fc-attach-menu {
        bottom: 62px;
        right: 6px;
        min-width: 155px;
    }
    .fc-attach-item { padding: 9px 12px; font-size: 13px; }
    .fc-attach-icon { width: 34px; height: 34px; }
    .fc-modal-box { width: calc(100vw - 48px); }
}

/* ===== دانلود عکس و فایل ===== */
.fc-msg-img-wrap { position: relative; display: inline-block; }
.fc-msg-img-wrap .fc-download-btn {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(0,0,0,.55); color: #fff;
    border: none; border-radius: 8px;
    padding: 5px 10px; font-size: 12px;
    cursor: pointer; display: flex; align-items: center; gap: 4px;
    font-family: "Vazirmatn", sans-serif;
    text-decoration: none;
    opacity: 0; transition: opacity .2s;
}
.fc-msg-img-wrap:hover .fc-download-btn { opacity: 1; }
.fc-msg-img-wrap .fc-download-btn:hover { background: rgba(0,0,0,.75); }

.fc-file-msg {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0;
}
.fc-file-icon { font-size: 24px; flex-shrink: 0; }
.fc-file-info { flex: 1; }
.fc-file-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.fc-file-download {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 4px; font-size: 12px; color: var(--fc-primary-light);
    text-decoration: none; font-family: "Vazirmatn", sans-serif;
}
.fc-file-download:hover { text-decoration: underline; }
.fc-msg.user .fc-file-download { color: rgba(255,255,255,.85); }

/* صدا - پلیر کاستوم */
.fc-audio-player {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 4px; min-width: 200px;
}
.fc-audio-play-btn {
    width: 38px; height: 38px; border-radius: 50%; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform .15s;
}
.fc-msg.user .fc-audio-play-btn { background: rgba(255,255,255,.25); color: #fff; }
.fc-msg.support .fc-audio-play-btn { background: var(--fc-primary-light); color: #fff; }
.fc-audio-play-btn:hover { transform: scale(1.1); }
.fc-audio-play-btn svg { width: 18px; height: 18px; }
.fc-audio-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.fc-audio-waves { display: flex; align-items: center; gap: 2px; height: 20px; }
.fc-audio-waves span {
    display: block; width: 3px; border-radius: 2px; opacity: .7;
    transition: height .1s;
}
.fc-msg.user .fc-audio-waves span { background: rgba(255,255,255,.8); }
.fc-msg.support .fc-audio-waves span { background: var(--fc-primary-light); }
.fc-audio-waves span:nth-child(1){height:6px}.fc-audio-waves span:nth-child(2){height:14px}
.fc-audio-waves span:nth-child(3){height:20px}.fc-audio-waves span:nth-child(4){height:10px}
.fc-audio-waves span:nth-child(5){height:16px}.fc-audio-waves span:nth-child(6){height:8px}
.fc-audio-waves span:nth-child(7){height:18px}.fc-audio-waves span:nth-child(8){height:12px}
.fc-audio-duration { font-size: 11px; opacity: .75; }
.fc-audio-waves.playing span { animation: waveAnim .6s ease-in-out infinite alternate; }
.fc-audio-waves.playing span:nth-child(2){animation-delay:.1s}
.fc-audio-waves.playing span:nth-child(3){animation-delay:.2s}
.fc-audio-waves.playing span:nth-child(4){animation-delay:.15s}
.fc-audio-waves.playing span:nth-child(5){animation-delay:.05s}
.fc-audio-waves.playing span:nth-child(6){animation-delay:.25s}
.fc-audio-waves.playing span:nth-child(7){animation-delay:.1s}
.fc-audio-waves.playing span:nth-child(8){animation-delay:.2s}
@keyframes waveAnim { from { transform: scaleY(.5); } to { transform: scaleY(1.4); } }

/* ویدئو */
.fc-msg-video-wrap { position: relative; display: inline-block; }
.fc-msg-video {
    max-width: 260px; max-height: 200px;
    border-radius: 12px; display: block;
    background: #000;
}
.fc-msg-video-wrap .fc-download-btn {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(0,0,0,.55); color: #fff;
    border: none; border-radius: 8px;
    padding: 5px 10px; font-size: 12px;
    cursor: pointer; display: flex; align-items: center; gap: 4px;
    font-family: "Vazirmatn", sans-serif;
    text-decoration: none;
    opacity: 0; transition: opacity .2s;
}
.fc-msg-video-wrap:hover .fc-download-btn { opacity: 1; }

/* ===== دکمه‌های پایین انتخاب گروه ===== */
.fc-group-footer-btns {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 16px 16px;
}
.fc-group-footer-btns .fc-logout-btn { margin: 0; }
.fc-back-home-btn { text-decoration: none; }

/* ===== منوی Attach ===== */
.fc-attach-menu {
    position: fixed;
    bottom: auto;
    right: auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
    padding: 10px 6px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 160px;
    border: 1px solid #e0e0e0;
}
.fc-attach-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    color: var(--fc-text);
    text-align: right;
    direction: rtl;
    transition: background .15s;
}
.fc-attach-item:hover { background: var(--fc-bg); }
.fc-attach-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--fc-primary-light);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ===== Modal کانتکت ===== */
.fc-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fc-modal-box {
    background: var(--fc-surface);
    border-radius: 16px;
    padding: 24px 20px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.fc-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--fc-text);
    text-align: center;
    margin-bottom: 4px;
}
.fc-modal-input {
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    color: var(--fc-text);
    background: var(--fc-bg);
    outline: none;
    transition: border .2s;
}
.fc-modal-input:focus { border-color: var(--fc-primary-light); }
.fc-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.fc-modal-cancel, .fc-modal-send {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}
.fc-modal-cancel { background: var(--fc-bg); color: var(--fc-muted); border: 1px solid var(--fc-border); }
.fc-modal-cancel:hover { background: #eee; }
.fc-modal-send { background: var(--fc-primary-light); color: #fff; }
.fc-modal-send:hover { background: var(--fc-primary); }

/* ===== نمایش لوکیشن در چت ===== */
.fc-location-msg { display: flex; }
.fc-location-link {
    display: flex; align-items: center; gap: 8px;
    color: inherit; text-decoration: none;
    font-size: 14px; font-weight: 500;
}
.fc-location-link:hover { text-decoration: underline; }

/* ===== نمایش کانتکت در چت ===== */
.fc-contact-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: rtl;
}
.fc-contact-avatar {
    font-size: 28px; line-height: 1;
}
.fc-contact-info { display: flex; flex-direction: column; gap: 2px; }
.fc-contact-name { font-size: 14px; font-weight: 700; }
.fc-contact-phone { font-size: 12px; opacity: .75; direction: ltr; }
