/* ================================================================
   MOBİL DÜZELTMELER — header + profil sayfası
   Tema CSS'lerinden (theme.css / theme.purple.css / theme.red.css) SONRA yüklenir
   (includes/header.php). Tema dosyaları yeniden üretilse de bu dosya etkilenmez.
   ================================================================ */

/* ── HEADER ───────────────────────────────────────────────────── */

/* Logo hiçbir zaman sağdaki alanın altına taşmasın: kalan genişliğe sığacak şekilde küçülür */
.top-bar-left { min-width: 0; overflow: hidden; }
.top-bar-mobile-logo { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.top-bar-mobile-logo .sb-logo-img {
    max-width: 100%;
    width: auto;
    object-fit: contain;
    object-position: left center;
}
.top-bar-mobile-logo .sb-brand-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Dropdown'daki Affiliate / Beni Ara satırları: yalnızca header'daki butonlar sığmayıp
   gizlendiğinde (.hdr-compact — js: includes/header.php) görünür.
   (tema .dropdown-item'ı display:flex !important yaptığı için !important şart) */
.user-dropdown-menu .dd-mobile-only { display: none !important; }
.user-dropdown-menu button.dd-mobile-only {
    width: 100%; background: none; border: 0; border-left: 3px solid transparent;
    font-family: inherit; text-align: left; cursor: pointer; margin: 0;
}
.top-header-bar.hdr-compact .top-bar-right .header-img-btns { display: none !important; }
.top-header-bar.hdr-compact .user-dropdown-menu .dd-mobile-only { display: flex !important; }

/* Üye kabuğu çekilmiş sayfalarda oturum yokken hesap menüsü görünmez.
   Ana sayfanın kendi misafir düğmeleri durur. */
body.is-logged-out .user-info-compact,
body.is-logged-out .auth-only { display: none !important; }
body.is-logged-in .header-guest-auth { display: none !important; }
.header-guest-auth { display: flex; align-items: center; gap: 8px; }

/* ── PROFİL SAYFASI (mobil) ───────────────────────────────────── */
@media (max-width: 768px) {

    /* Hero: avatar + (Hesabım / kullanıcı adı) üstte, chip'ler ve bakiye tam genişlikte altta */
    html body[data-page="profile.php"] .prf-hero {
        padding: calc(var(--top-bar-h, 54px) + 22px) 16px 0;
    }
    html body[data-page="profile.php"] .prf-hero-inner {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        column-gap: 14px;
        row-gap: 0;
        align-items: center;
        padding-bottom: 20px;
    }
    html body[data-page="profile.php"] .prf-avatar-wrap {
        grid-column: 1; grid-row: 1 / span 2; align-self: center;
    }
    html body[data-page="profile.php"] .prf-avatar {
        width: 64px; height: 64px; font-size: 21px; border-radius: 16px;
    }
    html body[data-page="profile.php"] .prf-avatar-status {
        width: 16px; height: 16px; bottom: -3px; right: -3px; border-width: 3px;
    }
    /* Bilgi kolonunu grid'e aç → eyebrow/isim/chip'ler ayrı yerleşebilsin */
    html body[data-page="profile.php"] .prf-hero-info { display: contents; }
    html body[data-page="profile.php"] .prf-hero-eyebrow {
        grid-column: 2; grid-row: 1; align-self: end; margin: 0 0 6px;
    }
    html body[data-page="profile.php"] .prf-hero-name {
        grid-column: 2; grid-row: 2; align-self: start; margin: 0;
        font-size: 22px; line-height: 1.15;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    html body[data-page="profile.php"] .prf-hero-meta {
        grid-column: 1 / -1; grid-row: 3;
        margin-top: 16px; gap: 8px;
    }
    html body[data-page="profile.php"] .prf-hero-chip,
    html body[data-page="profile.php"] .prf-kyc-chip {
        padding: 5px 11px; font-size: 11.5px; line-height: 1.2;
        max-width: 100%; min-width: 0;
    }
    html body[data-page="profile.php"] .prf-hero-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    html body[data-page="profile.php"] .prf-kyc-chip { white-space: nowrap; }
    html body[data-page="profile.php"] .prf-hero-chip i,
    html body[data-page="profile.php"] .prf-kyc-chip i { font-size: 10px; flex: none; }
    /* Sıra: doğrulama durumu · tarih · e-posta (uzun e-posta en sona, gerekirse alt satıra) */
    html body[data-page="profile.php"] .prf-kyc-chip { order: -2; }
    html body[data-page="profile.php"] .prf-hero-chip:first-of-type { order: -1; }

    /* Bakiye kartı: tek satır — solda etiket, sağda tutar */
    html body[data-page="profile.php"] .prf-balance-card {
        grid-column: 1 / -1; grid-row: 4;
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        width: 100%; min-width: 0;
        margin-top: 16px; padding: 14px 18px;
        border-radius: 14px;
    }
    html body[data-page="profile.php"] .prf-balance-lbl { margin: 0; }
    html body[data-page="profile.php"] .prf-balance-val { font-size: 24px; white-space: nowrap; }

    /* Sekmeler: eşit genişlik, ikon üstte / etiket altta (etiket gizlenmez) */
    html body[data-page="profile.php"] .prf-tabs {
        padding: 0; justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
    html body[data-page="profile.php"] .prf-tab {
        flex: 1 0 auto; min-width: 0;
        flex-direction: column; justify-content: center; gap: 5px;
        padding: 11px 10px 10px;
        font-size: 10.5px; line-height: 1.2; letter-spacing: 0;
    }
    html body[data-page="profile.php"] .prf-tab i { font-size: 15px; }
    html body[data-page="profile.php"] .prf-tab span { display: block; }
    html body[data-page="profile.php"] .prf-tab-badge {
        position: absolute; top: 9px; left: calc(50% + 9px);
    }

    /* İçerik + kartlar */
    html body[data-page="profile.php"] .prf-content { padding: 16px 14px 56px; }
    html body[data-page="profile.php"] .prf-grid-2,
    html body[data-page="profile.php"] .prf-grid-3 { gap: 12px; }
    html body[data-page="profile.php"] .prf-card { border-radius: 14px; }
    html body[data-page="profile.php"] .prf-card-head { padding: 16px 16px 0; margin-bottom: 14px; }
    html body[data-page="profile.php"] .prf-card-head h3 { font-size: 14px; }
    html body[data-page="profile.php"] .prf-card-body { padding: 0 16px 16px; }
    html body[data-page="profile.php"] .prf-info-row { flex-wrap: wrap; row-gap: 4px; }
    html body[data-page="profile.php"] .prf-info-val { overflow-wrap: anywhere; text-align: right; }
}

@media (max-width: 420px) {
    html body[data-page="profile.php"] .prf-hero-name { font-size: 20px; }
    html body[data-page="profile.php"] .prf-tab span { display: block; }
    html body[data-page="profile.php"] .prf-tab { padding: 11px 8px 10px; }
}

/* Ana sayfa: slider ve popup 390 ekranda tasmassin, alt menu yazilari icerde kalsin. */
@media (max-width: 768px) {
    html, body { overflow-x: clip; }
    .modern-slider-wrapper,
    .modern-slider,
    .slide-item,
    .slide-media {
        max-width: 100%;
    }
    .modern-slider { width: 100% !important; }
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }
    .pu-box {
        max-width: calc(100vw - 28px);
        max-height: calc(100vh - 36px);
    }
    .pu-box img {
        max-width: 100%;
        max-height: calc(100vh - 72px);
        object-fit: contain;
    }
    .fe-cards-row { max-width: none; }
}

/* Member utilities follow the server-verified session on every route. */
.header-img-btns.auth-only { display: none !important; }
body.is-logged-in .header-img-btns.auth-only { display: flex !important; }
