/* ====== Temel Değişkenler (tek :root) ====== */

:root {

    --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, sans-serif;

    --font-jakarta: "Plus Jakarta Sans", var(--font-sans);

    --font-lexend: "Lexend", var(--font-sans);



    --text-size: 15px;

    --text-leading: 1.45;

    --text-track: .1px;



    --card: #fff;

    --bg: #f4f7ff;

    --panel: #fff;

    --soft: #eef3ff;

    --text: #0f172a;

    --muted: #6b7280;

    --primary: #3b82f6;

    --border: #e5e7eb;

    --shadow: 0 8px 28px rgba(59, 130, 246, .1);

    --radius: 18px;

    --topbar-h: 56px;

    --inputbar-h: 56px;



    --bubble-me: #eaf2ff;

    --bubble-you: #fff;

    --bubble-me-border: #bcd3ff;

    --bubble-you-border: #e6eaf2;



    --modal-radius: 16px;

    --modal-border: #e8edf5;

    --modal-shadow: 0 10px 40px rgba(11, 87, 208, .12), 0 2px 10px rgba(13, 23, 44, .06);

    --primary-08: rgba(11, 87, 208, .08);

    --primary-14: rgba(11, 87, 208, .14);



    --col-founder: #7c3aed;

    --col-admin: #7c3aed;

    --col-op: #0b57d0;

    --col-halfop: #059669;

    --col-voice: #0ea5e9;

    --col-user: #0b1a2b;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    /* ==== Tema varyasyonları (light taban) ==== */

/* Oval balon görünümü */
.message-line.nick-change {
  display: inline-flex;
  align-items: center;
  background: #f0f8ff;
  border: 1px solid #a0c4ff;
  border-radius: 9999px;   /* oval balon */
  padding: 6px 12px;
  margin: 4px 0;
  font-size: 14px;
  color: #1f2937;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}


/* Varsayılan (Gündüz) – :root'taki değerler zaten bunu temsil ediyor, ekstra gerekmez */

/* Okyanus Mavisi */
body.theme-ocean {
    --bg: #e0f2fe;
    --panel: #f9fafb;
    --soft: #dbeafe;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #0ea5e9;
    --border: #bfdbfe;
    .icon-btn.active {
        background: linear-gradient(135deg, var(--primary), #3b82f6);
        border-color: var(--primary);
    }
    .icon-btn:hover {
        background: var(--soft);
        border-color: var(--border);
    }
}
    

/* Orman Yeşili */
body.theme-forest {
    --bg: #ecfdf5;
    --panel: #f9fafb;
    --soft: #bbf7d0;
    --text: #022c22;
    --muted: #6b7280;
    --primary: #22c55e;
    --border: #a7f3d0;
    .icon-btn.active {
        background: linear-gradient(135deg, var(--primary), #10b981); /* Yeşil tonlar */
        border-color: var(--primary);
    }
    .icon-btn:hover {
        background: var(--soft);
        border-color: var(--border);
    }
}

/* Gün Batımı (turuncu/pembe) */
body.theme-sunset {
    --bg: #fff7ed;
    --panel: #fff7ed;
    --soft: #fed7aa;
    --text: #431407;
    --muted: #7c2d12;
    --primary: #f97316;
    --border: #fed7aa;
    .icon-btn.active {
        background: linear-gradient(135deg, var(--primary), #f59e0b); /* Turuncu tonlar */
        border-color: var(--primary);
    }
    .icon-btn:hover {
        background: var(--soft);
        border-color: var(--border);
    }
}

/* Mor */
body.theme-violet {
    --bg: #f5f3ff;
    --panel: #faf5ff;
    --soft: #ddd6fe;
    --text: #1e1b4b;
    --muted: #6b21a8;
    --primary: #8b5cf6;
    --border: #ddd6fe;
    .icon-btn.active {
        background: linear-gradient(135deg, var(--primary), #6b21a8); /* Mor tonlar */
        border-color: var(--primary);
    }
    .icon-btn:hover {
        background: var(--soft);
        border-color: var(--border);
    }
}

/* Pembe */
body.theme-rose {
    --bg: #fff1f2;
    --panel: #fff7fb;
    --soft: #fecdd3;
    --text: #4a044e;
    --muted: #9f1239;
    --primary: #fb7185;
    --border: #fecdd3;
    .icon-btn.active {
        background: linear-gradient(135deg, var(--primary), #9f1239); /* Pembe tonlar */
        border-color: var(--primary);
    }
    .icon-btn:hover {
        background: var(--soft);
        border-color: var(--border);
    }
}

    /* Tema bazlı login arka planı */
body.theme-ocean #login-screen.login-hero {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(14, 165, 233, .18), transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, rgba(37, 99, 235, .12), transparent 60%),
        linear-gradient(180deg, #e0f2fe 0%, #eff6ff 100%);
}

body.theme-forest #login-screen.login-hero {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(34, 197, 94, .18), transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, rgba(16, 185, 129, .16), transparent 60%),
        linear-gradient(180deg, #ecfdf5 0%, #dcfce7 100%);
}

body.theme-sunset #login-screen.login-hero {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(249, 115, 22, .18), transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, rgba(236, 72, 153, .16), transparent 60%),
        linear-gradient(180deg, #fff7ed 0%, #fee2e2 100%);
}

/* Mesaj alanı arka planını da temaya göre değiştir (filigranı kapat) */
body.theme-ocean #messages {
    background: radial-gradient(circle at top left, #e0f2fe 0, #ffffff 45%, #eff6ff 100%) !important;
    background-image: none !important;
}

body.theme-forest #messages {
    background: radial-gradient(circle at top left, #bbf7d0 0, #ffffff 45%, #dcfce7 100%) !important;
    background-image: none !important;
}

body.theme-sunset #messages {
    background: radial-gradient(circle at top left, #fed7aa 0, #ffffff 45%, #fee2e2 100%) !important;
    background-image: none !important;
}

body.theme-violet #messages {
    background: radial-gradient(circle at top left, #ddd6fe 0, #faf5ff 45%, #e5e7eb 100%) !important;
    background-image: none !important;
}

body.theme-rose #messages {
    background: radial-gradient(circle at top left, #fecdd3 0, #ffe4e6 45%, #fdf2f8 100%) !important;
    background-image: none !important;
}


}



html,

body {

    height: 100%
}



/* ====== Global Gövde ====== */

body {

    margin: 0;

    background: var(--bg);

    color: var(--text);

    font-family: var(--font-sans);

    font-size: var(--text-size);

    line-height: var(--text-leading);

    letter-spacing: var(--text-track);

    -webkit-font-smoothing: antialiased;

    -moz-osx-font-smoothing: grayscale;

}



.body--jakarta {

    font-family: var(--font-jakarta)
}



.body--lexend {

    font-family: var(--font-lexend)
}



/* ====== Login ====== */

#login-screen {

    min-height: 100vh;

    display: flex
}



#login-screen.login-hero {

    min-height: 100dvh;

    display: grid;

    place-items: center !important;

    padding: clamp(16px, 3vw, 32px);

    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(59, 130, 246, .15), transparent 60%),

        radial-gradient(1000px 500px at -10% 110%, rgba(16, 185, 129, .12), transparent 60%),

        linear-gradient(180deg, #f8fbff 0%, #eef4ff 45%, #f6f9ff 100%);

}



.login-card {

    width: min(400px, 92vw);

    border-radius: 22px;

    padding: 28px;

    border: 1px solid rgba(255, 255, 255, .55);

    background: rgba(255, 255, 255, .6);

    box-shadow: 0 20px 60px rgba(15, 23, 42, .10), inset 0 1px 0 rgba(255, 255, 255, .6);

    backdrop-filter: blur(10px);

}



.login-brand {

    display: flex;

    align-items: center;

    gap: 10px;

    margin-bottom: 6px
}



.login-brand .logo {

    width: 44px;

    height: 44px;

    display: grid;

    place-items: center;

    background: linear-gradient(135deg, #3b82f6, #2563eb);

    color: #fff;

    border-radius: 12px;

    box-shadow: 0 10px 24px rgba(37, 99, 235, .35);

}



.login-subtle {

    color: var(--muted);

    margin-bottom: 20px
}



.form-floating > .form-control,

.form-floating > .form-control:focus {

    background: rgba(255, 255, 255, .85);

    border: 1px solid var(--border)
}



.input-icon {

    position: absolute;

    left: 12px;

    top: 50%;

    transform: translateY(-50%);

    color: #64748b;

    opacity: .9
}



.input-with-icon .form-control {

    padding-left: 38px;

    border-radius: 12px
}



.form-floating > label {

    padding-left: 34px
}



.login-actions {

    display: flex;

    gap: 10px;

    align-items: center;

    justify-content: space-between;

    margin-top: 14px
}



.btn-login {

    padding: 12px 18px;

    border-radius: 12px;

    font-weight: 600;

    box-shadow: 0 10px 20px rgba(59, 130, 246, .25);

    transition: transform .06s ease, box-shadow .2s ease
}



.btn-login:hover {

    transform: translateY(-1px)
}



.btn-login:active {

    transform: translateY(0)
}



.login-card .col-md-6 {

    flex: 0 0 100% !important;

    max-width: 100% !important
}



.login-card .row {

    --bs-gutter-x: 0
}



#toggle-pass {

    position: absolute;

    right: 10px;

    top: 50%;

    transform: translateY(-50%);

    height: 36px;

    line-height: 36px;

    padding-inline: 10px;

    border-radius: 10px;

    background: transparent;

    border: 1px solid var(--border);

}



body.dark .login-hero {

    background:

        radial-gradient(1200px 600px at 80% -10%, rgba(59, 130, 246, .20), transparent 60%),

        radial-gradient(1000px 500px at -10% 110%, rgba(16, 185, 129, .18), transparent 60%),

        linear-gradient(180deg, #0b1220 0%, #0f172a 100%);

}



body.dark .login-card {

    background: rgba(2, 6, 23, .55);

    border-color: rgba(148, 163, 184, .3);

    box-shadow: 0 20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05)
}



body.dark .input-icon {

    color: #94a3b8;

    opacity: .95
}



/* ====== App ====== */

#main {

    display: none;

    height: 100vh;

    overflow: hidden;

    flex-direction: column
}



.topbar {

    height: var(--topbar-h);

    padding: 10px 12px;

    background: var(--panel);

    border-bottom: 1px solid var(--border);

    position: sticky;

    top: 0;

    z-index: 10;

    display: flex;

    align-items: center;

    justify-content: space-between;

}



.app-grid {

    display: grid;

    grid-template-columns: 1fr 280px;

    gap: 0px;

    height: calc(100vh - var(--topbar-h));

    padding: 12px;

    min-height: 0;

}



.app-grid.sidebar-collapsed {

    grid-template-columns: 1fr !important
}



.chat-card {

    display: flex;

    flex-direction: column;

    background: var(--panel);

    border: 1px solid var(--border);

    border-radius: 16px;

    min-height: 0;

    height: 100%;

}



/* ====== Tabs ====== */

#tabs {

    display: flex;

    flex-wrap: wrap;

    gap: .5rem .6rem;

    padding: .5rem .6rem;

    background: var(--panel);

    border-bottom: 1px solid var(--border);

    overflow-x: visible;

    max-height: 84px;

    overflow-y: auto;

    scrollbar-gutter: stable both-edges;

    align-content: flex-start;

}



#tabs button {

    position: relative;

    flex: 0 1 auto;

    max-width: 240px;

    padding: .42rem .75rem;

    border-radius: 999px;

    border: 1px solid var(--border);

    background: var(--soft);

    color: var(--text);

    font: 600 14px/1 var(--font-sans);

    display: inline-flex;

    align-items: center;

    gap: .45rem;

    cursor: pointer;

    transition: all .18s ease;

    text-overflow: ellipsis;

    overflow: hidden;

}



#tabs button:hover {

    background: #e8eefc
}



#tabs button:focus-visible {

    outline: none;

    box-shadow: 0 0 0 3px rgba(59, 130, 246, .3)
}



#tabs button.active {

    background: var(--primary);

    color: #fff;

    border-color: transparent;

    box-shadow: 0 6px 16px rgba(59, 130, 246, .22)
}



#tabs .close-tab-button {

    margin-left: .15rem;

    padding: 0 .25rem;

    border-radius: 8px;

    font-size: 16px;

    line-height: 1;

    opacity: .7;

    transition: transform .15s, opacity .15s, color .15s
}



#tabs button:hover .close-tab-button {

    opacity: .95
}



#tabs .close-tab-button:hover {

    color: #e65050;

    transform: scale(1.12)
}



#tabs button.new-message {

    border-color: #3b82f6;

    box-shadow: 0 0 0 2px #3b82f6
}



#tabs button.active.new-message {

    box-shadow: 0 0 0 2px #3b82f6, 0 6px 16px rgba(59, 130, 246, .22)
}



@keyframes ringPulse {

    0% {

        box-shadow: 0 0 0 2px #3b82f6
    }



    50% {

        box-shadow: 0 0 0 3px rgba(255, 71, 87, .7)
    }



    100% {

        box-shadow: 0 0 0 2px #3b82f6
    }

}



#tabs button.new-message.pulse {

    animation: ringPulse 1.4s ease-in-out infinite
}



#topic-header {

    display: none;

    align-items: center;

    gap: 10px;

    padding: 8px 12px
}



#private-user-info {

    display: none;

    align-items: center;

    gap: 10px;

    padding: 8px 12px;

    border-bottom: 1px solid var(--border);

    background: var(--panel);

    flex: 0 0 auto;

    position: relative;

    overflow: visible;

    /* avatar taşması için */

}



#channel-name {

    font-weight: 700
}



#channel-name,

.login-brand h1 {

    letter-spacing: .2px
}



/* ===== Ana chat container ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh; /* tm ekran kaplasn */
}

/* ===== Chat ana alan ===== */
.chat-main {
  display: flex;
  flex: 1 1 auto;
  min-height: 0; /* flex iinde scroll iin art */
}

/* ===== erik alan ===== */
.chat-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* ===== Mesaj alan  optimize edilmi ===== */
.chat-content #messages {
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .1px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS iin akc scroll */
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;

  /* Sadeletirilmi arka plan */
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
}

/* Mobilde daha hafif */
@media (max-width: 768px) {
  .chat-main { flex-direction: column; }
  .chat-content #messages {
    padding: 12px; /* sa padding yerine genel padding */
    background: #ffffff; /* gradient yerine dz arka plan */
  }
}


/* ===== Input bar (mesaj yazma kutusu) ===== */
.inputbar {
  flex-shrink: 0;              /* alta sabitlenmesi iin klmesin */
  border-top: 1px solid #ccc;  /* stten ayrc izgi */
  padding: 8px;
  background: #fff;            /* arka plan sabit */
}


.chat-toolbar {

    display: flex;

    gap: 8px;

    align-items: center;

    padding: 0 5px;

    background: var(--panel);

    border-top: 1px solid var(--border)
}



.icon-btn {

    border: 0;

    background: var(--panel);

    color: var(--text);

    width: 30px;

    height: 30px;

    display: grid;

    place-items: center;

    font-size: 20px;

    padding: 0;

    border-radius: 10px
}



.icon-btn.active {

    background: var(--primary);

    color: #fff;

    border-color: var(--primary)
}



.icon-btn:hover {

    background: var(--soft)
}



.icon-btn i {

    line-height: 1;

    font-size: 18px
}



.inputbar {

    position: sticky;

    bottom: 0;

    z-index: 10;

    display: flex;

    gap: 8px;

    align-items: center;

    padding: 10px;

    background: var(--panel);

    border-top: 1px solid var(--border);

    border-radius: 0 0 var(--radius) var(--radius);

    min-height: var(--inputbar-h);

}



.inputbar input {

    flex: 1;

    background: #f7faff;

    border: 1px solid var(--border);

    border-radius: 12px;

    padding: 12px 14px;

}



/* ====== Userlist ====== */

#userlist-sidebar,
#channel-sidebar {

    background: var(--panel);

    border: 1px solid var(--border);

    border-radius: 0px 0px 16px 16px;

    display: flex;

    flex-direction: column;

    min-height: 0;

    height: 100%;

    overflow: hidden;

}



#userlist-sidebar.hidden {

    display: none !important
}



.userlist-head,
#channel-sidebar .channel-head {

    position: sticky;

    top: 0;

    z-index: 1;

    background: var(--panel);

    display: flex;

    align-items: center;

    gap: 10px;

    justify-content: space-between;

    padding: 8px;

    border-bottom: 1px solid var(--border);

}



#userlist {

    list-style: none;

    margin: 0;

    padding: 8px;

    flex: 1 1 auto;

    min-height: 0;

    max-height: 100%;

    /*overflow-y: auto;*/

    overscroll-behavior: contain
}



#userlist li {

    padding: 2px 3px;

    border-radius: 1px;

    cursor: pointer;

    color: var(--col-user)
}



#userlist li:hover {

    background: var(--soft);

    filter: brightness(1.05);

    transform: translateX(1px)
}



#userlist::-webkit-scrollbar {

    width: 10px
}



#userlist::-webkit-scrollbar-thumb {

    background: #cbd5e1;

    border-radius: 8px
}



#userlist li[data-nick^="~"] {

    color: var(--col-founder);

    font-weight: 600
}



#userlist li[data-nick^="&"] {

    color: var(--col-admin);

    font-weight: 600
}



#userlist li[data-nick^="@"] {

    color: var(--col-op);

    font-weight: 600
}



#userlist li[data-nick^="%"] {

    color: var(--col-halfop);

    font-weight: 600
}



#userlist li[data-nick^="+"] {

    color: var(--col-voice);

    font-weight: 600
}



#userlist li.ul-item {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 4px 2px;

    line-height: 1.2
}



#userlist .ul-badge {

    flex: 0 0 24px;

    height: 20px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    border-radius: 6px;

    font-weight: 700;

    font-size: 12px;

    border: 1px solid transparent;

    background: transparent;

    color: var(--col-user);

}



#userlist .ul-name {

    flex: 1;

    min-width: 0;

    color: var(--col-user)
}



#userlist li.ul-item:hover .ul-name {

    text-decoration: underline
}



#userlist .ul-badge.founder {

    background: rgba(217, 119, 6, .12);

    color: var(--col-founder);

    border-color: rgba(217, 119, 6, .25)
}



#userlist .ul-badge.admin {

    background: rgba(124, 58, 237, .12);

    color: var(--col-admin);

    border-color: rgba(124, 58, 237, .25)
}



#userlist .ul-badge.op {

    background: rgba(11, 87, 208, .12);

    color: var(--col-op);

    border-color: rgba(11, 87, 208, .25)
}



#userlist .ul-badge.halfop {

    background: rgba(5, 150, 105, .12);

    color: var(--col-halfop);

    border-color: rgba(5, 150, 105, .25)
}



#userlist .ul-badge.voice {

    background: rgba(14, 165, 233, .12);

    color: var(--col-voice);

    border-color: rgba(14, 165, 233, .25)
}



#userlist .ul-badge.user {

    background: rgba(2, 6, 23, .06);

    border-color: rgba(2, 6, 23, .12);

    color: var(--col-user)
}



#userlist .ul-badge i {

    font-size: 14px;

    line-height: 1;

    display: inline-block;

    transform: translateY(1px)
}



/* ====== Overlay / Spinner ====== */

#connecting-overlay {

    position: fixed;

    inset: 0;

    background: rgba(255, 255, 255, .8);

    display: none;

    align-items: center;

    justify-content: center;

    z-index: 9999
}



.spinner {

    width: 56px;

    height: 56px;

    border-radius: 50%;

    border: 6px solid #cfe2ff;

    border-top-color: #3b82f6;

    animation: spin 1s linear infinite
}



@keyframes spin {

    to {

        transform: rotate(360deg)
    }

}



/* ====== Popup Notice ====== */

#popup-notice {

    position: fixed;

    right: 16px;

    bottom: 16px;

    background: #111;

    color: #fff;

    padding: 10px 12px;

    border-radius: 10px;

    opacity: 0;

    transform: translateY(10px);

    transition: .2s;

}



#popup-notice.show {

    opacity: 1;

    transform: none
}



/* ====== Emoji Menü ====== */

#emoji-menu .emoji-item {

    display: inline-block;

    padding: 4px 6px;

    cursor: pointer;

    border-radius: 8px
}



#emoji-menu .emoji-item:hover {

    background: var(--soft)
}



/* ====== Logo ====== */

.app-logo {

    display: block;

    margin: 6px;

    height: 30px;

    width: auto;

    object-fit: contain
}



/* ====== PM Üst Şerit ====== */

#private-user-info {

    gap: 12px;

    padding: 10px 12px;

    background: #68708033
}



.pm-head {

    display: flex;

    align-items: center;

    gap: 12px;

    width: 100%
}



.pm-avatar {

    width: 70px;

    height: 70px;

    border-radius: 50%;

    overflow: hidden;

    display: grid;

    place-items: center;

    background: #e5e7eb;

    color: #111827;

    font-weight: 700;

    box-shadow: 0 0 0 3px #fff, 0 0 0 4px #d1d5db;

}



.pm-avatar img {

    width: 100%;

    height: 100%;

    object-fit: cover;

    display: block
}



.pm-avatar .ini {

    font-size: 14px
}



.pm-actions {

    margin-left: auto;

    display: flex;

    gap: 8px;

    align-items: center
}



.pm-actions .btn {

    padding: 4px 10px
}


.emoji-img {

    height: 1em;

    width: 1em;

    vertical-align: -0.15em
}



/* Toolbar linkleri */

.chat-toolbar .sep {

    display: inline-block;

    padding: 0 6px;

    color: var(--muted);

    opacity: .7;

    user-select: none;

    font-weight: 600
}



.chat-toolbar .alt-link {

    margin-left: 4px;

    padding: 4px 10px;

    border: 1px solid var(--border);

    border-radius: 10px;

    text-decoration: none;

    font-size: 12px;

    line-height: 1.2
}



.chat-toolbar .alt-link:hover {

    background: var(--soft)
}



/* ====== PM Balonları (ince) ====== */

.pm-bubbles .bubble {

    position: relative;

    padding: var(--bubble-vpad, 6px) var(--bubble-hpad, 10px);

    border-radius: 10px;

    font-size: 13px;

    line-height: 1.2;

    max-width: min(72%, 620px);

}



.pm-bubbles .msg-row {

    margin: 4px 0
}



.pm-bubbles .msg-row.me .bubble {

    background: linear-gradient(180deg, #edf4ff 0%, #e3ecff 100%);

    border: 1px solid var(--bubble-me-border);

    box-shadow: 0 8px 18px rgba(11, 87, 208, .18);

}



.pm-bubbles .msg-row.you .bubble {

    background: var(--bubble-you);

    border: 1px solid var(--bubble-you-border);

    box-shadow: 0 8px 16px rgba(2, 12, 27, .08);

}



.pm-bubbles .bubble .time,

.pm-bubbles .bubble .nick {

    font-size: 12px;

    font-weight: 700;

    margin: 0;

    color: #50627a
}



.pm-bubbles .msg-row.me .bubble .time,

.pm-bubbles .msg-row.me .bubble .nick {

    color: #3e63a8
}



.pm-bubbles .bubble .sep,

.pm-bubbles .bubble .text {

    margin: 0
}



.pm-bubbles .bubble .text {

    display: inline;

    white-space: normal;

    word-break: break-word
}



.pm-bubbles .bubble::after {

    content: "";

    position: absolute;

    width: 8px;

    height: 8px;

    top: 8px;

    transform: rotate(45deg)
}



.pm-bubbles .msg-row.me .bubble::after {

    right: -6px;

    background: #e3ecff;

    border-right: 1px solid var(--bubble-me-border);

    border-top: 1px solid var(--bubble-me-border)
}



.pm-bubbles .msg-row.you .bubble::after {

    left: -6px;

    background: #ffffff;

    border-left: 1px solid var(--bubble-you-border);

    border-top: 1px solid var(--bubble-you-border)
}



/* Koyu tema */

body.dark {

    --bubble-me: #223154;

    --bubble-you: #151b27;

    --bubble-me-border: #2b3b66;

    --bubble-you-border: #242b38;

    --col-user: #e6edf6;

    --col-founder: #f59e0b;

    --col-admin: #a78bfa;

    --col-op: #60a5fa;

    --col-halfop: #34d399;

    --col-voice: #7dd3fc;

}



body.dark .pm-bubbles .msg-row.me .bubble {

    background: linear-gradient(180deg, #25395f 0%, #1f2f52 100%);

    box-shadow: 0 8px 20px rgba(0, 0, 0, .35)
}



body.dark .pm-bubbles .msg-row.you .bubble {

    background: var(--bubble-you);

    box-shadow: 0 8px 18px rgba(0, 0, 0, .3)
}



body.dark .pm-bubbles .bubble .time,

body.dark .pm-bubbles .bubble .nick {

    color: #a7b6d9
}



body.dark .pm-bubbles .bubble .sep {

    color: #7e8fb0
}



/* ====== Yardımcılar ====== */

@media (max-width:992px) {

    .app-grid {

        grid-template-columns: 1fr
    }

}



.hidden {

    display: none !important
}



#hearts-layer {

    pointer-events: none;

    position: fixed;

    inset: 0;

    z-index: 9999
}



/* Servis rozetleri */

.svc {

    display: inline-block;

    font-weight: 700;

    padding: 2px 6px;

    border-radius: 8px;

    border: 1px solid transparent;

    line-height: 1
}



.svc-nickserv {

    background: rgba(14, 165, 233, .12);

    color: #0ea5e9;

    border-color: rgba(14, 165, 233, .35)
}



.svc-chanserv {

    background: rgba(124, 58, 237, .12);

    color: #7c3aed;

    border-color: rgba(124, 58, 237, .30)
}



.svc-operserv {

    background: rgba(239, 68, 68, .12);

    color: #ef4444;

    border-color: rgba(239, 68, 68, .30)
}



.svc-memoserv {

    background: rgba(245, 158, 11, .14);

    color: #d97706;

    border-color: rgba(245, 158, 11, .32)
}



.svc-hostserv {

    background: rgba(34, 197, 94, .14);

    color: #16a34a;

    border-color: rgba(34, 197, 94, .30)
}



.svc-global {

    background: rgba(244, 63, 94, .14);

    color: #dc2626;

    border-color: rgba(244, 63, 94, .28)
}



body.dark .svc-nickserv {

    background: rgba(14, 165, 233, .18);

    border-color: rgba(14, 165, 233, .38)
}



body.dark .svc-chanserv {

    background: rgba(124, 58, 237, .18);

    border-color: rgba(124, 58, 237, .38)
}



body.dark .svc-operserv {

    background: rgba(239, 68, 68, .18);

    border-color: rgba(239, 68, 68, .40)
}



body.dark .svc-memoserv {

    background: rgba(245, 158, 11, .20);

    border-color: rgba(245, 158, 11, .42)
}



body.dark .svc-hostserv {

    background: rgba(34, 197, 94, .20);

    border-color: rgba(34, 197, 94, .40)
}



body.dark .svc-global {

    background: rgba(244, 63, 94, .20);

    border-color: rgba(244, 63, 94, .42)
}



/* Komut Paleti */

#modalPalette .modal-content {

    border-radius: 14px;

    box-shadow: var(--shadow)
}



#modalPalette .list-group-item {

    cursor: pointer
}



#modalPalette .list-group-item .hint {

    color: var(--muted);

    font-size: 12px
}



#modalPalette .list-group-item.active {

    background: var(--soft)
}



.modal-backdrop.show {

    background: rgba(10, 17, 30, .55);

    backdrop-filter: blur(4px)
}



.modal {

    z-index: 1060
}



.dropdown,

.tooltip,

.popover {

    z-index: 1070
}



.nice-modal .modal-content {

    border-radius: 16px;

    border: 1px solid rgba(0, 0, 0, .06)
}



.nice-modal .modal-header {

    padding: 14px 18px;

    background: linear-gradient(180deg, rgba(11, 87, 208, .10), rgba(11, 87, 208, .05));

    border-bottom: 1px solid rgba(0, 0, 0, .06)
}



.nice-modal .modal-body {

    padding: 18px 20px;

    font-size: 14.5px;

    line-height: 1.55;

    color: var(--text)
}



.nice-modal .modal-body h6 {

    font-weight: 700;

    margin: 16px 0 8px
}



.nice-modal .modal-body p,

.nice-modal .modal-body ul,

.nice-modal .modal-body ol {

    margin-bottom: 10px
}



.nice-modal .modal-body ul {

    padding-left: 1.1rem
}



.nice-modal .modal-body a {

    word-break: break-word;

    text-decoration: underline
}



@media (min-width:992px) {

    .nice-modal .modal-dialog {

        max-width: 860px
    }

}



body.dark .nice-modal .modal-content {

    background: #0f1420;

    border-color: rgba(255, 255, 255, .06)
}



body.dark .nice-modal .modal-header {

    background: linear-gradient(180deg, rgba(11, 87, 208, .15), rgba(11, 87, 208, .08));

    border-bottom-color: rgba(255, 255, 255, .06)
}



body.modal-open {

    overflow: hidden
}



/* Stickers */

.sticker-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));

    gap: 12px
}



.sticker-item {

    border: 1px solid var(--border);

    background: var(--panel);

    border-radius: 12px;

    padding: 8px;

    cursor: pointer;

    text-align: center;

    transition: transform .08s ease, box-shadow .15s ease
}



.sticker-item:hover {

    transform: translateY(-2px);

    box-shadow: var(--shadow)
}



.sticker-item img {

    width: 100%;

    height: 72px;

    object-fit: contain;

    display: block
}



.msg-sticker {

    display: inline-flex;

    align-items: center;

    justify-content: left;

    max-width: 240px;

    max-height: 240px
}



.msg-sticker img {

    width: 40%;

    height: auto;

    display: block
}



/* ===================== MOBİL DÜZEN (≤576px) ===================== */

@media (max-width: 576px) {

    /* 1. Mavi Radyo Butonunu (Radio Toggle) küçültme */



    /* Eğer butonun kendisi #radio-toggle ise */

    #radio-toggle {

        padding: 8px 10px !important;
        /* Dikey/yatay boşlukları azalt */

        font-size: 14px;
        /* Metin varsa küçült */

        /* Metin varsa ve gizlemek istiyorsanız: */

        /* width: auto; max-width: 70px; gibi bir kısıtlama ekleyebilirsiniz */

    }



    /* Görseldeki "Radyo" metnini kapsayan öğeyi gizle (Örn: span) */

    #radio-toggle span {
        /* Lütfen bu selektörü HTML yapınıza göre kontrol edin */

        display: none;

    }



    /* Ikon boyutu ve butonu sıkıştır */

    #radio-toggle i {

        font-size: 18px;

    }

}

@media (max-width: 576px) {

    /* 2. Tema Butonunu Küçültme (Görüntüdeki Ay Ikonu) */

    .theme-btn-img {

        width: 38px;
        /* 44px'ten 38px'e düşür */

        height: 38px;

        /* Diğer stil kuralları otomatik olarak uygulanacaktır (border-radius, background) */

    }



    /* Üst çubuktaki (topbar) boşluğu da daralt */

    .topbar {

        gap: 4px;
        /* Öğeler arası boşluğu 0'dan 4px'e çıkar (biraz nefes alması için) */

        padding: 4px;
        /* Padding'i 4px'e çıkar */

    }

}

@media (max-width: 576px) {

    /* 3. Logonun Esnekliği */

    .topbar .logo-container {
        /* Logo ve başlığı içeren kapsayıcıyı hedefleyin */

        flex-shrink: 1;
        /* Sıkışmaya izin ver */

        min-width: 0;
        /* Gerekirse minimum genişliği sıfırla */

        overflow: hidden;
        /* Taşma olursa metni kes */

    }



    /* Metin taşarsa (örneğin h1), onu kes */

    .login-brand h1 {

        white-space: nowrap;

        overflow: hidden;

        text-overflow: ellipsis;
        /* Metin taşarsa üç nokta koy */

    }

}







@media (max-width:576px) {



    body,

    #main,

    .app-grid,

    .chat-card {

        overflow-x: hidden !important;

    }

    #main {

        padding: 0;
        /* Dış boşlukları kaldırın */

    }



    /* 0) Mobil tipografi: TEK KAYNAK */

    :root {

        --text-size: 13px;

    }



    /* beden metin */

    #messages {

        font-size: 13.5px;

        line-height: 1.45;

    }



    /* sohbet metni */

    #tabs button {

        font-size: 12.5px;

    }



    .inputbar input {

        font-size: 12px;

    }



    /* iOS zoom fix */



    /* 1) Grid → tek sütun */

    .app-grid {

        grid-template-columns: 1fr !important;

        gap: 10px;

        height: calc(100dvh - var(--topbar-h));

        padding: 8px;

    }



    /* 2) Topbar kompakt */

    .topbar {

        height: 51px;

        padding: 3px;

        gap: 0px;

        /* Yeni Kural: Esnekliği artır, sığmazsa küçülmesine izin ver */

        flex-shrink: 1;
        /* Öğelerin küçülmesine izin ver */

        min-width: 0;
        /* İçeriğin taşmasını engellemek için */

    }



    /* Öğelerin küçülmesine izin ver, minimum genişlik koyma */

    .topbar > * {

        min-width: 0;

        flex-shrink: 1;

    }

}



/* 3) Sekmeler: tek satır, yatay kaydırma */

#tabs {

    gap: 6px;

    padding: 6px 8px;

    max-height: 48px;

    overflow-y: hidden;

    overflow-x: auto;

    white-space: nowrap;

    scrollbar-width: thin;

}



#tabs button {

    padding: .38rem .6rem;

    max-width: none;

    flex: 0 0 auto;

}



/* 4) Mesaj alanı: tam yükseklik */

#messages {

    padding: 12px;


    height: calc(100dvh - var(--topbar-h) - 56px - 10px);

    /* 56: inputbar */

    min-height: 0;

}



/* 5) Input bar sabit + safe area */

.inputbar {

    position: sticky;

    bottom: 0;

    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));

    min-height: 56px;

    gap: 8px;

    border-radius: 0 0 var(--radius) var(--radius);

}



.icon-btn {

    width: 28px;

    height: 28px;

    font-size: 18px;

}



/* 6) PM üst şerit daha ince + avatar taşsın */

#private-user-info {

    padding: 8px 10px 6px 86px;

    min-height: 50px;

}



.pm-avatar {

    position: absolute;

    left: 10px;

    top: 0px;

    width: 50px;

    height: 50px;

}



.pm-head {

    min-height: 32px;

}



/* 7) Sağdan kayan kullanıcı listesi (off-canvas) */

#userlist-sidebar {

    position: fixed;



    right: 0;

    bottom: 0;



    transform: translateX(100%);

    transition: transform .25s ease;

    border-left: 1px solid var(--border);

    border-radius: 0 0 0 0;

    z-index: 1050;

}



body.userlist-open #userlist-sidebar {

    transform: translateX(0);

}



/* Karartma katmanı (opsiyonel) */

.userlist-dim {

    position: fixed;

    inset: 0;

    background: rgba(2, 6, 23, .45);

    backdrop-filter: blur(2px);

    opacity: 0;

    visibility: hidden;

    transition: .2s;

    z-index: 1045;

}



body.userlist-open .userlist-dim {

    opacity: 1;

    visibility: visible;

}



/* 8) Toolbar sadeleştir */

.chat-toolbar {

    padding: 6px;

    gap: 6px;

}



.chat-toolbar .sep,

.chat-toolbar .alt-link {

    display: none;

}

}



/* ===== Alt hızlı menü (opsiyonel) ===== */

@media (max-width:576px) {

    .bottom-quickbar {

        position: fixed;

        left: 0;

        right: 0;

        bottom: 0;

        height: calc(48px + env(safe-area-inset-bottom));

        padding-bottom: env(safe-area-inset-bottom);

        background: var(--panel);

        border-top: 1px solid var(--border);

        display: grid;

        grid-template-columns: repeat(4, 1fr);

        z-index: 1080;

    }



    .bottom-quickbar button {

        background: none;

        border: 0;

        padding: 6px 4px;

        font-size: 18px;

    }



    .inputbar {

        margin-bottom: 48px;

    }



    /* alt menü ile çakışmasın */

}





@media (max-width:576px) {



    /* Sekme şeridi daha sıkı */

    #tabs {

        gap: 4px;

        padding: 4px 6px;

        max-height: 42px;

        border-radius: 0 0 4px 4px;

        /* eskisi 48px idi */

        overflow-y: hidden;

        overflow-x: auto;

        scrollbar-width: thin;

    }



    /* Sekme butonları daha küçük */

    #tabs button {

        font-size: 12px;

        /* eskisi 13–14px */

        padding: .28rem .50rem;

        border-radius: 10px;

        /* daha ince görünüm */

        gap: .35rem;

        flex: 0 0 auto;

        /* shrink yok; yatay kaydır */

    }



    /* Kapat (X) düğmesi ufalt */

    #tabs .close-tab-button {

        font-size: 14px;

        margin-left: 2px;

        padding: 0 .15rem;

        opacity: .8;

    }



    /* Aktif sekmede gölgeyi azalt → daha kompakt */

    #tabs button.active {

        box-shadow: 0 3px 10px rgba(59, 130, 246, .18);

    }

}



/* Mobilde topic ve selamlama gizle (≤576px) */

@media (max-width:576px) {



    #topic-header,

    #greeting-message {

        display: none !important;

    }

}





/* ===== Dark mode: tüm ana token'ları değiştir ===== */

body.dark {

    /* Temel renkler */

    --bg: #0f1420;

    --panel: #0b1220;

    --soft: #121a28;

    --text: #e6edf6;

    --muted: #94a3b8;

    --border: #1f2a3a;

    --shadow: 0 8px 28px rgba(0, 0, 0, .35);

    /* İstersen bir tık koyu bir primary seçebilirsin */

    /* --primary: #3b82f6; (aynen kalabilir) */



    /* Balonlar zaten yukarıda override ediliyor, burada hatırlatma: */

    /* --bubble-me, --bubble-you vs. set edilmiş durumda */

}



/* Mesaj alanının arka planını gerçekten koyulaştır */

body.dark #messages {

    background: linear-gradient(180deg, #0f172a 0%, #0a0f1a 100%) !important;

    background-image: none !important;

    /* açık temadaki filigran/gradienti kapat */

    color: var(--text);

}



/* Kart/çerçeve yüzeyler koyu panellerle uyumlu olsun */

body.dark .chat-card,

body.dark .topbar,

body.dark #userlist-sidebar,

body.dark .dropdown-menu,

body.dark .modal-content {

    background: var(--panel);

    color: var(--text);

    border-color: var(--border);

}



/* Input ve küçük yüzeyler */

body.dark .inputbar,

body.dark .chat-toolbar {

    background: var(--panel);

    border-color: var(--border);

}



body.dark .inputbar input {

    background: #0f1725;

    border-color: var(--border);

    color: var(--text);

}



/* Sekmeler koyu görünüm */

body.dark #tabs {

    background: var(--panel);

    border-color: var(--border);

}



body.dark #tabs button {

    background: var(--soft);

    border-color: var(--border);

    color: var(--text);

}



body.dark #tabs button.active {

    color: #fff;

}



/* Login kartı koyu uyum (giriş ekranı da kararsın) */

body.dark .login-card {

    background: rgba(2, 6, 23, .55);

    border-color: rgba(148, 163, 184, .22);

    box-shadow: 0 20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);

}



/* Alt linkler, ufak bordürlü elemanlar */

body.dark .alt-link {

    border-color: var(--border);

    color: var(--text);

}



.theme-btn-img {

    width: 35px;

    height: 35px;

    border-radius: 60%;

    border: none;

    outline: none;

    background: url('https://gevezex.net/G-Chat/assets/img/tema.jpg') center/60% no-repeat,

        rgba(255, 255, 255, .1);

    backdrop-filter: blur(6px);

    transition: all .3s ease;

    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);

}



.theme-btn-img:hover {

    transform: scale(1.05);

    background-color: rgba(255, 255, 255, .2);

}



body.dark .theme-btn-img {

    background-image: url('https://cdn-icons-png.flaticon.com/512/6714/6714985.png');

}



/* Mobilde tab bar: çok sekme olursa sadece tab alanı dikey scroll olsun */

@media (max-width:576px) {

    #tabs {

        display: flex;

        flex-wrap: wrap;

        /* çoksa 2+ satıra sarılsın */

        gap: 3px;

        padding: 5px 3px;



        max-height: 92px;

        /* görünür yükseklik (2 satır gibi) */

        overflow-y: auto;

        /* sadece tab alanı kayar */

        overflow-x: hidden;

        /* yatay kaydırma yok */

        -webkit-overflow-scrolling: touch;

        /* iOS akıcı scroll */

        background: var(--panel);

        border-bottom: 1px solid var(--border);

    }



    #tabs button {

        flex: 0 0 auto;

        max-width: none;

        font-size: 12.5px;

        padding: .35rem .6rem;

    }

}



/* Varsayılan: mobil buton gizli, desktop görünsün */

#toggle-userlist-mobile {

    display: none;

}



#toggle-userlist {

    display: inline-grid;

}



/* ≤576px: mobil buton görünsün, desktop gizlensin + off-canvas */

@media (max-width:576px) {

    #toggle-userlist-mobile {

        display: inline-grid;

    }



    #toggle-userlist {

        display: none;

    }



    #userlist-sidebar {

        position: fixed;



        right: 0;

        bottom: 0;

        width: min(50vw, 340px);

        transform: translateX(100%);

        transition: transform .25s ease;

        border-left: 1px solid var(--border, #e5e7eb);

        border-radius: 0 0 0 0;

        z-index: 1050;

        background: var(--panel, #fff);

        overflow-y: auto;

        -webkit-overflow-scrolling: touch;

        will-change: transform;

    }



    body.userlist-open #userlist-sidebar {

        transform: none;

    }



    .userlist-dim {

        position: fixed;

        inset: 0;

        background: rgba(2, 6, 23, .45);

        backdrop-filter: blur(2px);

        opacity: 0;

        visibility: hidden;

        transition: .2s;

        z-index: 1045;

    }



    body.userlist-open .userlist-dim {

        opacity: 1;

        visibility: visible;

    }

}



@media (max-width:576px) {

    #toggle-userlist-mobile {

        position: relative;

        z-index: 1101;

        /* sidebar(1050) ve dim(1045)’in üstünde */

        /* istersen küçük bir offset: */

        /* margin: 6px 8px; */

    }

}



/* ===================== MOBİL KULLANICI LİSTESİ GİZLEME MANTIĞI ===================== */

@media (max-width: 576px) {



    /* Varsayılan olarak mobil butonu Topbar içinde görünür yapalım */

    #toggle-userlist-mobile {

        display: block !important;
        /* Mobil butonu görünür yap */

        /* Buton için mobil boyutlandırma (eğer topbar içinde ise) */

        width: 38px;

        height: 38px;

        font-size: 20px;

        border-radius: 60%;

        color: var(--primary);

        background: var(--soft);

        padding: 0;

        cursor: pointer;

    }



    /* 1. Kural: PM (Özel Mesaj) açıkken gizle */

    /* Uygulamanız PM açıldığında body'ye 'pm-open' sınıfını ekliyorsa: */

    body.pm-open #toggle-userlist-mobile {

        display: none !important;

    }



    /* 2. Kural: Status (Durum/Servis Mesajı) açıkken gizle */

    /* Uygulamanız Status açıldığında body'ye 'status-open' sınıfını ekliyorsa: */

    body.status-open #toggle-userlist-mobile {

        display: none !important;

    }



    /* 💡 NOT: Kanal açıkken (body'de bu sınıflar yoksa) butonu göstermeye devam eder. */

}

/* =================================================================================== */


/* =========================================
   Modern Modal Tasarımı (nice-modal)
========================================= */

/* Arka planı biraz daha yumuşat */
.modal-backdrop.show {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.9));
    opacity: 1;
}

/* Temel dialog boyutu ve animasyon */
.modal.fade.nice-modal .modal-dialog {
    margin: 1.5rem auto;
    transform: translateY(12px) scale(.96);
    opacity: 0;
    transition:
        transform 180ms ease-out,
        opacity 180ms ease-out;
}

.modal.show.nice-modal .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* İç kart görünümü */
.nice-modal .modal-content {
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.45);
    overflow: hidden;
}

/* Başlık alanı */
.nice-modal .modal-header {
    border-bottom: none;
    padding: 1rem 1.3rem .4rem;
}

.nice-modal .modal-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .45rem;
}

/* Eğer ikon kullanmak istersen: <span class="modal-title-icon"><i ...> */
.nice-modal .modal-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(59, 130, 246, 0.14);
    color: #2563eb;
}

/* Başlık altı ince açıklama: <div class="modal-subtitle">... */
.nice-modal .modal-subtitle {
    font-size: .78rem;
    color: #6b7280;
    margin-top: .2rem;
}

/* Kapat butonu */
.nice-modal .btn-close {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background-color: rgba(148, 163, 184, 0.18);
    opacity: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nice-modal .btn-close:hover {
    background-color: rgba(148, 163, 184, 0.34);
}

/* İçerik */
.nice-modal .modal-body {
    padding: .6rem 1.3rem 1.1rem;
    font-size: .9rem;
}

/* Scrollable büyük modallar (gizlilik/sözleşme/sticker) daha ferah olsun */
.nice-modal.modal .modal-dialog.modal-lg .modal-body {
    max-height: min(70vh, 600px);
}

/* Form elemanları */
.nice-modal .form-control,
.nice-modal .form-select {
    border-radius: 10px;
    border-color: #e5e7eb;
    font-size: .9rem;
}

.nice-modal .form-control:focus,
.nice-modal .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Checkbox satırları */
.nice-modal .form-check {
    font-size: .88rem;
}

/* Alt kısım */
.nice-modal .modal-footer {
    border-top: none;
    padding: .7rem 1.3rem 1.1rem;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* Butonlar (pill stil) */
.nice-modal .btn-primary,
.nice-modal .btn-secondary,
.nice-modal .btn-info,
.nice-modal .btn-outline-secondary {
    border-radius: 999px;
    padding: .45rem 1.2rem;
    font-size: .84rem;
    font-weight: 500;
}

/* Sticker grid örnek iyileştirme */
.nice-modal .sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: .5rem;
}

.nice-modal .sticker-grid button {
    border: none;
    background: transparent;
    padding: .35rem;
    border-radius: 12px;
    transition: transform 120ms ease-out, background-color 120ms ease-out;
}

.nice-modal .sticker-grid button img {
    display: block;
    width: 36px;
    height: 36px;
    margin: 0 auto;
}

.nice-modal .sticker-grid button:hover {
    background: rgba(148, 163, 184, 0.16);
    transform: translateY(-1px);
}

/* Küçük modallar (sm) */
.nice-modal .modal-dialog.modal-sm .modal-content {
    border-radius: 16px;
}

/* Mobilde boyutlar */
@media (max-width: 576px) {
    .nice-modal .modal-dialog {
        margin: 1rem;
        max-width: 100%;
    }

    .nice-modal .modal-content {
        border-radius: 16px;
    }
}

/* ============================
   Dark tema uyumu
============================ */

body.dark .nice-modal .modal-content {
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
    color: #e5e7eb;
    border-color: rgba(51, 65, 85, 0.9);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.8);
}

body.dark .nice-modal .modal-subtitle {
    color: #9ca3af;
}

body.dark .nice-modal .modal-title-icon {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

body.dark .nice-modal .btn-close {
    background-color: rgba(30, 64, 175, 0.85);
}

body.dark .nice-modal .btn-close:hover {
    background-color: rgba(30, 64, 175, 1);
}

body.dark .nice-modal .form-control,
body.dark .nice-modal .form-select {
    background-color: rgba(15, 23, 42, 0.96);
    border-color: #1f2937;
    color: #e5e7eb;
}

body.dark .nice-modal .form-control::placeholder,
body.dark .nice-modal .form-select::placeholder {
    color: #6b7280;
}

body.dark .nice-modal .sticker-grid button:hover {
    background: rgba(55, 65, 81, 0.7);
}

#userlist .ul-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

#userlist .ul-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

#userlist .ul-name {
    font-size: 13px;
    font-weight: 600;
}

#userlist .ul-role {
    font-size: 11px;
    opacity: .7;
    /* tema değişkenin varsa kullanabilirsin: */
    color: var(--muted, #6b7280);
}

/* Yazıyor... göstergesi */
.typing-indicator {
    flex: 0 0 auto;
    margin-left: 8px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--muted, #6b7280);
    min-width: 80px;
    min-height: 14px;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.typing-indicator.active {
    opacity: 1;
}

/* === Bağlantı koptu overlay'i === */
.disconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .75);
    /* koyu yarı saydam */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.disconnect-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 28px 32px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
}

.disconnect-title {
    font-size: 20px;
    font-weight: 700;
    color: #4c1d95;
    /* mor ton, istersen var(--primary) yap */
    margin-bottom: 8px;
}

.disconnect-text {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 20px;
}

.disconnect-btn {
    display: inline-block;
    min-width: 180px;
    border-radius: 999px;
    font-weight: 600;
}

/* Karanlık tema uyumu */
body.dark .disconnect-card {
    background: var(--panel, #1f2937);
    color: var(--text, #e5e7eb);
}

body.dark .disconnect-text {
    color: var(--muted, #9ca3af);
}

/* ========= FX VIDEO OVERLAY ========= */
#fx-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    /* En üstte dursun */
    pointer-events: none;
    /* Tıklamalar alttaki chatte çalışsın */
    background: transparent;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#fx-overlay.fx-visible {
    opacity: 1;
}

/* Artık kart değil, tüm ekranı kaplayan arka plan efekti */
#fx-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ekranı doldur */
    border-radius: 0;
    box-shadow: none;
    opacity: 0.4;
    /* Biraz şeffaf olsun ki chat okunabilsin */
    filter: blur(1px);
    /* İstersen sil, hafif flu hoş duruyor */
}

/* ===================================== */

/* Varsayılan (tüm ekranlar için küçük dokunuş) */
#channel-sidebar {
    padding: 8px 8px 8px 4px;
}

#channel-sidebar .channel-head {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted, #64748b);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 4px;
}

/* 1) MOBİL / TABLET (≤ 991.98px)
   - Eski davranış: kanallar üstte yatay bar gibi
*/
@media (max-width: 991.98px) {
    .app-grid {
        display: flex;
        flex-direction: column;
    }

    /* Sıra: önce kanallar, sonra sohbet */
    #channel-sidebar {
        order: 1;
        /* YÜKSEKLİK PROBLEMİNİ ÇÖZEN KISIM */
        height: auto;
        /* 100%'ü boz */
        min-height: 0;
        flex: 0 0 auto;
        /* İçeriği kadar yer kaplasın */

        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 0 8px 4px;
        max-height: none;
        margin-left: 0;
        margin-bottom: .5rem;
    }

    .chat-card {
        order: 2;
        flex: 1 1 auto;
        /* kalan tüm alan sohbet alanına */
    }

    #userlist-sidebar {
        order: 3;
    }

    /* Kanallar yatay sekme gibi */
    #channel-sidebar #tabs {
        display: flex;
        flex-direction: row;
        gap: 0px;
        overflow-x: auto;
        white-space: nowrap;
    }

    #channel-sidebar .channel-head {
        display: none;
        /* mobilde başlığı gizleyebilirsin */
    }
}


/* ===================== WEB DÜZEN – USERLIST + KANAL (≥992px) ===================== */
@media (min-width: 992px) {

    /* Ana grid: sohbet + userlist + kanal */
    .app-grid {
        display: flex;
        align-items: stretch;
    }

    /* Sol: sohbet kartı geniş */
    .chat-card {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Orta: kullanıcı listesi */
    #userlist-sidebar {
        order: 2;
        flex: 0 0 240px;
        margin-left: 8px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        position: static !important;
        transform: none !important;
        border-radius: 1px 1px 16px 16px;
        width: 240px;
        border-radius: 16px;
    }

    /* Sağ: kanal listesi – görünüm userlist gibi */
    #channel-sidebar {
        order: 3;
        flex: 0 0 220px;
        margin-left: 8px;
        border-left: 1px solid rgba(148, 163, 184, .35);
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        padding: 8px 8px 8px 4px;
    }

    #channel-sidebar .channel-head {
        font-size: 13px;
        font-weight: 600;
        color: var(--muted, #64748b);
        text-transform: uppercase;
        letter-spacing: .03em;
        margin-bottom: 4px;
    }

    /* Kanallar dikey liste */
    #channel-sidebar #tabs {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch;
        gap: 4px;
    }

    /* Kanal satırı – userlist satırı gibi */
    #channel-sidebar #tabs > * {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        padding: 6px 10px;
        margin: 2px 0;
        border-radius: 8px;
        border: 0;
        background: transparent;
        font-size: 14px;
        text-align: left;
        cursor: pointer;
        color: var(--muted, #64748b);
    }

    /* Aktif kanal */
    #channel-sidebar #tabs > *.active,
    #channel-sidebar #tabs > *[aria-selected="true"] {
        background: var(--soft, #eef3ff);
        color: var(--text, #0f172a);
        box-shadow: 0 0 0 1px rgba(59, 130, 246, .25);
    }
}

/* ===== KANAL LİSTESİNİ USERLIST GİBİ DİKEY YAP (MASAÜSTÜ) ===== */
@media (min-width: 992px) {

    /* Kanal paneli içindeki tabs konteyneri dikey liste olsun */
    #channel-sidebar #tabs {
        display: flex !important;
        flex-direction: column !important;
        /* yan yana değil, alt alta */
        align-items: stretch;
        gap: 4px;
        padding: 8px;
        overflow-y: auto;
        overflow-x: hidden;
        /* yatay scrollbar’ı kaldır */
    }

    /* Her kanal satırı – userlist satırı gibi */
    #channel-sidebar #tabs button {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        margin: 2px 0;
        padding: 6px 8px;

        border: 0;
        border-radius: 8px;
        background: transparent;
        box-shadow: none;

        font-size: 13px;
        color: var(--col-user, #0b1a2b);
        text-align: left;
        white-space: nowrap;
        /* isim uzun olursa da taşmasın */
    }

    /* Aktif kanal – userlist’te seçili satır gibi */
    #channel-sidebar #tabs button.active,
    #channel-sidebar #tabs button[aria-selected="true"] {
        background: var(--soft, #eef3ff);
        color: var(--text, #0f172a);
        box-shadow: 0 0 0 1px rgba(59, 130, 246, .25);
    }
}

/* ===== MASAÜSTÜNDE KANAL LİSTESİNİ USERLIST GİBİ DİKEY VE TAM BOY YAP ===== */
@media (min-width: 992px) {

    /* Kanal kolonunun iç düzeni */
    #channel-sidebar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch;
    }

    /* Başlık sabit, sadece kendi yüksekliği kadar */
    #channel-sidebar .channel-head {
        flex: 0 0 auto;
    }

    /* Kanal listesi tüm kalan yüksekliği kullansın + dikey scroll olsun */
    #channel-sidebar #tabs {
        flex: 1 1 auto;
        min-height: 0;
        padding: 0px;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Her kanal satırı userlist satırı gibi, tam genişlikte olsun */
    #channel-sidebar #tabs > * {
        display: flex !important;
        align-items: center;
        width: 100% !important;
        max-width: none !important;
        margin: 2px 0;
        padding: 6px 8px;

        border-radius: 8px !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent;
        color: var(--col-user, #0b1a2b);
        text-align: left;
        cursor: pointer;
    }

    /* Aktif kanal – userlist’te seçili satır gibi görünsün */
    #channel-sidebar #tabs > *.active,
    #channel-sidebar #tabs > *[aria-selected="true"] {
        background: var(--soft, #eef3ff) !important;
        color: var(--text, #0f172a) !important;
        box-shadow: 0 0 0 1px rgba(59, 130, 246, .25);
    }
}

/* ===== SAĞDAKİ KANAL PANELİ – MASAÜSTÜ (≥992px) ===== */
@media (min-width: 992px) {

    /* Kanal paneli kendi içinde kolon olsun */
    #channel-sidebar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        height: 100%;
    }

    /* Başlık sabit kalsın */
    #channel-sidebar .channel-head {
        flex: 0 0 auto;
        margin-bottom: 4px;
    }

    /* Asıl kanal listesi: tüm boşluğu doldursun + dikey scroll olsun */
    #channel-sidebar #tabs {
        flex: 1 1 auto;
        min-height: 0;
        padding: 8px;

        display: flex !important;
        flex-direction: column !important;
        /* alt alta */
        align-items: stretch;

        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;

        max-height: none !important;
        /* üstteki #tabs ayarını ez */
        white-space: normal;
    }

    /* Her kanal satırı tam genişlikte buton gibi olsun */
    #channel-sidebar #tabs > * {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;

        width: 100% !important;
        max-width: none !important;
        margin: 2px 0;
        padding: 6px 10px;

        border: 0 !important;
        border-radius: 8px !important;
        background: transparent;
        box-shadow: none !important;

        font-size: 13px;
        color: var(--col-user, #0b1a2b);
        text-align: left;
        cursor: pointer;
    }

    /* Aktif kanal vurgusu */
    #channel-sidebar #tabs > *.active,
    #channel-sidebar #tabs > *[aria-selected="true"] {
        background: var(--soft, #eef3ff) !important;
        color: var(--text, #0f172a) !important;
        box-shadow: 0 0 0 1px rgba(59, 130, 246, .25);
    }
}

/* ===== MASAÜSTÜ: KANAL LİSTESİNE MODERN GÖRÜNÜM ===== */
@media (min-width: 992px) {

    /* Panel iç padding + başlık */
    #channel-sidebar {
        padding: 2px 0px 0px;
    }

    #channel-sidebar .channel-head {
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: var(--muted, #64748b);
        margin: 0 0 6px;
    }

    /* Liste tam boy + dikey scroll */
    #channel-sidebar #tabs {
        flex: 1 1 auto;
        min-height: 0;
        padding: 4px;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;
        /*background: #fafafb;*/
    }

    /* Her kanal satırı – “chip” tarzı buton */
    #channel-sidebar #tabs button {
        position: relative;
        display: flex !important;
        align-items: center;
        gap: 8px;

        width: 100% !important;
        max-width: none !important;
        margin: 2px 0;
        padding: 6px 10px 6px 30px;

        /*border-radius: 999px !important;*/
        border: 1px solid transparent !important;
        background: transparent;
        box-shadow: none !important;

        font-size: 13px;
        font-weight: 500;
        color: var(--col-user, #0b1a2b);
        text-align: left;
        cursor: pointer;

        transition:
            background .15s ease,
            border-color .15s ease,
            transform .08s ease;
    }

    /* Sol tarafta küçük ikon balonu (istersen # yaparsın) */
    #channel-sidebar #tabs button::before {
        /*content: "🌐"; /* dilersen "#" yapabilirsin */
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);

        width: 18px;
        height: 18px;
        border-radius: 999px;
        display: grid;
        place-items: center;

        font-size: 11px;
        background: rgba(59, 130, 246, .12);
        color: #2563eb;
    }

    /* Hover efekti */
    #channel-sidebar #tabs button:hover {
        background: rgba(148, 163, 184, .10);
        border-color: rgba(148, 163, 184, .55) !important;
        transform: translateX(1px);
    }

    /* Aktif kanal */
    #channel-sidebar #tabs button.active,
    #channel-sidebar #tabs button[aria-selected="true"] {
        background: var(--soft, #eef3ff) !important;
        border-color: rgba(59, 130, 246, .55) !important;
        color: var(--text, #0f172a) !important;
        box-shadow: 0 0 0 1px rgba(59, 130, 246, .30);
    }

    /* Sağdaki kırmızı X (close-tab-button) daha şık dursun */
    #channel-sidebar #tabs button .close-tab-button {
        margin-left: auto;
        padding-left: 6px;
        font-size: 13px;
        opacity: .5;
        transition:
            opacity .15s ease,
            transform .08s ease,
            color .15s ease;
    }

    #channel-sidebar #tabs button .close-tab-button:hover {
        opacity: 1;
        color: #ef4444;
        transform: scale(1.12);
    }
}

/* ===== KANALDA YENİ MESAJ VURGUSU (MASAÜSTÜ) ===== */
@keyframes channelPing {
    0% {
        transform: translateX(0);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, .65);
    }

    60% {
        transform: translateX(1px);
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
    }

    100% {
        transform: translateX(0);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

@media (min-width: 992px) {

    /* Aktif olmayan kanalda yeni mesaj varsa vursun / nabız atsın */
    #channel-sidebar #tabs button.new-message:not(.active):not([aria-selected="true"]) {
        background: rgba(59, 130, 246, .10) !important;
        border-color: rgba(59, 130, 246, .80) !important;
        color: var(--text, #0f172a) !important;
        animation: channelPing 1.2s ease-out infinite;
    }

    /* Küçük mavi nokta da olsun istersen */
    #channel-sidebar #tabs button.new-message:not(.active)::after {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 999px;
        background: #3b82f6;
        margin-left: 6px;
        flex: 0 0 auto;
    }
}

@media (min-width: 992px) {
    #channel-sidebar #tabs .close-tab-button {
        margin-left: auto;
        padding-left: 6px;
        font-size: 14px;
        /* istersen 12–13 yap */
    }
}

/* ================== MOBİL KANAL GÖRÜNÜMÜNÜ ESKİ HALİNE ÇEVİR ================== */
@media (max-width: 991.98px) {

    /* Kanal panelini ayrı bir kutu gibi değil, üstteki tab bar gibi göster */
    #channel-sidebar {
        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 0 8px 4px;
        max-height: none;
        margin-left: 0;
    }

    /* "KANALLAR" başlığını mobilde gizle */
    #channel-sidebar .channel-head {
        display: none !important;
    }

    /* Kanallar yatay şerit olsun (eski #tabs davranışı) */
    #channel-sidebar #tabs {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 6px;
        padding: 6px 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: thin;
    }

    /* Her kanal pill gibi dursun */
    #channel-sidebar #tabs > * {
        flex: 0 0 auto;
        border-radius: 999px !important;
        margin: 0;
    }

    /* Mobilde X sağa yapışmasın, normal dursun */
    #channel-sidebar #tabs .close-tab-button {
        margin-left: 4px;
        /* auto değil */
    }
}

/* Varsayılan: hepsi serbest (desktop/mobil kendi @media kuralların çalışıyor) */

/* Status veya PM sekmesi açıksa userlist butonlarını gizle */
body.mode-status #toggle-userlist,
body.mode-status #toggle-userlist-mobile,
body.mode-pm #toggle-userlist,
body.mode-pm #toggle-userlist-mobile {
    display: none !important;
}

/* Kanal sekmesindeyken userlist butonları aktif olsun */
body.mode-channel #toggle-userlist {
    display: inline-grid;
    /* senin desktop için kullandığın display neyse */
}

/* Mobilde de yalnız kanal açıkken görünsün */
@media (max-width:576px) {
    body.mode-channel #toggle-userlist-mobile {
        display: block !important;
    }
}

/* ===== Kullanıcı Aksiyon Menüsü ===== */

.user-action-menu {
    position: absolute;
    min-width: 180px;
    background: var(--panel, #fff);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .20);
    border: 1px solid rgba(148, 163, 184, .35);
    z-index: 2500;
    padding: 6px 0;
    font-size: 13px;
    max-height: 70vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: absolute;
    z-index: 9999;
    scrollbar-width: thin;
}

/* Chrome ve Safari için ince kaydırma çubuğu tasarımı */
.user-action-menu::-webkit-scrollbar {
    width: 6px;
}
.user-action-menu::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 10px;
}

.user-action-menu.hidden {
    display: none;
}

.user-action-menu .uam-header {
    padding: 6px 10px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted, #6b7280);
    border-bottom: 1px solid rgba(148, 163, 184, .2);
}

.user-action-menu #uam-nick {
    font-weight: 700;
    text-transform: none;
}

.user-action-menu .uam-item {
    width: 100%;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text, #0f172a);
}

.user-action-menu .uam-item i {
    font-size: 15px;
}

.user-action-menu .uam-item:hover {
    background: var(--soft, #eef3ff);
}

.user-action-menu .uam-sep {
    margin: 4px 0;
    border-top: 1px solid rgba(148, 163, 184, .25);
}

/* Dark uyumu */
body.dark .user-action-menu {
    background: var(--panel, #0b1220);
    border-color: var(--border, #1f2937);
}

body.dark .user-action-menu .uam-item:hover {
    background: rgba(31, 41, 55, .9);
}

/* 992px ve üzeri ekranlar için genel sekme kapatma butonu */
@media (min-width: 992px) {
    #tabs button .close-tab-button {
        /* Bu seçici, 'ID > Etiket > Sınıf' özgüllüğüne sahiptir ve çok güçlüdür. */
        margin-left: auto !important;
    }
}

/* ==== H-CHAT LIGHT THEME – RENK GÜNCELLEME ==== */
:root {
    /* Font değişkenlerini istersen aynen koru */
    --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, sans-serif;
    --font-jakarta: "Plus Jakarta Sans", var(--font-sans);
    --font-lexend: "Lexend", var(--font-sans);

    --text-size: 15px;
    --text-leading: 1.45;
    --text-track: .1px;

    /* ANA RENKLER */
    --bg: #e9f1ff;
    /* sayfa zemini */
    --panel: #ffffff;
    /* kartlar, topbar, yan paneller */
    --soft: #edf3ff;
    /* yumuşak doldurma alanları */
    --card: #ffffff;

    --text: #0b1220;
    --muted: #6b7280;
    --primary: #2563eb;
    /* ana mavi */
    --border: rgba(148, 163, 184, .45);
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);

    --radius: 18px;
    --topbar-h: 56px;
    --inputbar-h: 56px;

    /* Bubble renkleri (PM) */
    --bubble-me: #e7f0ff;
    --bubble-you: #ffffff;
    --bubble-me-border: #bfd3ff;
    --bubble-you-border: #e2e8f0;

    /* Userlist renkleri aynı kalabilir ama hafif parlattım */
    --col-founder: #d97706;
    --col-admin: #7c3aed;
    --col-op: #2563eb;
    --col-halfop: #059669;
    --col-voice: #0ea5e9;
    --col-user: #0b1a2b;
}

/* Sayfa zemini – çok hafif gradient */
body {
    background:
        radial-gradient(1100px 600px at 10% -10%, rgba(129, 140, 248, .16), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(45, 212, 191, .14), transparent 60%),
        linear-gradient(180deg, #f4f7ff 0%, #e9f1ff 40%, #f5f7ff 100%);
    color: var(--text);
    font-family: var(--font-sans);
}

/* Topbar hafif cam efekti */
.topbar {
    /*background: rgba(250 250 251);*/
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
    backdrop-filter: blur(10px);
}

/* Ana sohbet kartı + yan paneller aynı stile girsin */
.chat-card,
#userlist-sidebar,
#channel-sidebar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Input bar ve toolbar uyumlu olsun */
.chat-toolbar,
.inputbar {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(148, 163, 184, .25);
}

/* Alt hızlı menü varsa onun da panel rengi */
.bottom-quickbar {
    background: rgba(255, 255, 255, .98);
    border-top: 1px solid var(--border);
}

/* Üst sekmeler */
#tabs button {
    background: var(--soft);
    border-color: transparent;
    color: var(--text);
}

#tabs button.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
}

/* Küçük ikon butonlar (emoji, userlist vs.) */
.icon-btn {
    background: rgba(248, 250, 252, .9);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .35);
}

.icon-btn:hover {
    background: #e5edff;
}

/* Aktif ikon */
.icon-btn.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-color: transparent;
}

/* ==== DARK THEME RENKLER ==== */
body.dark {
    --bg: #020617;
    --panel: #020617;
    --soft: #0b1120;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1e293b;
    --shadow: 0 18px 48px rgba(0, 0, 0, .8);
    --primary: #60a5fa;

    --bubble-me: #1d2a4a;
    --bubble-you: #020617;
    --bubble-me-border: #2c3e72;
    --bubble-you-border: #111827;
}

/* Dark arka plan */
body.dark {
    background:
        radial-gradient(1200px 700px at 0% 0%, rgba(37, 99, 235, .22), transparent 60%),
        radial-gradient(1000px 600px at 100% 100%, rgba(45, 212, 191, .18), transparent 60%),
        linear-gradient(180deg, #020617 0%, #020617 100%);
}

/* Dark topbar & kartlar */
body.dark .topbar,
body.dark .chat-card,
body.dark #userlist-sidebar,
body.dark #channel-sidebar {
    background: rgba(15, 23, 42, .92);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .65);
    backdrop-filter: blur(6px);
}

/* Dark input & toolbar */
body.dark .chat-toolbar,
body.dark .inputbar {
    background: #020617;
    border-color: var(--border);
}

/* Dark sekmeler */
body.dark #tabs button {
    background: #020617;
    border-color: transparent;
    color: var(--muted);
}

body.dark #tabs button.active {
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #f9fafb;
}

.message-line.topic {
    background: rgba(255, 255, 255, .65);
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

#messages {
    opacity: .94;
    /* çok hafif şeffaflık */
}

/* ==== DARK TEMA: TOOLBAR ICON DÜZELTME ==== */

body.dark .chat-toolbar {
    background: #020617;
    /* alt bar koyu */
    border-top: 1px solid #1e293b;
}

/* Icon butonların kendisi */
body.dark .icon-btn {
    background: #0b1220;
    /* koyu lacivert */
    color: #e5e7eb;
    /* açık gri ikon rengi */
    border: 1px solid #1f2937;
    /* ince koyu kenar */
    box-shadow: 0 2px 6px rgba(0, 0, 0, .55);
}

/* Icon’un kendisi buton rengini kullansın */
body.dark .icon-btn i {
    color: inherit;
}

/* Hover efekti */
body.dark .icon-btn:hover {
    background: #111827;
    border-color: #334155;
}


/* ===== TOOLBAR – MODERN PREMIUM STİL ===== */

/* Genel (light + dark ortak baz) */
.chat-toolbar {
    padding: 6px 10px;
    gap: 6px;
    border-top: 1px solid rgba(15, 23, 42, .08);
    background: rgba(15, 23, 42, 0.02);
    backdrop-filter: blur(8px);
    background: var(--panel) !important; /* Panel rengini zorla alsın */
    backdrop-filter: none !important;     /* Blur efektini kaldır */
}

/* Varsayılan icon buton */
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .30);
    background: radial-gradient(circle at 30% 0%, rgba(255, 255, 255, .6), rgba(255, 255, 255, .2));
    box-shadow:
        0 10px 25px rgba(15, 23, 42, .18),
        inset 0 0 0 0 rgba(255, 255, 255, .4);
    display: grid;
    place-items: center;
    color: #0f172a;
    transition:
        background .16s ease,
        border-color .16s ease,
        box-shadow .16s ease,
        transform .08s ease;
}

.icon-btn i {
    font-size: 16px;
    line-height: 1;
}

/* Hover/active */
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, .25),
        inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow:
        0 6px 18px rgba(15, 23, 42, .22),
        inset 0 0 0 1px rgba(255, 255, 255, .4);
}

/* Aktif durumda (örn. emoji açık, radyo açık vs.) */
.icon-btn.active {
    border-color: rgba(59, 130, 246, .9);
    background: radial-gradient(circle at 30% 0%, rgba(59, 130, 246, .6), rgba(37, 99, 235, .35));
    color: #eff6ff;
}

/* ===== DARK MODE VARYASYONU ===== */

body.dark .chat-toolbar {
    background: linear-gradient(180deg, #020617 0%, #020617 45%, #020617 100%);
    border-top: 1px solid #020617;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, .8);
}

body.dark .icon-btn {
    border-color: rgba(15, 23, 42, .9);
    background:
        radial-gradient(circle at 20% 0%, rgba(148, 163, 184, .28), transparent 55%),
        radial-gradient(circle at 80% 120%, rgba(56, 189, 248, .18), rgba(15, 23, 42, .95));
    color: #e5e7eb;
    box-shadow:
        0 12px 30px rgba(0, 0, 0, .80),
        inset 0 0 0 0 rgba(148, 163, 184, .3);
}

body.dark .icon-btn:hover {
    box-shadow:
        0 16px 40px rgba(0, 0, 0, .9),
        0 0 0 1px rgba(59, 130, 246, .55);
    border-color: rgba(59, 130, 246, .85);
}

body.dark .icon-btn.active {
    background:
        radial-gradient(circle at 15% 0%, rgba(59, 130, 246, .75), transparent 55%),
        radial-gradient(circle at 80% 120%, rgba(56, 189, 248, .35), #020617);
    border-color: rgba(96, 165, 250, 1);
    color: #dbeafe;
}

/* ===== LIGHT TEMA – PREMIUM ICON BUTTON ===== */

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;

    background:
        radial-gradient(circle at 30% 0%, rgba(255, 255, 255, .85), rgba(255, 255, 255, .55)),
        linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(240, 244, 255, .7));
    border: 1px solid rgba(148, 163, 184, .35);

    box-shadow:
        0 6px 16px rgba(15, 23, 42, .15),
        inset 0 0 0 0 rgba(255, 255, 255, .4);

    backdrop-filter: blur(6px);
    color: #1e293b;
    /* ikon daha görünür */
    transition: .15s ease;
}

.icon-btn i {
    font-size: 15px;
    color: inherit;
}

/* Hover */
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(15, 23, 42, .22),
        inset 0 0 0 1px rgba(255, 255, 255, .7);
    border-color: rgba(148, 163, 184, .55);
    background:
        radial-gradient(circle at 30% 0%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .65)),
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(235, 240, 255, .75));
}

/* Aktif icon (emoji açık, ayarlar açık vs.) */
.icon-btn.active {
    background:
        radial-gradient(circle at 20% 0%, rgba(59, 130, 246, .8), rgba(59, 130, 246, .45)),
        linear-gradient(180deg, rgba(59, 130, 246, .95), rgba(96, 165, 250, .65));
    border-color: rgba(59, 130, 246, .9);
    color: #f0f6ff;
    box-shadow:
        0 12px 26px rgba(59, 130, 246, .38),
        inset 0 0 0 1px rgba(255, 255, 255, .25);
}

#channel-sidebar {
    background: rgba(255, 255, 255, .75);
    backdrop-filter: blur(12px);
    border-radius: 5px 5px 18px 18px;
    border: 1px solid rgba(148, 163, 184, .28);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .10);
}

/* =========================================
   Mobil Üst Sekme Switcher
========================================= */

.mobile-top-switcher {
    display: none;
    /* sadece mobilde açılacak */
    padding: 4px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.mts-btn {
    flex: 1;
    border: none;
    outline: none;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}

.mts-btn i {
    font-size: 14px;
}

.mts-btn-current {
    background: rgba(59, 130, 246, .08);
    /* primary-soft */
    color: var(--primary);
    font-weight: 600;
}

/* Liste paneli */

.mobile-list-panel {
    display: none;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
    overflow-y: auto;
    font-size: 13px;
    -webkit-overflow-scrolling: touch;
}

.mobile-list-panel.open {
    display: block;
}

.mobile-list-panel ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.mobile-list-panel li {
    padding: 6px 12px;
    cursor: pointer;
}

.mobile-list-panel li:hover {
    background: var(--soft);
}

.mobile-list-panel li.active {
    font-weight: 600;
}

.mobile-list-panel .mlp-empty {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--muted);
}

/* Sadece mobilde göster */
@media (max-width: 768px) {
    .mobile-top-switcher {
        display: flex;
    }
}

/* ================================
   MOBİL ÜST MENÜ (Kanallar / Aktif / Özeller)
   + Liste paneli + scroll + X kapatma
================================== */

.mobile-top-switcher {
    display: none;
}

.mobile-top-switcher .mts-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 4px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--soft, #eef3ff);
    color: var(--text, #0f172a);
    border-radius: 12px;
    font-weight: 500;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.mobile-top-switcher .mts-btn i {
    font-size: 18px;
}

.mobile-top-switcher .mts-btn-current {
    background: var(--primary, #3b82f6);
    color: #fff;
    border-color: transparent;
}

.mobile-list-panel {
    display: none;
    margin-top: 6px;
    border-radius: 12px;
    background: var(--panel, #fff);
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: var(--shadow, 0 6px 20px rgba(0, 0, 0, .08));
    max-height: 45vh;
    /* çok tab olunca scroll */
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mobile-list-panel.open {
    display: block;
}

.mobile-list-panel .mlp-list {
    list-style: none;
    padding: 6px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-list-panel .mlp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    background: transparent;
}

.mobile-list-panel .mlp-item:hover {
    background: var(--soft, #eef3ff);
}

.mobile-list-panel .mlp-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 28px);
    font-size: 14px;
}

.mobile-list-panel .mlp-close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #ef4444;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}

.mobile-list-panel .mlp-empty {
    padding: 8px 10px;
    font-size: 12px;
    opacity: .7;
}

@media (max-width:576px) {
    .mobile-top-switcher {
        display: flex;
        gap: 8px;
        padding: 5px;
        margin: 0px 0 0;
        background: var(--panel, #fff);
        border: 1px solid var(--border, #e5e7eb);
        border-radius: 0px;
    }

    /* MOBİLDE ESKİ TAB BAR (SAĞ SİDEBAR) GİZLENSİN */
    #channel-sidebar {
        display: none !important;
    }
}

/* =========================
   PM BUBBLE HİZALAMA (sağ/sol)
   ========================= */
.pm-bubbles .msg-row {
    display: flex;
    width: 100%;
    margin: 6px 0;
}

.pm-bubbles .msg-row.me {
    justify-content: flex-end;
    /* benim mesajım sağda */
}

.pm-bubbles .msg-row.you {
    justify-content: flex-start;
    /* karşı taraf solda */
}

/* balon yazıya göre büyüsün, full-width olmasın */
.pm-bubbles .msg-row .bubble {
    display: inline-block;
    width: fit-content;
    max-width: min(78%, 620px);
    word-break: break-word;
}

/* =========================
   PM BUBBLE HİZALAMA (sağ/sol)
   ========================= */
.pm-bubbles .msg-row {
    display: flex;
    width: 100%;
    margin: 6px 0;
}

.pm-bubbles .msg-row.me {
    justify-content: flex-end;
    /* benim mesajım sağda */
}

.pm-bubbles .msg-row.you {
    justify-content: flex-start;
    /* karşı taraf solda */
}

/* balon yazıya göre büyüsün, full-width olmasın */
.pm-bubbles .msg-row .bubble {
    display: inline-block;
    width: fit-content;
    max-width: min(78%, 620px);
    word-break: break-word;
}

/* =========================
   PM ÜST AKSİYON BUTONLARI - MOBİL KÜÇÜLT
   ========================= */
@media (max-width: 576px) {
    .pm-actions {
        gap: 4px;
        flex-wrap: wrap;
        /* dar ekranda alt satıra geçsin */
    }

    .pm-actions .btn {
        padding: 2px 6px !important;
        font-size: 12px !important;
        line-height: 1.1;
        border-radius: 8px;
    }

    .pm-actions .btn i {
        font-size: 14px;
        margin-right: 4px;
    }
}
#popup-notice{
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  background: rgba(15, 23, 42, .95);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(-10px) scale(.98);
  pointer-events: none;
  transition: all .25s ease;
}

#popup-notice.show{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* küçük “pop” efekti */
#popup-notice.show{
  animation: popIn .25s ease;
}
@keyframes popIn{
  from{ opacity:0; transform: translateY(-12px) scale(.95); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

/* zel balk grnrken: sadece zel mesaj alann esnet */
@media (max-width: 576px) {
  /* #private-user-info zel balk; ~ ile sonraki karde .chat-main iindeki .pm-bubbles hedeflenir */
  .chat-card #private-user-info ~ .chat-main .chat-content #messages.pm-bubbles {
    flex: 1 1 auto !important;
    min-height: 0 !important;                 /* altta taklmay kesin zer */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: auto !important;                  /* inline height varsa kr */
    max-height: none !important;
    padding-bottom: 10px !important;          /* son satr kesilmesin */
    scroll-padding-bottom: 60px !important;   /* input bar yksekliini telafi et */
  }

  /* Parentlar tamay engellemesinsadece zel akken */
  .chat-card #private-user-info ~ .chat-main {
    min-height: 0 !important;
  }
  .chat-card #private-user-info ~ .chat-main .chat-content {
    min-height: 0 !important;
  }

  /* zel st bilgi ve input bar sabit; ierik esnesin */
  #private-user-info,
  .mobile-top-switcher,
  .inputbar {
    flex-shrink: 0 !important;
  }
}


/* Senin mesajn (me) */
.pm-bubbles .msg-row.me .bubble {
  background-color: #ff69b4 !important;   /* pembe */
  color: #00008b !important;              /* koyu mavi yaz */
  border-radius: 12px !important;
  padding: 8px 12px !important;
  display: inline-block !important;
  max-width: 90% !important;
  word-break: break-word !important;
  font-weight: 500;
}

/* Kar tarafn mesaj (you) */
.pm-bubbles .msg-row.you .bubble {
  background-color: #f2b0c2 !important;   /* yeil */
  color: #111 !important;                 /* siyah yaz */
  border-radius: 12px !important;
  padding: 8px 12px !important;
  display: inline-block !important;
  max-width: 90% !important;
  word-break: break-word !important;
}


/* =========================
   Mini Toast (Hook bildirimleri)
========================= */
:root {
  --toast-bg: #0f172a;          /* koyu zemin */
  --toast-text: #f8fafc;
  --toast-border: rgba(255,255,255,.08);
  --toast-shadow: 0 8px 24px rgba(0,0,0,.18);

  --toast-success: #22c55e;
  --toast-error:   #ef4444;
  --toast-info:    #3b82f6;
  --toast-warn:    #f59e0b;
}

body.dark {
  --toast-bg: #0b1220;
  --toast-text: #e5e7eb;
  --toast-border: rgba(255,255,255,.06);
  --toast-shadow: 0 10px 28px rgba(0,0,0,.35);
}

.toast-stack{
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast{
  pointer-events: auto;
  width: auto;
  max-width: 260px;     /* küçük */
  min-width: 180px;
  padding: 8px 10px;    /* küçük */
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--toast-text);
  border: 1px solid var(--toast-border);
  box-shadow: var(--toast-shadow);
  font-size: 13px;      /* küçük font */
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  animation: toast-in .18s ease-out forwards;
}

.toast .t-ico{
  width: 18px; height: 18px;
  display:flex; align-items:center; justify-content:center;
  font-size: 14px;
}

.toast.success{ border-left: 3px solid var(--toast-success); }
.toast.error  { border-left: 3px solid var(--toast-error); }
.toast.info   { border-left: 3px solid var(--toast-info); }
.toast.warn   { border-left: 3px solid var(--toast-warn); }

.toast .t-msg{
  flex: 1;
  word-break: break-word;
}

.toast .t-close{
  background: transparent;
  border: 0;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.toast .t-close:hover{ opacity: 1; }

@keyframes toast-in{
  to { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toast-out{
  to { opacity:0; transform: translateY(-6px) scale(.98); }
}


/* ===== TOAST MINI OVERRIDE (en alta ekle) ===== */
.toast-stack{
  top: 8px !important;
  right: 8px !important;
  gap: 4px !important;
}

.toast{
  max-width: 210px !important;   /* daha dar */
  min-width: 0 !important;       /* min genişliği kaldır */
  padding: 6px 8px !important;   /* daha küçük */
  border-radius: 8px !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  gap: 6px !important;
}

.toast .t-ico{
  width: 14px !important;
  height: 14px !important;
  font-size: 12px !important;    /* ikon küçülsün */
}

.toast .t-close{
  font-size: 14px !important;
  padding: 0 1px !important;
}

/* Mobilde daha da minik */
@media (max-width:576px){
  .toast{
    max-width: 180px !important;
    padding: 5px 7px !important;
    font-size: 11.5px !important;
  }
  .toast .t-ico{
    width: 12px !important;
    height: 12px !important;
    font-size: 11px !important;
  }
}


/* ===== POPUP NOTICE MINI OVERRIDE (en alta) ===== */
#popup-notice{
  position: fixed;
  top: 10px !important;
  right: 10px !important;
  z-index: 99999;

  /* boyut */
  padding: 6px 8px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;

  /* daha mini görünüm */
  max-width: 220px !important;
  min-width: 0 !important;

  /* renk/doku */
  background: rgba(15, 23, 42, .90) !important;  /* koyu ama yumuşak */
  color: #f8fafc !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,.20) !important;

  /* animasyon başlangıcı */
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  pointer-events: none;
  transition: all .22s ease !important;
}

#popup-notice.show{
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: popInMini .22s ease;
}

@keyframes popInMini{
  from{ opacity:0; transform: translateY(-8px) scale(.96); }
  to  { opacity:1; transform: translateY(0) scale(1); }
}

/* Mobilde daha da küçük */
@media (max-width:576px){
  #popup-notice{
    top: 8px !important;
    right: 8px !important;
    padding: 5px 7px !important;
    font-size: 11.5px !important;
    max-width: 180px !important;
    border-radius: 8px !important;
  }
}
/* =========================
   POPUP NOTICE (küçük + tek konum)
   ========================= */
#popup-notice{
  position: fixed;
  right: 12px;
  bottom: 12px;

  /* ÜSTTEN gelen eski top kuralını öldür */
  top: auto !important;
  left: auto !important;

  z-index: 99999;
  width: fit-content;
  max-width: 220px;

  background: rgba(15, 23, 42, .92);
  color: #fff;

  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.25;

  box-shadow: 0 8px 20px rgba(0,0,0,.22);
  opacity: 0;
  transform: translateY(8px) scale(.98);   /* alttan çıkış hissi */
  pointer-events: none;
  transition: all .2s ease;
}

#popup-notice.show{
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: popIn .2s ease;
}

@keyframes popIn{
  from{ opacity:0; transform: translateY(10px) scale(.96); }
  to  { opacity:1; transform: translateY(0) scale(1); }
}

.topic-line{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  margin:6px 0;
  background: var(--soft, #eef3ff);
  border-left:3px solid var(--primary, #3b82f6);
  border-radius:8px;
  font-weight:600;
}
.topic-line .topic-label{ opacity:.7; }
.topic-line .topic-text{
  font-weight:500;
  word-break:break-word;
}

.topic-meta{
  margin:-2px 0 6px 22px;
  font-size:12px;
  opacity:.7;
}
.topic-box{
  background: var(--soft, #eef3ff);
  border: 1px solid var(--border, #e5e7eb);
  padding: 6px 12px;
  border-radius: 0px 0px 15px 15px;
  margin: 0px 0 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.topic-box-title{
  display:flex; align-items:center; gap:8px;
  font-weight:700; margin-bottom:6px;
}
.topic-box-text{
  font-size: 14px;
  line-height:1.45;
  word-break: break-word;
}
.topic-box-meta{
  margin-top:6px;
  font-size:12px;
  color: var(--muted, #6b7280);
  display:flex; align-items:center; gap:6px;
}

/* ===== HCHAT logo ste gelsin ===== */
#messages {
  /* Masastnde logo + desen + zemin */
  background-image:
    url("/G-Chat/assets/icons/HCHAT.png"), /* logo */
    url("/G-Chat/assets/icons/arka.png"),  /* desen */
    linear-gradient(180deg, #f7faff 0%, #ffffff 100%); /* zemin */

  background-repeat: no-repeat, repeat, no-repeat;
  background-position: right 24px top 16px, center center, center top;
  background-size: 120px auto, 420px auto, cover;
  background-attachment: scroll;
}

/* Mobilde logoyu gizle */
@media (max-width: 768px) {
  #messages {
    background-image:
      url("/G-Chat/assets/icons/arka.png"),  /* sadece desen */
      linear-gradient(180deg, #f7faff 0%, #ffffff 100%); /* zemin */
    background-repeat: repeat, no-repeat;
    background-position: center center, center top;
    background-size: 280px auto, cover;
    padding-right: 16px; /* logoya ayrlan boluu kaldr */
  }
}

/* Dark mode’da da logo görünsün istiyorsan */
body.dark #messages{
  background-image:
    url("/G-Chat/assets/icons/HCHAT.png"),
    url("/G-Chat/assets/icons/arka.png"),
    linear-gradient(180deg, #0f172a 0%, #0a0f1a 100%) !important;

  background-repeat: no-repeat, repeat, no-repeat !important;
  background-position: right 24px top 16px, center center, center top !important;
  background-size: 110px auto, 420px auto, cover !important;
  opacity: 1 !important;
}
body.dark #messages{
  /* darkta biraz daha silik olsun */
  background-blend-mode: normal !important;
}
body.dark #messages{
  /* logoya hafif solukluk */
  filter: none !important;
}
body.dark #messages{
  /* sadece logonun opaklığını düşürmek için */
}
body.dark #messages{
  /* logoyu karartmak istersen */
}
#topic-header,
.topic-box{
  padding-right: 140px;
}
/* Nick renkleri */
.nick-colored{
  font-weight: 700;
}

/* ================================
   NICE BOOTSTRAP MODAL THEME
================================== */

.modal.nice-modal .modal-dialog{
  max-width: 560px;
  margin: 1.2rem auto;
}

.modal.nice-modal .modal-content{
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 18px 55px rgba(0,0,0,.28);
}

body.dark .modal.nice-modal .modal-content{
  background: #0f172a;
  color: #e5e7eb;
}

.modal.nice-modal .modal-header{
  border: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg,
    rgba(59,130,246,.18),
    rgba(16,185,129,.12)
  );
}
body.dark .modal.nice-modal .modal-header{
  background: linear-gradient(135deg,
    rgba(59,130,246,.22),
    rgba(16,185,129,.18)
  );
}

.modal.nice-modal .modal-title{
  font-weight: 800;
  letter-spacing: .2px;
  display:flex; align-items:center; gap:8px;
}

.modal.nice-modal .btn-close{
  filter: none;
  opacity: .8;
  border-radius: 10px;
  padding: 8px;
}
.modal.nice-modal .btn-close:hover{ opacity: 1; }

.modal.nice-modal .modal-body{
  padding: 14px;
  max-height: 70vh;
  overflow: auto;
}

.modal.nice-modal .modal-footer{
  border: 0;
  padding: 10px 14px 14px;
  gap: 8px;
  display:flex;
  justify-content:flex-end;
}

/* Mobilde bottom-sheet gibi aç */
@media (max-width: 576px){
  .modal.nice-modal .modal-dialog{
    margin: 0;
    position: fixed;
    left:0; right:0; bottom:0;
    max-width: 100%;
    transform: translateY(100%);
    transition: .2s ease;
  }
  .modal.show.nice-modal .modal-dialog{
    transform: translateY(0);
  }
  .modal.nice-modal .modal-content{
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}
/* ==== PANEL KÖŞE + SİLİK UÇ EFEKTİ (en sona) ==== */
#userlist-sidebar,
#channel-sidebar,
.chat-card {
  border-radius: 0px 0px 15px 15px !important;

  box-shadow:
    0 0 0 1px rgba(15, 23, 42, .06),   /* o silik dış hat */
    0 8px 22px rgba(15, 23, 42, .06) !important;  /* derinlik */

  overflow: hidden;
}

/* Dark modda hat biraz farklı dursun */
body.dark #userlist-sidebar,
body.dark #channel-sidebar,
body.dark .chat-card {
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 10px 26px rgba(0,0,0,.55) !important;
}


#userlist-sidebar{
  min-height: 0 !important;
}

#userlist{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;   /* <-- scroll burada */
  overflow-x: hidden !important;
  scrollbar-gutter: stable;
}


@media (min-width:992px){
  #userlist-sidebar{
    overflow: hidden !important;
  }
}
/* =======================================================
   1) MOBİL TOPIC BOX KÜÇÜLTME + CLAMP
======================================================= */
@media (max-width:576px){

  /* Topic alanı daha ince görünsün */
  #topic-header,
  .topic-box{
    padding: 6px 8px !important;
    margin: 4px 0 8px !important;
    border-radius: 0 0 12px 12px !important;
    padding-right: 12px !important; /* logodan dolayı verdiğin 140px'i mobilde iptal */
  }

  .topic-box-title{
    font-size: 12px !important;
    font-weight: 700 !important;
    margin-bottom: 4px !important;
    gap: 6px !important;
  }

  .topic-box-text{
    font-size: 12.5px !important;
    line-height: 1.35 !important;

    /* Çok uzunsa 2 satır göster, fazlasını kes */
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .topic-box-meta{
    margin-top: 4px !important;
    font-size: 11px !important;
    gap: 4px !important;
    opacity: .75 !important;
  }
}

/* =======================================================
   2) MOBİLDE SAYFA OYNAMA / ROOT SCROLL KİLİT
   - Body sabit
   - Scroll sadece #messages içinde
======================================================= */
html, body{
  height: 100%;
  overflow: hidden !important;           /* sayfa scroll’u kapat */
  overscroll-behavior: none;             /* Android/Chrome bounce engel */
  touch-action: manipulation;            /* gereksiz bounce azalır */
}

/* Ana uygulama da sabit yükseklik */
#main{
  height: 100dvh;
  height: 100svh; /* iOS adres bar dalgalanmasına karşı */
  overflow: hidden !important;
}

/* Grid/kartlar da taşmasın */
.app-grid,
.chat-card{
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* Asıl scroll alanı mesajlar olsun */
#messages{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;  /* sadece mesaj içinde scroll */
  -webkit-overflow-scrolling: touch;
}

/* Input bar sabit dursun */
.inputbar{
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 10;
}




/* ===========================
   FX OVERLAY + JPG PARÇACIKLAR
   =========================== */

#fx-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transition: opacity .25s ease-out;
}

/* Efekt görünürken */
#fx-overlay.fx-visible {
    opacity: 1;
}

/* Eski video FX hâlâ dursun istersen */
#fx-overlay #fx-video {
    max-width: 80%;
    max-height: 80%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* JPG parçacık elemanı */
.fx-item {
    position: absolute;
    width: 64px;
    height: 64px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    animation-name: fx-fall;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

/* Uçuş animasyonu */
@keyframes fx-fall {
    0% {
        transform: translate3d(var(--fx-start-x, 0), 110vh, 0)
                   scale(.7)
                   rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--fx-end-x, 0), -10vh, 0)
                   scale(1)
                   rotate(var(--fx-rot, 0deg));
        opacity: 0;
    }
}

/* İstersen efekt özel filtreleri */
.fx-kalp    { filter: drop-shadow(0 10px 22px rgba(239, 68, 68, .7)); }
.fx-konfeti { filter: drop-shadow(0 10px 22px rgba(234, 179, 8, .7)); }
.fx-alkis   { filter: drop-shadow(0 10px 22px rgba(37, 99, 235, .7)); }
.fx-gulumse { filter: drop-shadow(0 10px 22px rgba(16, 185, 129, .7)); }

/* ==== Tema menüsü & renk göstergeleri ==== */

.theme-switcher .dropdown-menu {
    min-width: 210px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.theme-option.active {
    background: var(--soft);
    font-weight: 600;
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    flex-shrink: 0;
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 1px rgba(15, 23, 42, .15);
}

/* Küçük renk ön izlemeleri */
.theme-dot.theme-ocean {
    background: linear-gradient(135deg, #0ea5e9, #1d4ed8);
}

.theme-dot.theme-forest {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.theme-dot.theme-sunset {
    background: linear-gradient(135deg, #fb923c, #ec4899);
}

.theme-dot.theme-violet {
    background: linear-gradient(135deg, #8b5cf6, #4c1d95);
}

.theme-dot.theme-rose {
    background: linear-gradient(135deg, #fb7185, #be123c);
}

.pm-fx-menu {
    z-index: 1600;
    background: var(--panel, #fff);
    border-radius: 999px;
    padding: 4px 6px;
    box-shadow: var(--shadow, 0 8px 24px rgba(15, 23, 42, 0.2));
    display: flex;
    gap: 4px;
    align-items: center;
}

.pm-fx-menu .pm-fx-btn {
    border-radius: 999px;
    padding-inline: 8px;
    font-size: 14px;
    line-height: 1;
    border: none;
}
/* Yetkili (Privileged) Kullanıcılar İçin Özel Stil */
/* Nickname elementi yetkili olduğunda bu stil uygulanır */
.user-list-item .nickname.privileged {
    color: var(--primary); /* Temel renk değişkeninizden alıyorum. Genellikle mavi. */
    /* İsteğe bağlı: Kırmızı yapmak isterseniz: color: #E74C3C; */
    font-weight: 700; /* Daha kalın yap */
    text-shadow: 0 0 4px rgba(59, 130, 246, 0.5); /* Hafif bir parlama ekle */
}
/* ====== Userlist Avatar Stilleri ====== */

/* Avatarı tutan kapsayıcı */
#userlist .ul-avatar-wrap {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--soft, #eef3ff);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
    transition: transform 0.1s ease;
}

#userlist .ul-item:hover .ul-avatar-wrap {
    transform: scale(1.05);
}

/* Avatar resmi */
#userlist .ul-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Baş harf etiketi */
#userlist .ul-initials {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary, #3b82f6);
    line-height: 1;
}

/* Mevcut ul-item yapısını avatar ile uyumlu hale getiriyoruz */
#userlist .ul-item {
    display: flex;
    align-items: center;
    gap: 8px; /* Avatar, Yetki Rozeti ve Yazı arası boşluk */
    padding: 4px 2px;
}

/* Yetki rozeti (ul-badge) avatar ile çakışmasın diye */
#userlist .ul-badge {
    /* Mevcut stillerinizden */
    flex: 0 0 20px;
    margin-left: -12px; /* Rozeti avatarın üzerine kaydırmak için ayarla */
    z-index: 1;
    border: 1px solid var(--panel, #fff); /* Panelin kenarını yumuşat */
}

/* ====== PM Baloncuğu Avatar Stilleri ====== */

.pm-bubbles .msg-row {
    align-items: flex-start;
    width: 100%;
    margin: 6px 0;
    gap: 8px; /* Avatar ve balon arası boşluk */
}

/* PM Avatar kapsayıcı */
.pm-bubbles .pm-bubble-avatar-wrap {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--soft, #eef3ff);
    margin-top: 4px; /* Balonun ilk satırı ile hizala */
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
}

.pm-bubbles .pm-bubble-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pm-bubbles .pm-bubble-avatar-wrap .ini {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary, #3b82f6);
}

/* Benim mesajım (me) – sağa hizalı */
.pm-bubbles .msg-row.me {
    justify-content: flex-end;
    flex-direction: row-reverse; /* Avatar sağa, balon sola */
}

/* Karşı tarafın mesajı (you) – sola hizalı */
.pm-bubbles .msg-row.you {
    justify-content: flex-start;
    flex-direction: row; /* Avatar sola, balon sağa */
}


/* app.css: ====== Userlist Avatar Stilleri ====== */

/* Varsayılan Avatar Kapsayıcı (User/Yetkili fark etmez) */
#userlist .ul-avatar-wrap {
    flex: 0 0 32px; 
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    /* User için varsayılan arka plan ve renk (açık gri/mavi) */
    background: var(--soft, #eef3ff);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
    color: var(--primary, #3b82f6); 
}

/* 1. Standart Kullanıcı (USER) - Avatar (İkon) */
#userlist .ul-avatar-wrap.user .ul-user-icon {
    font-size: 18px; /* İkon boyutu */
    color: var(--muted, #6b7280); /* İkon rengi */
}
#userlist .ul-avatar-wrap.user {
    background: var(--bg, #f4f7ff); /* Zemin rengi biraz daha açık */
    border: 1px solid var(--border, #e5e7eb);
}

/* 2. Yetkili Kullanıcılar (PRIVILEGED) - Avatar (Baş Harf) */
/* Bütün yetkili rolleri için genel stil */
#userlist .ul-avatar-wrap:not(.user) {
    background: rgba(59, 130, 246, .12); /* Hafif mavi zemin */
    color: var(--primary, #3b82f6); /* Baş harf rengi */
    font-weight: 700;
    /* Yetkiliye özel bir kutu gölgesi */
    box-shadow: 0 0 0 2px var(--primary, #3b82f6); 
}

/* Baş harf etiketi */
#userlist .ul-initials-priv {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary, #3b82f6);
    line-height: 1;
}

/* 3. Özel Renkler (İsteğe bağlı: Daha belirgin yapmak için) */
#userlist .ul-avatar-wrap.founder {
    /* Eski Renk: background: rgba(217, 119, 6, .15); color: var(--col-founder, #d97706); */
    
    /* >> YENİ RENK SEÇİMİ: Mor ve Koyu Gölge << */
    box-shadow: 0 0 0 2px var(--col-admin, #7c3aed); /* Admin rengini veya kendi morunuzu kullanın */
    background: rgba(124, 58, 237, .15); /* Mor tonlarında arka plan */
    color: var(--col-admin, #7c3aed); /* Mor ikon rengi */
    
    /* VEYA */
    
    /* >> YENİ RENK SEÇİMİ: Parlak Altın Sarısı << */
    /* box-shadow: 0 0 0 2px #ffc107; 
    background: rgba(255, 193, 7, .15);
    color: #ffc107; */
}   
#userlist .ul-avatar-wrap.admin {
    background: rgba(124, 58, 237, .12); /* Admin rengi */
    color: var(--col-admin, #7c3aed);
    box-shadow: 0 0 0 2px var(--col-admin, #7c3aed);
}

/* Avatar resmi varsa, her zaman tam otursun */
#userlist .ul-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* app.css dosyanızın herhangi bir yerine ekleyin */

/* Bu kural, kullanıcı listesindeki tüm yetki rozetlerini (badge) tamamen gizler */
#userlist .ul-badge {
    display: none !important;
}

/* Opsiyonel: Eğer rozetleri gizledikten sonra nicklerin sola kayması gerekiyorsa, 
   ul-item içindeki boşlukları da ayarlayabilirsiniz. */
#userlist .ul-item {
    gap: 8px; /* Mevcut boşluk ayarını kullanın veya 8px olarak bırakın */
}

/* Yetkili renkli baş harflerin/nicklerin yine de görünmesini istiyorsanız,
   sadece rozetler gizlenir, nick renkleri (ul-name) kalır. */


/* app.css: ====== Userlist Avatar Stilleri (Güncel) ====== */

/* Varsayılan Avatar Kapsayıcı (ul-avatar-wrap) */
#userlist .ul-avatar-wrap {
    flex: 0 0 32px; 
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .08);
}

/* 1. KULLANICI TARAFINDAN YÜKLENEN ÖZEL RESİM (ul-avatar-img) */
#userlist .ul-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 2. STANDART KULLANICI (Placeholder: Baş Harf) */
#userlist .ul-avatar-wrap.user {
    background: var(--soft, #f4f7ff); /* Açık zemin */
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: none;
}
#userlist .ul-initials-user {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted, #6b7280); /* Gri ton */
}

/* 3. YETKİLİ KULLANICILAR (Placeholder: Rol İkonu) */

/* Yetkiliye Genel Stil */
#userlist .ul-avatar-wrap:not(.user) {
    box-shadow: 0 0 0 2px var(--primary, #3b82f6); /* Mavi çerçeve */
    background: rgba(59, 130, 246, .1);
    color: var(--primary, #3b82f6);
}

/* Yetkili İkonu (ul-role-icon) */
#userlist .ul-role-icon {
    font-size: 16px; 
    font-weight: 700;
    line-height: 1;
}

/* Rol bazlı özel renkler (İsteğe Bağlı Vurgu) */
#userlist .ul-avatar-wrap.founder {
    /* Yeni atadığımız :root değişkenini kullanıyoruz */
    box-shadow: 0 0 0 2px var(--col-founder); 
    background: var(--col-founder, #ef4444, rgba(239, 68, 68, .15)); /* RGBa'yı direkt kırmızıdan al */
    color: var(--col-founder); 
    
    /* VEYA SADECE RGBA VE HEX İLE NETLEŞTİRİN: */
    box-shadow: 0 0 0 2px #ef4444; /* HEX */
    background: rgba(239, 68, 68, .15); /* RGBa */
    color: #ef4444; /* HEX */
}
#userlist .ul-avatar-wrap.admin {
    box-shadow: 0 0 0 2px var(--col-admin, #7c3aed);
    background: rgba(124, 58, 237, .15);
    color: var(--col-admin, #7c3aed);
}
#userlist .ul-avatar-wrap.op {
    box-shadow: 0 0 0 2px var(--col-op, #0b57d0);
    background: rgba(11, 87, 208, .15);
    color: var(--col-op, #0b57d0);
}
/* Diğer roller için de benzer renkleri tanımlayabilirsiniz */


/* ul-badge gizleme kuralı (önceden eklediğiniz) */
#userlist .ul-badge {
    display: none !important;
}

/* --- Avatar Sidebar Panel (temiz versiyon) --- */
.avatar-sidebar {
    position: fixed;
    top: 0;
    right: -340px;              /* Başlangıçta gizli */
    width: min(340px, 90vw);    /* Maks 340px, mobilde %90 */
    height: 100vh;
    background: var(--panel, #fff);
    border-left: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease;
    z-index: 1060;
}

.avatar-sidebar.open {
    right: 0;
}

.avatar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.avatar-grid img {
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
}

.avatar-grid img.selected {
    border-color: var(--primary);
}

/* Dark tema uyumu */
body.dark .avatar-sidebar {
    background: var(--panel, #0b1220);
    border-color: var(--border);
}
.avatar-grid img {
    width: 100%;
    border-radius: 16px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.avatar-grid img:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.avatar-grid img.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}
.avatar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border, #d1d5db);
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

body.dark .avatar-chip {
    background: rgba(15, 23, 42, 0.9);
}

.avatar-chip:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.avatar-chip img {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.avatar-chip-text {
    font-weight: 500;
}
/* client.css dosyanıza eklenmeli */
.chat-card.nudge-shake {
    /* Animasyonu başlatır */
    animation: nudge-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes nudge-shake {
    /* Yatay titreşim (sağa ve sola kayma) tanımları */
    10%, 90% {
        transform: translate3d(-1px, 0, 0); /* Hafif sola */
    }
    
    20%, 80% {
        transform: translate3d(2px, 0, 0); /* Orta sağa */
    }
    
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0); /* Güçlü sola */
    }
    
    40%, 60% {
        transform: translate3d(4px, 0, 0); /* Güçlü sağa */
    }
}

/* ================= SWEETALERT2 TARZI BOOTSTRAP MODAL ================= */

.nice-modal .modal-content {
    border-radius: 1.2rem;
    border: 0;
    padding: 22px 22px 16px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    animation: swal-pop .22s ease-out;
}

@keyframes swal-pop {
    from { transform: scale(.8); opacity: 0 }
    to   { transform: scale(1); opacity: 1 }
}

.nice-modal .modal-header {
    border: 0;
    justify-content: center;
    padding-bottom: 6px;
}

.nice-modal .modal-title {
    font-weight: 700;
    font-size: 1.35rem;
    text-align: center;
    width: 100%;
}

.nice-modal .modal-body {
    text-align: center;
    font-size: .95rem;
    color: #444;
}

.nice-modal .modal-footer {
    border: 0;
    justify-content: center;
    gap: .5rem;
}

.nice-modal .btn-primary {
    background: #6c5ce7;
    border: 0;
    border-radius: .7rem;
    padding: .55rem 1.6rem;
    font-weight: 600;
}

.nice-modal .btn-primary:hover {
    background: #5a4dd5;
}

.modal-backdrop.show {
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(3px);
}
.msg-sticker img,
.msg-sticker video {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 12px;
  vertical-align: middle;
}

.sticker-item img,
.sticker-item video {
  width: 35px;
  height: 35px;
  object-fit: contain;
  border-radius: 12px;
}
.sticker-item.is-animated {
  position: relative;
}

.sticker-item.is-animated::after {
    position: absolute;
  right: 6px;
  top: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
}

#btn-voice-note.is-recording{
  background: rgba(220,53,69,.15);
  border-color: rgba(220,53,69,.45);
  color: rgb(220,53,69);
}

#btn-voice-note.is-recording i{
  animation: vnPulse 1s infinite;
}

@keyframes vnPulse{
  0%{ transform: scale(1); opacity: 1; }
  50%{ transform: scale(1.15); opacity: .75; }
  100%{ transform: scale(1); opacity: 1; }
}

#pm-call-btn, #pm-hang-btn{
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
#pm-call-btn:active, #pm-hang-btn:active{
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
  transform: translateY(3px);
}

/* 1. STICKER MODAL TAB TASARIMI */
#modalStickers .sticker-tabs {
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 14px;
    padding: 3px;
    gap: 3px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

#modalStickers .sticker-tabs .btn {
    border: 0 !important;
    border-radius: 11px !important;
    padding: 6px 10px;
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none !important;
}

#modalStickers .sticker-tabs .btn.btn-primary {
    background: #5b5fe7 !important;
    color: #fff !important;
}

/* 2. MODERN MENÜ (SWEETALERT) TASARIMI */

/* Menü Başlık Alanı */
.modern-menu-header {
    background: #f8fafc;
    margin: 0 !important;
    padding: 20px !important;
    font-size: 1.3rem !important;
    text-align: left !important;
    font-weight: 800 !important;
    border-bottom: 1px solid #e2e8f0;
}

/* İkonların arkasındaki yuvarlak alan */
.menu-icon-bg {
    width: 32px;
    height: 32px;
    background: #edf2f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
}

/* Menü Liste Öğeleri */
.modern-menu-container .list-group-item {
    border-left: none;
    border-right: none;
    border-color: #f1f5f9;
    padding: 12px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.modern-menu-container .list-group-item:hover {
    background-color: #f8fafc;
    transform: translateX(5px);
    color: #000;
}

/* Alt Kapatma Alanı */
.bg-light.rounded-bottom {
    background-color: #f8fafc !important;
}

/* 3. DARK MODE (KARANLIK MOD) UYUMU */
.dark .modern-menu-header {
    background: #111827;
    border-bottom: 1px solid #374151;
    color: #f1f5f9 !important;
}

.dark .menu-icon-bg {
    background: #374151;
    color: #e5e7eb;
}

.dark .modern-menu-container .list-group-item {
    background: #1a2234;
    border-color: #374151;
    color: #cbd5e1;
}

.dark .modern-menu-container .list-group-item:hover {
    background-color: #242f47;
    color: #fff;
}

.dark .bg-light {
    background-color: #111827 !important;
}
/* SweetAlert ana kapsayıcıdaki taşmaları engelle */
.swal2-html-container.modern-menu-container {
    overflow: hidden !important; /* Kaydırma çubuğunu zorla gizle */
    padding: 0 !important;
    margin: 0 !important;
}

/* Menü listesinin içindeki butonların sağa sola taşmasını engelle */
.modern-menu-container .list-group {
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
}

/* Liste öğelerini tam genişlik yap ve kutu modelini sabitle */
.modern-menu-container .list-group-item {
    box-sizing: border-box !important;
    width: 100% !important;
    white-space: nowrap; /* Yazıların alt satıra geçip yüksekliği bozmasını engeller */
}

/* SweetAlert popup'ın kendisindeki taşmayı engelle */
.swal2-popup.modern-menu-popup {
    overflow: hidden !important;
}

/* Sticker Izgara Yapısı */
.sticker-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding: 10px;
}

.sticker-item {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 5px;
    border: none !important;      /* Kenarlıkları tamamen kaldırır */
    background: transparent !important; /* Arka planı tamamen şeffaf yapar */
    transition: transform 0.2s;
}

.sticker-item:hover {
    transform: scale(1.2); /* Üzerine gelince ikonun hafif büyümesi yeterli olacaktır */
    background: transparent !important;
}

/* Koyu mod (dark) için de temizleyelim */
.dark .sticker-item {
    background: transparent !important;
    border: none !important;
}

/* Scrollbar tasarımı */
.sticker-grid-layout::-webkit-scrollbar { width: 6px; }
.sticker-grid-layout::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.pm-head-modern {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.pm-user-info { display: flex; align-items: center; gap: 12px; }

.pm-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pm-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.pm-nick-text { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }

.pm-status-label { font-size: 0.75rem; color: #10b981; display: flex; align-items: center; gap: 4px; }
.status-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; }

.pm-actions-modern { display: flex; gap: 8px; }

.pm-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pm-btn:hover { background: #e2e8f0; color: #000; transform: translateY(-2px); }

.btn-call { background: #dcfce7; color: #166534; }
.btn-call:hover { background: #bbf7d0; }

.btn-hang { background: #fee2e2; color: #991b1b; }

/* Dark Mode */
.dark .pm-btn { background: #2d3748; color: #cbd5e1; }
.dark .btn-call { background: #064e3b; color: #34d399; }
.dark .pm-head-modern { border-color: rgba(255,255,255,0.05); }

.pm-head-modern {
    display: flex;
    align-items: center;
    padding: 12px 0px;
    background: var(--bg-card); /* Tema rengine göre ayarlanır */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
}

.pm-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pm-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pm-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.pm-nick-text { font-weight: 800; font-size: 1.15rem; color: var(--text-main); }

.pm-status-label { font-size: 0.75rem; color: #10b981; display: flex; align-items: center; gap: 5px; }
.status-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; animation: pulse 2s infinite; }

/* Aksiyon Tuşlarını Sağa İten Sınıf */
.ms-auto {
    margin-left: auto !important;
}

.pm-actions-modern {
    display: flex;
    gap: 10px;
}

.pm-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pm-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.btn-call { background: #e8f5e9; color: #2e7d32; }
.btn-call:hover { background: #c8e6c9; }

.btn-hang { background: #ffebee; color: #c62828; }

.dark .pm-btn { background: rgba(255, 255, 255, 0.1); color: #cbd5e1; }
.dark .btn-call { background: #1b5e20; color: #a5d6a7; }

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

/* Çevrimdışı Durum İkonu */
.status-dot.offline {
    background-color: #ef4444 !important; /* Kırmızı */
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
}

.pm-status-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    transition: all 0.3s ease;
}
/* Durum Etiketi Kapsayıcısı */
.pm-status-label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12px;
    line-height: 1; /* Satır yüksekliğini sabitleyin */
    margin-top: 2px;
}

/* Çevrimdışı Noktası */
.status-dot.offline {
    background-color: #ef4444 !important; /* Kırmızı */
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Çevrimdışı Yazı Stili */
.pm-status-label.is-offline {
    color: #94a3b8 !important;
}

.pm-btn.is-disabled,
.pm-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
/* PM header action buttons - mobile küçült */
@media (max-width: 576px) {
  .pm-head-modern .pm-actions-modern {
    gap: 5px;            /* buton aralığı */
  }

  .pm-head-modern .pm-actions-modern .pm-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 10px; /* daha kompakt */
    font-size: 14px;     /* icon boyutu */
    line-height: 34px;
  }

  .pm-head-modern .pm-actions-modern .pm-btn i {
    font-size: 12px;     /* FA icon */
  }
}

/* Çok küçük ekranlar */
@media (max-width: 360px) {
  .pm-head-modern .pm-actions-modern .pm-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 30px;
  }
  .pm-head-modern .pm-actions-modern .pm-btn i {
    font-size: 13px;
  }
}

/* Tema seçici dot */
.theme-dot.theme-whatsapp{
  background:#25D366;
  border:1px solid rgba(0,0,0,.15);
}

/* =========================
   WhatsApp Theme (theme-whatsapp)
   ========================= */
body.theme-whatsapp{
  --primary: #25D366;
  --bs-primary: #25D366;

  background: #efeae2;
  color: #111b21;
}

/* Üst bar */
body.theme-whatsapp .topbar{
  background:#4FCE5D  !important;
  border-bottom:1px solid rgba(255,255,255,.10);
}

/* Orta kart (chat) */
body.theme-whatsapp .chat-card{
  background:#ffffff !important;
  border:1px solid rgba(17,27,33,.10);
}

/* Mesaj alanı (WhatsApp hissi) */
body.theme-whatsapp #messages{
  background:#efeae2 !important;
}

/* Sağ/sol paneller */
body.theme-whatsapp #userlist-sidebar,
body.theme-whatsapp #channel-sidebar{
  background:#ffffff !important;
  border-color: rgba(17,27,33,.10) !important;
}

/* Input bar */
body.theme-whatsapp .inputbar{
  background:#f7f7f7 !important;
  border-top:1px solid rgba(17,27,33,.10);
}

/* PM header (senin renderPrivateHeader çıktın) */
body.theme-whatsapp .pm-head-modern{
  /*background:#075E54 !important;*/
  color:#198754  !important;
}
body.theme-whatsapp .pm-head-modern .pm-actions-modern .pm-btn{
  background: rgba(255,255,255,.12) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  color:#198754 !important;
}
body.theme-whatsapp #messages{
  background-image: url("/G-Chat/assets/css/arka.png") !important;
  background-repeat: repeat !important;
  background-size: 420px 420px !important;
}
a.yt-link{ text-decoration: underline; cursor:pointer; }

@media (max-width: 576px) {
    .topbar {
        /* Üst padding'i cihazın güvenli alanına göre ayarlar */
        padding-top: var(--safe-top, 20px) !important; 
        height: calc(var(--topbar-h) + var(--safe-top, 0px));
        display: flex;
        align-items: center;
    }

    #main {
        /* Uygulamanın tam ekran yüksekliğini cihaz tipine göre sabitler */
        height: 100dvh; 
    }

    .app-grid {
        /* Topbar yüksekliği arttığı için grid alanını yeniden hesaplıyoruz */
        height: calc(100dvh - (var(--topbar-h) + var(--safe-top, 0px)));
    }
}
@media (max-width: 576px) {
    .inputbar {
        /* Alt kısımda kaydırma çubuğu için ekstra boşluk bırakır */
        padding-bottom: calc(10px + var(--safe-bottom, 15px)) !important;
        position: sticky;
        bottom: 0;
    }
}
@media (max-width: 576px) {
    #messages {
        /* 100dvh (Dynamic Viewport Height) kullanımı ekran kaymalarını bitirir */
        height: auto;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ================= AVATAR SIDEBAR PANEL ================= */

.avatar-sidebar {
    position: fixed;
    top: 0;
    right: -340px;
    width: min(340px, 90vw);
    height: 100dvh; /* Mobil adres ubuu uyumlu */
    background: var(--panel, #fff);
    border-left: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    padding: 15px;

    display: flex;
    flex-direction: column;

    transition: right 0.25s ease;
    z-index: 1060;
}

.avatar-sidebar.open {
    right: 0;
}

/* ================= HEADER ================= */

.avatar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin-bottom: 12px;
}

.avatar-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

/* ================= SCROLL ALANI ================= */

.avatar-grid-container {
    flex: 1;                 /* kalan alan */
    overflow-y: auto;        /* scroll burada */
    padding-right: 5px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

/* ================= AVATAR GRID ================= */

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.avatar-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.avatar-grid img:hover {
    transform: scale(1.04);
}

.avatar-grid img.selected {
    border-color: var(--primary, #3b82f6);
}

/* ================= FOOTER ================= */

.avatar-footer {
    flex-shrink: 0;
    padding-top: 10px;
    padding-bottom: env(safe-area-inset-bottom, 15px);
    background: var(--panel, #fff);
}

/* ================= KAYDET BUTONU ================= */

.btn-save-avatar {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: var(--primary, #3b82f6);
    color: #fff;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-save-avatar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================= MOBL ================= */

@media (max-width: 576px) {
    .avatar-sidebar {
        padding: 10px;
        width: 85vw;
    }

    .avatar-header h5 {
        font-size: 16px;
    }

    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .avatar-grid img {
        border-radius: 10px;
    }

    .avatar-header {
        margin-bottom: 10px;
    }
}

.chat-img-preview {
    max-width: 200px; /* Çok büyük olmasın */
    max-height: 200px;
    border-radius: 12px;
    border: 2px solid #3b82f6;
    cursor: zoom-in;
    display: block;
    margin-top: 5px;
    object-fit: cover;
}
.pm-image-bubble {
    display: inline-block;
}

/* Görüntülü Sohbet Konteyneri */
.video-call-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

/* Karşı Tarafın Videosu (Büyük) */
#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Kendi Videon (Küçük - Sağ Üstte) */
#local-video {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    border: 2px solid #fff;
    object-fit: cover;
    z-index: 10;
    background: #222;
}

.video-controls {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 20;
}

