/* =========================================================================
   Discord Sayfa Stilleri  (Destan Graphic - frontend/discord.php)
   TEMA DEGISKENLERINI kullanir — light/dark tema otomatik calisir.
   Discord marka renkleri (mavi #5865f2, pin turuncu #faa61a) sadece vurgu icin.
   ========================================================================= */

/* === Ulke Bayragi Emoji Polyfill (Windows'ta 🇬🇧/🇹🇷 vs. harf kutu yerine bayrak gostermek icin) ===
   Twemoji Country Flags fontu — sadece bayrak glyphlerini icerir, ~250KB.
   Browser once kendi emoji fontunu dener; bayraklar icin bu fonta duser. */
@font-face {
    font-family: 'Twemoji Country Flags';
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
    src: url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2') format('woff2');
    font-display: swap;
}

/* Discord kanal/post alanlarinda bayrak fontunu fallback olarak ekle.
   unicode-range sayesinde sadece bayrak karakterleri icin devreye girer,
   diger karakterler sayfanin asil fontuyla render edilir. */
.discord-channels-sidebar,
.discord-channels-sidebar *,
.discord-feed,
.discord-feed *,
.discord-home-widget,
.discord-home-widget * {
    font-family: 'Twemoji Country Flags', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* === Sidebar (kanal listesi) === */
/* === Sidebar (kanal listesi) — srowave tarzi === */
.discord-channels-sidebar .item {
    padding: 0;                    /* Card-head + scroll bolge kendi padding'lerini kullanir */
    height: 580px;
    display: flex;
    flex-direction: column;
    overflow: hidden;              /* Card-head'in kose tasmasini kes */
    border-radius: inherit;
}

/* Her iki kart icin ortak ust mor baslik cubugu */
.discord-card-head{
    background: #5865f2;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    min-height: 50px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}
.discord-card-head .hash{ font-weight: 700; opacity: .9; }
.discord-card-head .head-left{ display:flex; align-items:center; gap:8px; }
.discord-card-head .head-left i{ font-size: 18px; }
.discord-card-head .head-right{
    font-size: 12px;
    opacity: .9;
    display: flex; align-items: center; gap: 6px;
}
.discord-card-head .active-ch-count{
    background: rgba(255,255,255,.18);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

/* Kanal listesi scroll alani */
.discord-channels-sidebar .channels-scroll{
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(127,127,127,.4) transparent;
}
.discord-channels-sidebar .channels-scroll::-webkit-scrollbar{ width: 8px; }
.discord-channels-sidebar .channels-scroll::-webkit-scrollbar-track{ background: transparent; }
.discord-channels-sidebar .channels-scroll::-webkit-scrollbar-thumb{ background: rgba(127,127,127,.35); border-radius: 4px; }
.discord-channels-sidebar .channels-scroll::-webkit-scrollbar-thumb:hover{ background: rgba(127,127,127,.55); }

/* Kategori section + baslik (katlanabilir) */
.discord-category{ border-bottom: 1px solid rgba(127,127,127,.10); }
.discord-category:last-child{ border-bottom: 0; }
.discord-category-heading{
    cursor: pointer;
    padding: 9px 14px;
    color: var(--soft-text);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(127,127,127,.05);
    transition: background .15s ease, color .15s ease;
    margin: 0;
}
.discord-category-heading:hover{
    background: rgba(127,127,127,.10);
    color: var(--base-text);
}
.discord-category-heading .cat-chevron{
    transition: transform .15s ease;
    font-size: 14px;
}
.discord-category.is-collapsed .cat-chevron{ transform: rotate(-90deg); }
.discord-category.is-collapsed .discord-channel-list{ display: none; }

/* Kanal listesi (hash + isim + sayac rozeti) */
.discord-channel-list{ list-style: none; padding: 4px 0; margin: 0; }
.discord-channel-list li{
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--base-text);
    font-size: 14px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    border-left: 3px solid transparent;
}
.discord-channel-list li:hover{
    background: rgba(88,101,242,.06);
    color: #5865f2;
}
.discord-channel-list li.active{
    background: rgba(88,101,242,.12);
    color: #5865f2;
    border-left-color: #5865f2;
    font-weight: 600;
}
.discord-channel-list .ch-name{
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.discord-channel-list .ch-count{
    background: rgba(88,101,242,.18);
    color: #5865f2;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

/* === Feed === */
.discord-feed-wrap .item{
    padding: 0;
    height: 580px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: inherit;
}
.discord-feed{ display: flex; flex-direction: column; gap: 14px; padding: 14px 16px; }

/* /discord sayfasinda mesaj akisi: kalan alani doldur, tasarsa scroll */
.discord-feed-wrap .discord-feed{
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(127,127,127,.4) transparent;
}
.discord-feed-wrap .discord-feed::-webkit-scrollbar{ width: 8px; }
.discord-feed-wrap .discord-feed::-webkit-scrollbar-track{ background: transparent; }
.discord-feed-wrap .discord-feed::-webkit-scrollbar-thumb{ background: rgba(127,127,127,.35); border-radius: 4px; }
.discord-feed-wrap .discord-feed::-webkit-scrollbar-thumb:hover{ background: rgba(127,127,127,.55); }

/* === Post karti === */
.discord-post{
    background: rgba(127,127,127,.06);
    border-left: 3px solid #5865f2;
    padding: 12px 14px;
    border-radius: 6px;
    transition: background .15s ease;
}
.discord-post:hover{ background: rgba(127,127,127,.10); }
.discord-post.is-pinned{
    border-left-color: #faa61a;
    background: rgba(250,166,26,.08);
}

/* Post basligi (avatar + yazar + zaman) */
.post-header{ display: flex; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.post-header .avatar{
    width: 38px; height: 38px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    background: rgba(127,127,127,.18);
}
.post-header .meta{
    display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
    font-size: 13px; line-height: 1.4;
}
.post-header .author{ color: var(--base-text); font-weight: 600; font-size: 15px; }
.post-header .channel{ color: #5865f2; font-size: 12px; }
.post-header .time{ color: var(--soft-text); font-size: 11px; }
.post-header .pinned-badge{ color: #faa61a; font-size: 11px; font-weight: 600; }

/* Post icerigi */
.post-content{
    color: var(--base-text);
    font-size: 14px; line-height: 1.55;
    padding-left: 50px;
    word-wrap: break-word;
}
.post-content code{
    background: rgba(127,127,127,.15);
    color: var(--base-text);
    padding: 2px 5px; border-radius: 3px;
    font-family: Consolas, Monaco, monospace; font-size: 13px;
}
.post-content pre{
    background: rgba(127,127,127,.15);
    color: var(--base-text);
    padding: 10px; border-radius: 4px;
    overflow-x: auto; margin: 6px 0;
}
.post-content a{ color: #5865f2; text-decoration: none; }
.post-content a:hover{ text-decoration: underline; }
.post-content .discord-mention,
.post-content .discord-channel{
    background: rgba(88,101,242,.15);
    color: #5865f2;
    padding: 0 2px; border-radius: 3px; font-weight: 500;
}
.post-content .discord-emoji{
    width: 22px; height: 22px; vertical-align: middle;
    margin: 0 1px;
}
.post-content h1, .post-content h2, .post-content h3{
    color: var(--base-text); margin: 8px 0 4px;
}

/* === Embed === */
.discord-embed{
    background: rgba(127,127,127,.08);
    border-left: 4px solid #5865f2;
    border-radius: 4px;
    padding: 10px 14px;
    margin: 8px 0 8px 50px;
    max-width: 520px;
    color: var(--base-text);
}
.discord-embed .embed-author{ font-size: 13px; font-weight: 600; color: var(--base-text); margin-bottom: 4px; }
.discord-embed .embed-title{ font-size: 15px; font-weight: 700; color: var(--base-text); margin-bottom: 4px; }
.discord-embed .embed-description{ font-size: 13px; line-height: 1.5; margin-bottom: 6px; }
.discord-embed .embed-fields{ display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.discord-embed .embed-field{ flex: 1 1 200px; }
.discord-embed .embed-field .field-name{ font-weight: 700; font-size: 13px; color: var(--base-text); }
.discord-embed .embed-field .field-value{ font-size: 13px; }
.discord-embed .embed-image,
.discord-embed .embed-thumbnail{ display: block; width: fit-content; max-width: 100%; }
.discord-embed .embed-image img,
.discord-embed .embed-thumbnail img{ max-width: 100%; border-radius: 4px; margin-top: 6px; display: block; }
.discord-embed .embed-footer{ font-size: 11px; color: var(--soft-text); margin-top: 8px; }

/* === Ekler (resim/video) === */
.post-attachments{
    display: flex; flex-direction: column; gap: 8px;
    padding-left: 50px; margin-top: 6px;
    align-items: flex-start;
}
.post-attachments a{
    display: inline-block;
    line-height: 0;
    max-width: 100%;
}
.post-attachments img,
.post-attachments video{
    max-width: 100%; max-height: 350px;
    border-radius: 4px; cursor: zoom-in;
    display: block;
}

/* === Responsive === */
@media (max-width: 768px){
    .post-content, .post-attachments, .discord-embed{ padding-left: 0; margin-left: 0; }
    .post-header .avatar{ width: 32px; height: 32px; }
}

/* =========================================================
   ANA SAYFA WIDGET'I
   ========================================================= */
.discord-section{ margin-top: 30px; }
.discord-home-area{ margin-top: 16px; }
.discord-home-widget{
    background: var(--white);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    overflow: hidden;
}
.discord-home-widget .discord-feed{
    max-height: 560px;
    overflow-y: auto;
    padding: 16px;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(127,127,127,.4) transparent;
}
.discord-home-widget .discord-feed::-webkit-scrollbar{ width: 8px; }
.discord-home-widget .discord-feed::-webkit-scrollbar-track{ background: transparent; }
.discord-home-widget .discord-feed::-webkit-scrollbar-thumb{ background: rgba(127,127,127,.35); border-radius: 4px; }
.discord-home-widget .discord-feed::-webkit-scrollbar-thumb:hover{ background: rgba(127,127,127,.55); }

.discord-home-widget .discord-post{ margin-bottom: 0; padding: 10px 12px; border-left-width: 3px; }
.discord-home-widget .post-header{ margin-bottom: 4px; align-items: center; }
.discord-home-widget .post-header .avatar{ width: 32px; height: 32px; }
.discord-home-widget .post-header .author{ font-size: 14px; }
.discord-home-widget .post-header .channel{ font-size: 11px; }
.discord-home-widget .post-header .time{ font-size: 11px; }
.discord-home-widget .post-content{ padding-left: 44px; font-size: 13px; line-height: 1.5; margin: 0; }
.discord-home-widget .post-attachments{ padding-left: 44px; margin-top: 4px; }
.discord-home-widget .post-attachments img,
.discord-home-widget .post-attachments video{ max-height: 220px; }
.discord-home-widget .discord-embed{ margin: 6px 0 6px 44px; padding: 8px 12px; font-size: 12px; }
.discord-home-widget .discord-embed .embed-image img,
.discord-home-widget .discord-embed .embed-thumbnail img{ max-height: 200px; }

@media (max-width: 768px){
    .discord-home-widget .post-content,
    .discord-home-widget .post-attachments,
    .discord-home-widget .discord-embed{ padding-left: 0; margin-left: 0; }
}

.wrap-view-link .link-arrow{
    color: #5865f2; font-weight: 500; font-size: 14px;
    display: inline-flex; align-items: center; gap: 4px;
}
.wrap-view-link .link-arrow:hover{ text-decoration: underline; }

/* =========================================================
   LIGHTBOX (resim pop-up)  — max 1024px yukseklik
   ========================================================= */
body.dl-open{ overflow: hidden; }
.discord-lightbox{
    position: fixed; inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 99999;
    display: none;
    align-items: center; justify-content: center;
    padding: 40px;
}
.discord-lightbox.is-open{ display: flex; }
.discord-lightbox .dl-stage{
    max-width: 100%; max-height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.discord-lightbox .dl-img{
    max-width: 92vw;
    max-height: min(88vh, 1024px);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,.6);
    user-select: none;
}
.discord-lightbox .dl-close,
.discord-lightbox .dl-prev,
.discord-lightbox .dl-next{
    position: absolute;
    background: rgba(255,255,255,.08);
    color: #fff;
    border: 0;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.discord-lightbox .dl-close{
    top: 20px; right: 20px;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 28px; line-height: 1;
}
.discord-lightbox .dl-prev,
.discord-lightbox .dl-next{
    top: 50%; transform: translateY(-50%);
    width: 48px; height: 60px;
    border-radius: 8px;
    font-size: 20px;
}
.discord-lightbox .dl-prev{ left: 20px; }
.discord-lightbox .dl-next{ right: 20px; }
.discord-lightbox .dl-close:hover,
.discord-lightbox .dl-prev:hover,
.discord-lightbox .dl-next:hover{ background: rgba(255,255,255,.18); }
.discord-lightbox .dl-counter{
    position: absolute;
    bottom: 24px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.75);
    font-size: 13px;
    background: rgba(0,0,0,.4);
    padding: 6px 12px;
    border-radius: 20px;
}
@media (max-width: 600px){
    .discord-lightbox{ padding: 12px; }
    .discord-lightbox .dl-close{ top: 10px; right: 10px; width: 38px; height: 38px; font-size: 24px; }
    .discord-lightbox .dl-prev,
    .discord-lightbox .dl-next{ width: 38px; height: 50px; }
    .discord-lightbox .dl-prev{ left: 6px; }
    .discord-lightbox .dl-next{ right: 6px; }
}

/* === Discord video embed (YouTube / Vimeo) === */
.discord-embed-video{
    margin-top: 8px;
    width: 100%;
    max-width: 560px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}
.discord-video-ratio{
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
}
.discord-video-ratio iframe{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.discord-embed.has-video{ max-width: 560px; }
.discord-home-widget .discord-embed-video{ max-width: 100%; }

/* === Discord blockquote (> ve >>>) === */
.discord-quote{
    border-left: 4px solid rgba(127,127,127,.45);
    padding: 2px 0 2px 12px;
    margin: 4px 0;
    color: inherit;
    background: transparent;
    font-style: normal;
    white-space: pre-wrap;
}
.dark-theme .discord-quote{
    border-left-color: rgba(255,255,255,.25);
}
