/* ============================================================
   ARTEMIS PREMIUM - Mobil Uygulama Teması
   Sadece body.mobile-app-theme + max-width: 991px
   Masaüstünde normal responsive görünüm korunur.
   ============================================================ */

/* Masaüstünde mobil bileşenler DOM'da olsa da görünmez */
.mobile-app-tabbar,
.mobile-app-sheet,
.mobile-app-sheet-backdrop {
    display: none !important;
}

@media (max-width: 991px) {
    body.mobile-app-theme {
        --app-header-h: 60px;
        --app-tabbar-h: 64px;
        --app-bg: #f2f4f7;
        --app-surface: #ffffff;
        --app-border: rgba(15, 52, 96, 0.1);
        --app-radius: 16px;
        --app-shadow: 0 2px 12px rgba(15, 28, 46, 0.08);
        background: var(--app-bg);
        padding-top: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
        padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        -webkit-tap-highlight-color: transparent;
    }

    /* Üst bilgi çubuğu gizle */
    body.mobile-app-theme .topbar {
        display: none !important;
    }

    /* Kompakt uygulama üst çubuğu */
    body.mobile-app-theme .navbar-main {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        height: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
        background: var(--app-surface);
        border-bottom: 1px solid var(--app-border);
        box-shadow: var(--app-shadow);
        backdrop-filter: blur(12px);
    }

    body.mobile-app-theme .navbar-main .container {
        height: var(--app-header-h);
        display: flex;
        align-items: center;
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    body.mobile-app-theme .navbar-brand {
        padding: 0;
        margin: 0 auto;
        flex: 1;
        display: flex;
        justify-content: center;
    }

    body.mobile-app-theme .navbar-brand .logo-img {
        height: 52px;
        width: auto;
        max-width: none;
    }

    body.mobile-app-theme .navbar-logo-text {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    body.mobile-app-theme .navbar-logo-text .logo-name {
        font-size: 1rem;
        line-height: 1.2;
    }

    body.mobile-app-theme .navbar-logo-text .logo-tagline {
        display: none;
    }

    body.mobile-app-theme .navbar-logo-text .logo-leaf {
        font-size: 1.25rem;
    }

    /* Hamburger menü gizle — alt tab bar kullanılır */
    body.mobile-app-theme .navbar-toggler,
    body.mobile-app-theme .navbar-collapse,
    body.mobile-app-theme .navbar-main .btn-cta {
        display: none !important;
    }

    /* İçerik kaydırma ofseti */
    body.mobile-app-theme .page-content,
    body.mobile-app-theme main,
    body.mobile-app-theme .hero-pro,
    body.mobile-app-theme .hero-slider,
    body.mobile-app-theme .page-hero,
    body.mobile-app-theme .breadcrumb-section {
        scroll-margin-top: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
    }

    /* Hero üst padding kaldır — body padding yeterli */
    body.mobile-app-theme .navbar-main ~ section:first-of-type,
    body.mobile-app-theme .navbar-main ~ .hero-pro:first-of-type,
    body.mobile-app-theme .navbar-main ~ .hero-slider:first-of-type,
    body.mobile-app-theme .navbar-main ~ .page-hero:first-of-type {
        padding-top: 0;
    }

    /* Kart tabanlı içerik */
    body.mobile-app-theme section:not(.hero-pro):not(.hero-slider):not(.page-hero) {
        padding: 20px 0;
    }

    body.mobile-app-theme .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    body.mobile-app-theme .service-card,
    body.mobile-app-theme .blog-card,
    body.mobile-app-theme .reference-card,
    body.mobile-app-theme .team-card,
    body.mobile-app-theme .feature-box,
    body.mobile-app-theme .contact-info-card,
    body.mobile-app-theme .admin-card,
    body.mobile-app-theme .card {
        border-radius: var(--app-radius);
        border: 1px solid var(--app-border);
        box-shadow: var(--app-shadow);
    }

    /* Hero mobil uygulama stili */
    body.mobile-app-theme .hero-pro,
    body.mobile-app-theme .hero-slider {
        border-radius: 0 0 var(--app-radius) var(--app-radius);
        overflow: hidden;
        margin-bottom: 8px;
    }

    body.mobile-app-theme .hero-pro-slide .hero-pro-content h1,
    body.mobile-app-theme .hero-slide .hero-content h1 {
        font-size: 1.65rem;
    }

    /* Footer sadeleştir */
    body.mobile-app-theme .site-footer {
        margin-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        border-radius: var(--app-radius) var(--app-radius) 0 0;
        overflow: hidden;
    }

    body.mobile-app-theme .footer-social-strip,
    body.mobile-app-theme .footer-sustainability,
    body.mobile-app-theme .footer-quick-form {
        display: none;
    }

    body.mobile-app-theme .footer-main {
        padding: 28px 0 16px;
    }

    body.mobile-app-theme .footer-main .col-lg-2,
    body.mobile-app-theme .footer-main .col-md-6:not(:first-child):not(:last-child) {
        display: none;
    }

    body.mobile-app-theme .footer-bottom {
        padding: 12px 0;
        font-size: 0.8rem;
    }

    body.mobile-app-theme .footer-bottom .col-md-6:last-child {
        display: none;
    }

    /* Yüzen butonlar — tab bar üstünde */
    body.mobile-app-theme .back-to-top {
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
        right: 16px;
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }

    body.mobile-app-theme.has-whatsapp-float .back-to-top {
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 72px);
    }

    body.mobile-app-theme .whatsapp-float {
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    /* Alt tab bar */
    body.mobile-app-theme .mobile-app-tabbar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--app-surface);
        border-top: 1px solid var(--app-border);
        box-shadow: 0 -4px 20px rgba(15, 28, 46, 0.08);
        align-items: stretch;
        justify-content: space-around;
    }

    body.mobile-app-theme .mobile-app-tabbar .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px;
        color: var(--gray-500);
        font-size: 0.65rem;
        font-weight: 600;
        text-decoration: none;
        border: none;
        background: none;
        cursor: pointer;
        transition: color 0.2s ease;
        min-width: 0;
    }

    body.mobile-app-theme .mobile-app-tabbar .tab-item i {
        font-size: 1.35rem;
        line-height: 1;
    }

    body.mobile-app-theme .mobile-app-tabbar .tab-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    body.mobile-app-theme .mobile-app-tabbar .tab-item.active,
    body.mobile-app-theme .mobile-app-tabbar .tab-item.is-active {
        color: var(--navy-800);
    }

    body.mobile-app-theme .mobile-app-tabbar .tab-item.active i,
    body.mobile-app-theme .mobile-app-tabbar .tab-item.is-active i {
        transform: scale(1.05);
    }

    /* Menü paneli (bottom sheet) */
    body.mobile-app-theme .mobile-app-sheet-backdrop {
        display: block !important;
        position: fixed;
        inset: 0;
        z-index: 1060;
        background: rgba(10, 37, 64, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    body.mobile-app-theme .mobile-app-sheet-backdrop.is-open {
        opacity: 1;
        visibility: visible;
    }

    body.mobile-app-theme .mobile-app-sheet {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1070;
        max-height: 85vh;
        background: var(--app-surface);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(15, 28, 46, 0.15);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    body.mobile-app-theme .mobile-app-sheet.is-open {
        transform: translateY(0);
    }

    body.mobile-app-theme .mobile-app-sheet-handle {
        width: 40px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }

    body.mobile-app-theme .mobile-app-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px 8px;
        border-bottom: 1px solid var(--app-border);
    }

    body.mobile-app-theme .mobile-app-sheet-header h3 {
        font-size: 1.1rem;
        margin: 0;
        color: var(--navy-900);
    }

    body.mobile-app-theme .mobile-app-sheet-close {
        width: 36px;
        height: 36px;
        border: none;
        background: var(--gray-100);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--gray-700);
        font-size: 1.1rem;
        cursor: pointer;
    }

    body.mobile-app-theme .mobile-app-sheet-body {
        overflow-y: auto;
        padding: 8px 0 20px;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 20px;
        color: var(--gray-900);
        font-weight: 600;
        font-size: 0.95rem;
        text-decoration: none;
        border-bottom: 1px solid var(--app-border);
        transition: background 0.15s ease;
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-link:last-child {
        border-bottom: none;
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-link:active {
        background: var(--navy-50);
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-link.active {
        color: var(--navy-800);
        background: var(--navy-50);
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-link i {
        width: 24px;
        text-align: center;
        color: var(--navy-700);
        font-size: 1.1rem;
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-sublink {
        padding-left: 56px;
        font-weight: 500;
        font-size: 0.88rem;
        color: var(--gray-700);
    }

    body.mobile-app-theme .mobile-app-sheet-body .sheet-cta {
        margin: 16px 20px 0;
        display: block;
        text-align: center;
        padding: 14px;
        background: var(--gradient-primary);
        color: #fff !important;
        border-radius: 12px;
        font-weight: 700;
    }

    /* Sayfa başlıkları */
    body.mobile-app-theme .page-hero {
        padding: 24px 0;
        margin-bottom: 0;
    }

    body.mobile-app-theme .page-hero h1 {
        font-size: 1.5rem;
    }

    /* Form elemanları */
    body.mobile-app-theme .form-control,
    body.mobile-app-theme .form-select {
        border-radius: 12px;
        padding: 12px 14px;
        font-size: 16px; /* iOS zoom önleme */
    }

    body.mobile-app-theme .btn {
        border-radius: 12px;
    }

    /* Çerez banner tab bar üstünde */
    body.mobile-app-theme #cookieBanner {
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
    }
}
