﻿/* ==========================================================================
   DERSI.ONLINE â€” NATIVE MOBILE APP SHELL & BOTTOM TAB BAR
   Mobile-first, touch-optimized, iOS/Android safe area, and glassmorphism.
   ========================================================================== */

:root {
  --mobile-tab-height: 64px;
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Hide desktop navbar clutter on mobile and adjust main padding */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(var(--mobile-tab-height) + var(--mobile-safe-bottom) + 12px) !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }

  input, textarea, select {
    user-select: text !important;
    -webkit-user-select: text !important;
  }

  /* Mobile App Bottom Tab Bar */
  .mobile-app-tabbar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-tab-height) + var(--mobile-safe-bottom));
    padding-bottom: var(--mobile-safe-bottom);
    background: rgba(9, 14, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
    z-index: 9990;
    align-items: center;
    justify-content: space-around;
  }

  .mobile-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
  }

  .mobile-tab-item.active {
    color: #FFFFFF;
  }

  .mobile-tab-item.active .mobile-tab-icon {
    transform: scale(1.15);
    color: #FF384C;
    filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.5));
  }

  .mobile-tab-icon {
    font-size: 1.35rem;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
  }

  /* Central Floating AI Solver FAB (Center Action Button) */
  .mobile-tab-fab {
    position: relative;
    top: -14px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF384C, #2563EB, #99000A);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFFFFF !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6), 0 0 0 4px #090E1A;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-tab-fab:active {
    transform: scale(0.92);
  }

  .mobile-tab-fab .mobile-tab-icon {
    font-size: 1.5rem;
    margin: 0;
  }

  /* Native Mobile App Header Stats Bar */
  .mobile-top-stats-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: rgba(13, 21, 39, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
  }

  /* Install App Banner for Mobile */
  .pwa-install-toast {
    position: fixed;
    top: 70px;
    left: 12px;
    right: 12px;
    background: linear-gradient(135deg, rgba(15, 26, 58, 0.98), rgba(26, 18, 48, 0.98));
    border: 1.5px solid rgba(37, 99, 235, 0.5);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: slideDownToast 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@media (min-width: 769px) {
  .mobile-app-tabbar, .mobile-top-stats-bar {
    display: none !important;
  }
}

@keyframes slideDownToast {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Mobile Frame Containment & Safe Boundaries */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

#app, main, .site-header, .site-footer {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Safe Area Insets for Notch / Dynamic Island / Bottom Home Bar */
.mobile-app-tabbar {
  padding-bottom: env(safe-area-inset-bottom, 8px) !important;
  height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
}

.site-header {
  padding-top: env(safe-area-inset-top, 0px) !important;
}
