@import "fonts.css";

:root {
    /* Brand & palette */
    --brand: #7c3aed; /* primary brand color (updated) */
    --brand-600: #6337f0; /* hover/active */
    --brand-700: #532ae5; /* darker shade */
    --bg: #f7fafc;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --footer-h: 104px; /* ارتفاع فوتر */

}

/* Base font */
body, html {
    font-family: 'IRANSans';
}

/* Heights & scroll behavior */
html, body {
    height: 100%;
}

body {
    /* نگه‌داشتن رفتار فعلی + fallback ها */
    min-height: 100vh; /* fallback */
    min-height: 100svh; /* iOS 15+ */
    min-height: 100dvh; /* Safari 16+ / مدرن */
    background: radial-gradient(1200px 600px at 100% -10%, #e0f2fe 0%, #f8fafc 40%, #f8fafc 100%);
}

#chatContainer {
    height: -webkit-fill-available; /* Safari */
    min-height: 100svh; /* نوار پایین روی موبایل */
}

#chatListContainer {
    overflow: auto;
}

#chatList {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}


/* Custom scrollbar */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand), var(--brand-600));
    border-radius: 8px;
}

* {
    scrollbar-color: var(--brand) transparent;
    scrollbar-width: thin;
}

/* Glass headers/bars */
.glass {
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .65));
}

/* Chat bubbles */
.bubble {
    position: relative;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(2, 12, 27, .06);
}

.bubble.me {
    background: var(--brand);
    color: #fff;
    border-bottom-right-radius: 8px;
}

.bubble.other {
    background: #fff;
    color: var(--ink);
    border-bottom-left-radius: 8px;
}

/* Minimal bubble tails */
.bubble.me:after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 12px;
    height: 12px;
    background: var(--brand);
    clip-path: polygon(0 0, 100% 100%, 0 100%);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .08));
}

.bubble.other:before {
    content: "";
    position: absolute;
    left: -6px;
    bottom: 0;
    width: 12px;
    height: 12px;
    background: #fff;
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .08));
}

/* Messages area subtle pattern */
.chat-bg {
    background: radial-gradient(12px 12px at 12px 12px, rgba(112, 69, 243, .08) 20%, transparent 21%) 0 0 / 28px 28px,
    linear-gradient(#ffffff, #ffffff);
}

/* Voice preview */
#voicePreview {
    transition: all .25s ease;
}

#waveform {
    display: flex;
    align-items: flex-end;
    height: 32px;
    gap: 3px;
}

.wave-bar {
    width: 3px;
    background: var(--brand);
    border-radius: 2px;
    transition: height .18s ease;
}

/* Audio controls inside a message */
.audio-message {
    min-width: 220px;
}

.audio-message audio {
    height: 36px;
    outline: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border-radius: 9999px;
    padding: .5rem .9rem;
    font-weight: 600;
    transition: all .15s ease;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-600);
    transform: translateY(-1px);
}

.btn-ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid rgba(15, 23, 42, .08);
}

.btn-ghost:hover {
    border-color: rgba(15, 23, 42, .18);
    transform: translateY(-1px);
}

/* Accessible focus states */
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(112, 69, 243, .45);
    outline-offset: 2px;
    border-radius: 8px;
}

/* Recording state */
.rec-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 9999px;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: .9;
    }
    50% {
        transform: scale(1.4);
        opacity: .5;
    }
    100% {
        transform: scale(1);
        opacity: .9;
    }
}

/* Story avatars ring */
.story-ring {
    box-shadow: 0 0 0 2px #fff,
    0 0 0 4px #ec4899;
}

/* Better mobile adaptation */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none;
    }
}

/* Input form fixed bottom */
#form {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    padding: 6px 5px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background-color: #fff;
    align-items: flex-end;
    margin-bottom: 1rem;
    z-index: 10000; /* اختیاری */
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 100px;
    align-self: flex-end;
}
#input {
    line-height: 1.6;
    font-size: 15px;
}
/* Header fixed top */
.header-fixed {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 99999;
}

/* Messages layout */
#messages {
    margin-bottom: 0;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* Recording bar & Voice preview */
#recBar,
#voicePreview {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10010; /* کمی بالاتر از فرم اگر فرم را مخفی نکنی */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

#recBar {
    background: rgba(254, 226, 226, 0.95); /* rose-50 با شفافیت کم */
    border-top: 1px solid #fecaca; /* rose-200 */
}

#voicePreview {
    background: rgba(237, 233, 254, 0.95); /* violet-50 */
    border-top: 1px solid #e5e7eb; /* slate-200 */
}

/* Scrolling smooth on iOS */
#chatListContainer,
#messages {
    -webkit-overflow-scrolling: touch;
}

/* Tap & select behavior */
button,
[role="button"] {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.btn {
    -webkit-user-select: none;
    user-select: none;
}

/* Chat input (fallback style) */
.chat-input {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom);
    padding: 8px;
    background: white;
    border-top: 1px solid #ddd;
    z-index: 100;
}

/* Optional: برای انیمیشن ورود و خروج */
.toast-show {
    animation: slide-in 0.5s forwards;
}

.toast-hide {
    animation: slide-out 0.5s forwards;
}

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

@keyframes slide-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

#emojiPanel {
    position: absolute;
    right: auto;
    left: 0;
}

.hidden {
    display: none !important;
}


html, body {
    height: 100%;
    overflow-x: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, video {
    max-width: 100%;
    height: auto;
}

/* محتوا هرگز پشت فوتر نرود */
body {

    background-color: #f8fafc; /* slate-50 */
    font-family: IRANSans, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

/* ظرف اصلی: قدِ صفحه منهای فوتر */
.app-shell {

}

/* هر بخشی که اسکرول دارد، با فوتر تداخل نداشته باشد */
.has-footer-safe {
    padding-bottom: var(--footer-h);
}

/* کمی فاصله اضافه داخل لیست‌ها */
#chatList, #messages {
    padding-bottom: 8px;
}

#credit-modal,#reportModal {
    z-index: 99999;
}

.menu-item-footer{
    background: rgba(113, 102, 240, 0.15);
    width: 40px;
    height: 40px;
    line-height: 43px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item-footer img{
    width: 28px;

}
.menu-item-footer i{
    font-size: 22px;
    font-weight: 900;
    color:#5e5873;
}
footer{
    padding-bottom:1.5rem ;
    display: flex;
}

.bg-red-alert{
    background-color: rgba(233, 30, 99, 1);
}

.country{
    position: relative;
    margin-right: -3.8rem;
}
#operation-section{
    display: flex;
}

.user-row {
    position: relative; /* مهم */
}

.online-wrapper {
    position: absolute;
    right: -1.5rem; /* هر جا که می‌خوای */
    top: 0;
    width: 10px;
    height: 10px;
}

.dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    top: 0;
    left: 0;
    z-index: 2;
}

.pulse {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #2ecc71;
    border-radius: 50%;
    top: -1px;
    left: -1px;
    opacity: 0;
    animation: pulse-ring 1.2s ease-out infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: .6; }
    70% { transform: scale(2.2); opacity: 0; }
    100% { transform: scale(2.2); opacity: 0; }
}
.unread-message-color{
    background-color:rgba(233, 30, 99, 1);
}
i{
    color: #e5e7eb;
}

#notFound{
    display: none;
    opacity: 0.7;
    .not-found-title{
        font-weight: bold;
        font-size: 18px;
    }
    .not-found-subtitle{
        font-size: 10px;
    }
}
#online-symbol{
    display: none;
}
#blockArea{
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    color: #7c3aed;
    font-size: 1.5rem;
    font-weight: bold;
    background-color: #fff;
}
.flag{
    position: relative;
    top: 18px;
    right: -15px;
}
.spotlight-user{
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 5px;
    a{
        display: flex; flex-direction: column; align-items: center;
    }
}

#spotlights-wrapper{
    direction: ltr;
    overflow-x: auto;
    white-space: nowrap;

}
.story-name {
    font-size: 8px;
    text-align: center;
    width: 60px;        /* یک عرض ثابت برای همه */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;     /* بهتر از inline برای truncate */
    margin: 0 auto;     /* وسط‌چین */
}


.ads-btn{
    border-color: #7045f3;
    background-color: #7045f3;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    text-align: center;
    font-size: 1.28rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    transition: all 0.3s;
    align-items: center;
    justify-content: center;
}

.spotlight-area{
    display: flex;
    align-items: center;
}

.profile-story{
    width: 52px;
    height: 52px;
}

.ads-text{
    font-size: 9px;
    font-weight: 200;
}

.selected-photo {
    border: 2px solid #8b5cf6; /* violet-500 */
    border-radius: 4px;
}
.error-box{
    color: #d400aa;
    background-color: #fae;
    border-color: #fae;
    padding: 1rem;
    font-size: 0.7rem;
    border-radius: 10px;
    list-style: disc;
}

.online-tag{
    position: relative;
    background: #d7373f;
    border-radius: 4px;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.5rem;
    padding: 0 0.6rem;
    font-weight: 700;
    bottom: 2px;

}
#blockBtnAdmin{
    display: none;
}

#imgPreviewOverlay {
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
