@media (min-width:992px) {

    .nice-modal .modal-dialog {

        max-width: 860px
    }

}

@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);
    }
}

@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);
    }
}

@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);
    }
}

@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);
    }
}

@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);
    }
}

@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;
        color: var(--text, #0f172a) !important;
    }

    /* 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 */
    }
}

@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;
    }
}

@media (min-width:992px) {
    #userlist-sidebar {
        overflow: hidden !important;
    }
}
@media (min-width: 992px) {
    #channel-sidebar #tabs button {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        margin: 2px 0;
        padding: 8px 10px;

        border: 1px solid rgba(59, 130, 246, 0.15);
        border-radius: 10px;
        background: linear-gradient(135deg, #eef4ff, #dbeafe);
        color: #0f172a;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
        transition: all .18s ease;
    }

    #channel-sidebar #tabs button:hover {
        background: linear-gradient(135deg, #dbeafe, #bfdbfe);
        transform: translateX(2px);
    }

    #channel-sidebar #tabs button.active,
    #channel-sidebar #tabs button[aria-selected="true"] {
        background: linear-gradient(135deg, #3b82f6, #2563eb);
        color: #fff !important;
        border-color: transparent;
        box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
    }
}
@media (min-width: 992px) {
    #channel-sidebar #tabs button.active,
    #channel-sidebar #tabs button[aria-selected="true"] {
        background: linear-gradient(135deg, #dbe7f6, #cfdced) !important;
        color: #0f172a !important;
        border: 1px solid #b7c7dc !important;
        box-shadow: 0 2px 8px rgba(148, 163, 184, 0.18) !important;
        font-weight: 700;
    }
}
@media (min-width: 992px) {
    #channel-sidebar #tabs button {
        position: relative;
        padding-left: 38px !important;
    }

    #channel-sidebar #tabs button::before {
        content: attr(data-badge);
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 26px;
        height: 26px;
        border-radius: 999px;
        display: grid;
        place-items: center;
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
        background: linear-gradient(135deg, #edf3fb, #dbe6f4);
        border: 1px solid #c8d5e6;
        color: #4b5f78;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
    }

    #channel-sidebar #tabs button:hover::before {
        background: linear-gradient(135deg, #e7f0fb, #d4e1f2);
        border-color: #b8cbe0;
        color: #35506d;
    }

    #channel-sidebar #tabs button.active::before,
    #channel-sidebar #tabs button[aria-selected="true"]::before {
        background: linear-gradient(135deg, #dfeaf7, #ccdced);
        border-color: #aebfd6;
        color: #2b425b;
    }
}
/* =====================================================
   HCHAT SAĞ PANEL AÇ/KAPAT + SAĞA/SOLA GENİŞLETME
   Masaüstü için: userlist + kanal listesi
===================================================== */

@media (min-width: 992px) {
  :root {
    --hchat-userlist-w: 240px;
    --hchat-channel-w: 220px;
  }

  .hc-side-toggle-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, .45);
    background: var(--panel, #fff);
    color: var(--primary, #2563eb);
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
    transition: .18s ease;
  }

  .hc-side-toggle-btn:hover {
    background: var(--soft, #edf3ff);
    transform: translateY(-1px);
  }

  .hc-side-toggle-btn.is-closed {
    opacity: .55;
    filter: grayscale(.2);
  }

  #app-grid {
    display: flex !important;
    align-items: stretch;
  }

  .chat-card {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #userlist-sidebar {
    flex: 0 0 var(--hchat-userlist-w) !important;
    width: var(--hchat-userlist-w) !important;
    min-width: 185px;
    max-width: 430px;
    position: relative !important;
    display: flex !important;
    transition:
      flex-basis .22s ease,
      width .22s ease,
      opacity .22s ease,
      margin .22s ease;
  }

  #channel-sidebar {
    flex: 0 0 var(--hchat-channel-w) !important;
    width: var(--hchat-channel-w) !important;
    min-width: 175px;
    max-width: 390px;
    position: relative !important;
    display: flex !important;
    transition:
      flex-basis .22s ease,
      width .22s ease,
      opacity .22s ease,
      margin .22s ease;
  }

  body.hc-users-closed #userlist-sidebar {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    opacity: 0;
    margin-left: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
  }

  body.hc-channels-closed #channel-sidebar {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    opacity: 0;
    margin-left: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
  }

  .hc-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 9px;
    height: 100%;
    cursor: col-resize;
    z-index: 40;
    background: transparent;
  }

  .hc-resize-handle::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    border-radius: 99px;
    background: transparent;
    transition: .15s ease;
  }

  .hc-resize-handle:hover::after,
  body.hc-resizing .hc-resize-handle::after {
    background: rgba(37, 99, 235, .45);
  }

  body.hc-resizing {
    cursor: col-resize !important;
    user-select: none !important;
  }
}

@media (max-width: 991.98px) {
  .hc-side-toggle-btn,
  .hc-resize-handle {
    display: none !important;
  }
}
/* =====================================================
   HCHAT PANELLERİ SOLA / SAĞA TAŞIMA
   Kanal listesi + kullanıcı listesi
===================================================== */

@media (min-width: 992px) {

  /* Sol mod aktifken sıralama:
     Kanal listesi | User listesi | Sohbet alanı
  */
  body.hc-panels-left #channel-sidebar {
    order: 1 !important;
    margin-left: 0 !important;
    margin-right: 8px !important;
    border-left: 1px solid rgba(148, 163, 184, .35);
    border-right: 1px solid rgba(148, 163, 184, .35);
  }

  body.hc-panels-left #userlist-sidebar {
    order: 2 !important;
    margin-left: 0 !important;
    margin-right: 8px !important;
  }

  body.hc-panels-left .chat-card {
    order: 3 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  /* Sol modda sürükleme çizgisi panelin sağında olsun */
  body.hc-panels-left .hc-resize-handle {
    left: auto !important;
    right: 0 !important;
  }

  body.hc-panels-left .hc-resize-handle::after {
    left: auto !important;
    right: 3px !important;
  }

  /* Sol modda panel kapatılınca boşluk kalmasın */
  body.hc-panels-left.hc-users-closed #userlist-sidebar {
    margin-right: 0 !important;
  }

  body.hc-panels-left.hc-channels-closed #channel-sidebar {
    margin-right: 0 !important;
  }

  /* Sol/sağ taşıma butonu */
  #hc-toggle-panel-side {
    color: #0f766e;
  }

  body.hc-panels-left #hc-toggle-panel-side {
    background: rgba(20, 184, 166, .12);
    border-color: rgba(20, 184, 166, .35);
    color: #0f766e;
  }
}
#hc-toggle-panel-side i,
#hc-toggle-users i,
#hc-toggle-channels i {
  font-size: 16px;
  line-height: 1;
  display: block;
}