/*
 * OtoParcaVar — Mobil Uygulama Teması
 * Yalnızca mobil cihazlarda (≤ 767px) etkin olur.
 * Admin panelinden mobile_app_mode=1 iken yüklenir.
 */

/* ═══════════════════════════════════════════════════════════
   0. GLOBAL GİZLEME — Tüm ekran boyutlarında varsayılan gizle
   Bu sayede masaüstünde bu elementler hiç görünmez.
   !important kullanmıyoruz ki medya sorgusu override edebilelsin.
═══════════════════════════════════════════════════════════ */
.app-topbar     { display: none; }
.app-drawer     { display: none; }
.app-drawer-overlay { display: none; }
.app-bottom-nav { display: none; }

/* ═══════════════════════════════════════════════════════════
   1. TEMEL KURULUM
═══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

:root {
    --app-bar-h:    56px;
    --bottom-nav-h: 64px;
    --app-primary:  #0066cc;
    --app-bg:       #f0f4f8;
    --app-card-bg:  #ffffff;
    --app-radius:   16px;
    --app-shadow:   0 2px 12px rgba(0,0,0,.08);
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

/* Genel body ayarı */
body.app-mode {
    background: var(--app-bg) !important;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px) !important;
    padding-top: var(--app-bar-h) !important;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}

/* ═══════════════════════════════════════════════════════════
   2. MEVCUT HEADER'I GİZLE — APP TOPBAR GÖSTER
═══════════════════════════════════════════════════════════ */
body.app-mode header.site-header {
    display: none !important;
}

/* App Topbar */
body.app-mode .app-topbar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--app-bar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
    padding: 0 16px;
    z-index: 1050;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
    padding-top: env(safe-area-inset-top, 0px);
}
.app-topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-decoration: none;
}
.app-topbar-logo .brand-icon {
    width: 32px; height: 32px;
    background: var(--app-primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px;
}
.app-topbar-logo .brand-name {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.3px;
}
.app-topbar-logo .brand-tld {
    color: var(--app-primary);
    font-size: 13px;
}
.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.app-topbar-btn {
    width: 38px; height: 38px;
    border: none; background: transparent;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #374151;
    cursor: pointer;
    position: relative;
    text-decoration: none;
}
.app-topbar-btn:hover { background: #f1f5f9; color: #0f172a; }
.app-topbar-btn .notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

/* ═══════════════════════════════════════════════════════════
   3. FOOTER GİZLE — BOTTOM NAV GÖSTER
═══════════════════════════════════════════════════════════ */
body.app-mode footer.footer {
    display: none !important;
    margin: 0 !important;
}
body.app-mode main {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* ─── Bottom Navigation ─── */
body.app-mode .app-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    background: #fff;
    border-top: 1px solid #e5e7eb;
    z-index: 1050;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}
.app-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: color .15s;
    position: relative;
    padding: 8px 4px;
}
.app-nav-item i {
    font-size: 22px;
    line-height: 1;
}
.app-nav-item.active {
    color: var(--app-primary);
}
.app-nav-item.active i {
    font-weight: 900;
}
.app-nav-item .nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 1.5px solid #fff;
}

/* ─── Merkez: İlan Ver FAB ─── */
.app-nav-fab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.app-nav-fab a {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #0066cc, #0052a3);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,102,204,.4);
    position: absolute;
    bottom: 4px;
    font-size: 22px;
    transition: transform .15s, box-shadow .15s;
}
.app-nav-fab a:active {
    transform: scale(0.93);
    box-shadow: 0 2px 8px rgba(0,102,204,.3);
}
.app-nav-fab span {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════
   4. YAN MENÜ (DRAWER)
═══════════════════════════════════════════════════════════ */

/* Overlay (karartma) */
body.app-mode .app-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1200;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}
body.app-mode .app-drawer-overlay.open {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
}

/* Drawer panel — transform ile gizlenir, display:flex kalır */
body.app-mode .app-drawer {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 80vw;
    max-width: 300px;
    background: #fff;
    z-index: 1300;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
}
body.app-mode .app-drawer.open {
    transform: translateX(0);
}

/* Drawer başlık */
.app-drawer-header {
    position: relative;
    background: var(--app-primary, #0066cc);
    padding: 20px 16px 16px;
    color: #fff;
    flex-shrink: 0;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
}
.app-drawer-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    top: calc(12px + env(safe-area-inset-top, 0px));
}
.app-drawer-close:hover { background: rgba(255,255,255,.35); }

/* Kullanıcı bilgisi */
.app-drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.app-drawer-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.5);
}
.app-drawer-avatar-placeholder {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.app-drawer-username {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}
.app-drawer-profile-link {
    font-size: 12px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
}
.app-drawer-profile-link:hover { color: #fff; }

/* Misafir */
.app-drawer-guest-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

/* Drawer içerik */
.app-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 24px;
}
.app-drawer-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 12px 16px 4px;
}
.app-drawer-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .12s;
    border-radius: 0;
}
.app-drawer-link:hover,
.app-drawer-link:active { background: #f1f5f9; color: #0066cc; }
.app-drawer-link .badge { margin-left: auto; }
.app-drawer-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 8px 16px;
}
.app-drawer-logout {
    color: #ef4444 !important;
}
.app-drawer-logout:hover { background: #fef2f2 !important; }

/* ═══════════════════════════════════════════════════════════
   5. KART & İÇERİK STİLLERİ
═══════════════════════════════════════════════════════════ */
body.app-mode .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* İlan kartları */
body.app-mode .listing-card,
body.app-mode .product-card {
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    border: none !important;
    overflow: hidden;
}

/* Genel card'lar */
body.app-mode .card {
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    border: none !important;
}

/* Section başlıkları */
body.app-mode .section-title,
body.app-mode h2, body.app-mode h3 {
    font-size: 18px !important;
}

/* Butonlar */
body.app-mode .btn {
    border-radius: 12px !important;
}
body.app-mode .btn-primary {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

/* Form elemanları */
body.app-mode .form-control,
body.app-mode .form-select {
    border-radius: 12px !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
    border-color: #e5e7eb !important;
}
body.app-mode .form-control:focus,
body.app-mode .form-select:focus {
    border-color: var(--app-primary) !important;
    box-shadow: 0 0 0 3px rgba(0,102,204,.12) !important;
}

/* Alert'ler */
body.app-mode .alert {
    border-radius: var(--app-radius) !important;
    border: none !important;
}

/* Tablo */
body.app-mode table {
    font-size: 13px !important;
}

/* Ana sayfa hero banner */
body.app-mode .hero-banner,
body.app-mode .home-slider {
    border-radius: var(--app-radius) !important;
    overflow: hidden;
}

/* Arama kutusu */
body.app-mode .search-box,
body.app-mode .main-search {
    border-radius: 14px !important;
}

/* ═══════════════════════════════════════════════════════════
   5. SCROLL & DOKUNMATİK İYİLEŞTİRMELER
═══════════════════════════════════════════════════════════ */
body.app-mode * {
    -webkit-overflow-scrolling: touch;
}
body.app-mode img {
    -webkit-user-drag: none;
}

/* Aktif durum dokunma geri bildirimi */
body.app-mode a:active,
body.app-mode button:active {
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════
   6. ACCOUNT SIDEBAR GİZLE (mobilde zaten küçük ama uygulama modunda tam gizle)
═══════════════════════════════════════════════════════════ */
body.app-mode .account-sidebar-col {
    display: none !important;
}
body.app-mode .account-main-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

} /* end @media (max-width: 767px) */
