/* =========================================================
   Savoka Mobile App Shell
   Makes the public site feel like a native mobile app ≤900px
   ========================================================= */

:root {
    --app-header-h: 56px;
    --app-tabbar-h: 64px;
    --app-safe-top: env(safe-area-inset-top, 0px);
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-surface: rgba(12, 14, 28, 0.92);
    --app-surface-solid: #0c0e1c;
    --app-border: rgba(255, 255, 255, 0.08);
    --app-accent: #00d4ff;
    --app-muted: #9aa0b5;
}

/* App-capable viewport extras (meta also set in HTML) */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 900px) {
    html,
    body {
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        background: #070812;
        color: #ffffff;
        color-scheme: dark;
    }

    body {
        padding-top: calc(var(--app-header-h) + var(--app-safe-top));
        padding-bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 12px);
        min-height: 100dvh;
    }

    /* Ensure text stays visible on dark mobile surfaces */
    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    li,
    label,
    .section-description,
    .hero-description,
    .service-description-3d,
    .footer-links a,
    .footer-section p {
        color: inherit;
    }

    .section-description,
    .hero-description,
    .service-description-3d,
    .form-help {
        color: var(--text-secondary, #b0b0b0);
    }

    .form-label,
    .section-title,
    .contact-info h3,
    .footer-section h3 {
        color: var(--text-primary, #ffffff);
    }

    .form-input,
    .form-textarea,
    input,
    textarea,
    select {
        color: #ffffff !important;
        background-color: rgba(255, 255, 255, 0.06) !important;
        border-color: rgba(255, 255, 255, 0.12) !important;
    }

    input::placeholder,
    textarea::placeholder {
        color: #888888 !important;
        opacity: 1;
    }

    /* ---- Compact app header ---- */
    .nav-3d {
        height: calc(var(--app-header-h) + var(--app-safe-top));
        padding-top: var(--app-safe-top);
        background: var(--app-surface) !important;
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid var(--app-border);
        box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .nav-3d.scrolled {
        background: rgba(8, 10, 22, 0.96) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    }

    .nav-container {
        height: var(--app-header-h);
        padding: 0 1rem;
        max-width: none;
    }

    .logo-3d {
        font-size: 1.15rem;
        letter-spacing: 0.04em;
    }

    .nav-menu,
    .nav-toggle {
        display: none !important;
    }

    /* ---- Bottom tab bar ---- */
    .mobile-app-tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        height: calc(var(--app-tabbar-h) + var(--app-safe-bottom));
        padding: 0 0.35rem var(--app-safe-bottom);
        background: var(--app-surface);
        backdrop-filter: saturate(180%) blur(22px);
        -webkit-backdrop-filter: saturate(180%) blur(22px);
        border-top: 1px solid var(--app-border);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
        justify-content: space-around;
        align-items: stretch;
    }

    .mobile-app-tabbar .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        min-width: 0;
        text-decoration: none;
        color: var(--app-muted);
        font-size: 0.65rem;
        font-weight: 600;
        font-family: var(--font-primary, Inter, system-ui, sans-serif);
        letter-spacing: 0.01em;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease, transform 0.15s ease;
        padding: 0.35rem 0.15rem;
        border-radius: 12px;
        position: relative;
    }

    .mobile-app-tabbar .tab-item i {
        font-size: 1.15rem;
        line-height: 1;
        transition: transform 0.2s ease;
    }

    .mobile-app-tabbar .tab-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .mobile-app-tabbar .tab-item.active {
        color: var(--app-accent);
    }

    .mobile-app-tabbar .tab-item.active i {
        transform: translateY(-1px) scale(1.08);
    }

    .mobile-app-tabbar .tab-item.active::before {
        content: "";
        position: absolute;
        top: 4px;
        width: 18px;
        height: 3px;
        border-radius: 999px;
        background: var(--app-accent);
        box-shadow: 0 0 12px rgba(0, 212, 255, 0.65);
    }

    .mobile-app-tabbar .tab-item:active {
        transform: scale(0.94);
    }

    /* ---- App-like content layout ---- */
    .hero-3d,
    section {
        scroll-margin-top: calc(var(--app-header-h) + var(--app-safe-top) + 8px);
    }

    .hero-3d {
        min-height: calc(100dvh - var(--app-header-h) - var(--app-tabbar-h) - var(--app-safe-top) - var(--app-safe-bottom));
        padding: 1.25rem 1rem 2rem !important;
        display: flex;
        align-items: center;
    }

    .hero-content {
        width: 100%;
        gap: 1.25rem !important;
    }

    .hero-title {
        font-size: clamp(1.65rem, 7vw, 2.1rem) !important;
        line-height: 1.15 !important;
    }

    .hero-description {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
    }

    .hero-buttons {
        width: 100%;
        gap: 0.75rem !important;
    }

    .btn-modern {
        border-radius: 14px !important;
        min-height: 48px;
        font-weight: 600;
        box-shadow: 0 8px 24px rgba(0, 212, 255, 0.18);
    }

    .btn-modern.btn-outline {
        box-shadow: none;
    }

    /* Card surfaces */
    .service-card-3d,
    .product-card,
    .portfolio-item,
    .portfolio-item-advanced,
    .stat-item,
    .contact-form-3d,
    .job-card,
    .team-card,
    .value-card,
    .process-step {
        border-radius: 18px !important;
        border: 1px solid var(--app-border) !important;
        background: rgba(255, 255, 255, 0.04) !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25) !important;
    }

    .section-title {
        font-size: 1.55rem !important;
        letter-spacing: -0.02em;
    }

    .section-subtitle,
    .hero-subtitle {
        font-size: 0.8rem !important;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    /* Reduce decorative / heavy layers for app feel + performance */
    .background-3d,
    .grid-background,
    .particles-container,
    .tech-grid {
        opacity: 0.25 !important;
        pointer-events: none;
    }

    .particles-container .particle {
        display: none;
    }

    .mascot-image.mascot-hero-enhanced {
        width: min(220px, 58vw) !important;
        height: auto !important;
    }

    .section-mascot .mascot-image,
    .mascot-scroll-slide {
        width: min(140px, 40vw) !important;
        height: auto !important;
    }

    /* App sheet sections */
    .services-3d,
    .products-3d,
    #products,
    #services,
    #portfolio,
    #about,
    #contact,
    .about-3d,
    .contact-3d,
    .portfolio-3d,
    .process-3d,
    .stats-3d {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Native-feeling list rows in footer links */
    .footer-links li {
        padding: 0.45rem 0;
    }

    .footer-links a {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
    }

    /* Soft page edge radius for “app canvas” */
    main,
    .page-content {
        border-radius: 0;
    }

    /* Hide oversized desktop-only mascot blocks a bit */
    .section-header-with-mascot {
        gap: 1rem !important;
        margin-bottom: 1.25rem !important;
    }

    /* Portfolio modal fills like an app screen */
    .portfolio-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }


    .footer-content {
        gap: 1.25rem !important;
    }

    .footer-bottom {
        padding-bottom: 0.25rem;
        font-size: 0.75rem;
    }

    /* WhatsApp FAB sits above tab bar */
    .whatsapp-float {
        bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 16px) !important;
        right: 14px !important;
        z-index: 1090;
    }

    .whatsapp-btn {
        width: 52px !important;
        height: 52px !important;
        border-radius: 16px !important;
        box-shadow: 0 10px 28px rgba(37, 211, 102, 0.4) !important;
    }

    .whatsapp-tooltip {
        display: none !important;
    }

    /* Forms feel native */
    input,
    textarea,
    select,
    button {
        font-size: 16px !important; /* prevents iOS zoom */
        border-radius: 12px;
    }

    /* Touch targets */
    a,
    button,
    .filter-btn,
    .nav-link {
        -webkit-tap-highlight-color: transparent;
    }

    /* Loading screen fills device safely */
    .loading-screen {
        padding-top: var(--app-safe-top);
        padding-bottom: var(--app-safe-bottom);
    }

    /* Standalone / installed PWA polish */
    @media (display-mode: standalone) {
        body {
            user-select: none;
            -webkit-user-select: none;
        }

        a,
        input,
        textarea {
            user-select: auto;
            -webkit-user-select: auto;
        }
    }
}

/* Hide tab bar on desktop */
@media (min-width: 901px) {
    .mobile-app-tabbar {
        display: none !important;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .mobile-app-tabbar .tab-item {
        font-size: 0.58rem;
    }

    .mobile-app-tabbar .tab-item i {
        font-size: 1.05rem;
    }

    .logo-3d {
        font-size: 1.05rem;
    }
}
