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