/* Simba Studio Suite - Universal Mobile App Styling & Security Shield */

/* Safe Area Inset Support for Modern Notched Smartphones */
:root {
  --app-safe-bottom: env(safe-area-inset-bottom, 12px);
  --app-gold: #d4af37;
  --app-gold-glow: rgba(212, 175, 55, 0.35);
  --app-bg: #0a0b0e;
  --app-card-bg: rgba(18, 20, 26, 0.96);
}

/* Base Body Adjustment when App Dock is Active */
body.simba-app-mode {
  padding-bottom: calc(68px + var(--app-safe-bottom)) !important;
}

/* Offset existing floating contact button in app mode so it doesn't overlap dock */
body.simba-app-mode .fast-inquire-float {
  bottom: calc(78px + var(--app-safe-bottom)) !important;
}

/* --- 1. Universal Native Bottom Navigation Dock --- */
.simba-app-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--app-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(212, 175, 55, 0.22);
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 12px calc(8px + var(--app-safe-bottom)) 12px;
  box-sizing: border-box;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.simba-app-dock.dock-hidden {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.simba-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #8e99a8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 10px;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-width: 62px;
  cursor: pointer;
  border: none;
  background: transparent;
}

.simba-dock-item .dock-icon {
  font-size: 18px;
  margin-bottom: 3px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.simba-dock-item:hover {
  color: #e2e8f0;
}

.simba-dock-item:hover .dock-icon {
  transform: translateY(-2px);
  color: var(--app-gold);
}

.simba-dock-item.active {
  color: #ffffff;
}

.simba-dock-item.active .dock-icon {
  color: var(--app-gold);
  transform: translateY(-2px) scale(1.1);
  text-shadow: 0 0 12px var(--app-gold-glow);
}

.simba-dock-item.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--app-gold);
  box-shadow: 0 0 8px var(--app-gold);
}

/* Badge on Legal Vault */
.simba-dock-badge {
  position: absolute;
  top: 0px;
  right: 12px;
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* --- 2. Military-Grade App Privacy Guard (App Switcher Anti-Snoop Shield) --- */
#app-privacy-guard {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 9, 13, 0.985);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

#app-privacy-guard.active {
  display: flex !important;
  animation: appGuardFadeIn 0.25s ease-out;
}

@keyframes appGuardFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.privacy-guard-card {
  background: #12141a;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 20px;
  padding: 36px 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 40px rgba(212, 175, 55, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.privacy-guard-crest {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--app-gold);
  box-shadow: 0 0 25px var(--app-gold-glow);
  margin-bottom: 20px;
  animation: crestPulse 2.5s infinite ease-in-out;
}

@keyframes crestPulse {
  0% { transform: scale(1); box-shadow: 0 0 20px var(--app-gold-glow); }
  50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(212, 175, 55, 0.55); }
  100% { transform: scale(1); box-shadow: 0 0 20px var(--app-gold-glow); }
}

.privacy-guard-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--app-gold);
  text-transform: uppercase;
  margin: 0 0 8px 0;
}

.privacy-guard-subtitle {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 24px 0;
}

.privacy-guard-btn {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #d4af37 0%, #aa820a 100%);
  color: #000;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.privacy-guard-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.5);
}

/* --- 3. Browser PWA Install Prompt Banner --- */
.simba-install-banner {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(18, 20, 26, 0.96);
  border: 1px solid rgba(212, 175, 55, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.85), 0 0 20px rgba(212, 175, 55, 0.2);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 380px;
  animation: bannerSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from { transform: translateY(-40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.install-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--app-gold);
  flex-shrink: 0;
}

.install-banner-text {
  display: flex;
  flex-direction: column;
}

.install-banner-title {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.install-banner-sub {
  color: #94a3b8;
  font-size: 11px;
  margin: 2px 0 0 0;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.install-banner-btn {
  background: linear-gradient(135deg, #d4af37, #aa820a);
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.install-banner-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.install-banner-close:hover {
  color: #ffffff;
}

@media (max-width: 500px) {
  .simba-install-banner {
    top: auto;
    bottom: calc(76px + var(--app-safe-bottom));
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* ==========================================================================
   4. MULTI-FORM FACTOR COMPATIBILITY & ADAPTIVE RESPONSIVENESS
   Supports: iPhones (SE to Pro Max), Androids, iPads / Tablets & Foldables
   ========================================================================== */

/* Hardware Performance Acceleration & Touch Polish */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Fast tap response restricted strictly to interactive elements, allowing smooth trackpad and mousewheel gestures on all containers */
button,
a,
input,
select,
textarea,
label,
[role="button"],
.btn,
.sidebar-btn,
.nav-link,
.vault-key,
.vault-pill,
.filter-btn,
.action-btn {
  touch-action: manipulation;
}

body.simba-app-mode {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.simba-app-dock,
.privacy-guard-card,
.portal-card {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* --- A. Foldable Phones: Folded Outer Narrow Screens (<= 360px) --- */
@media (max-width: 360px) {
  .simba-app-dock {
    padding-left: 4px;
    padding-right: 4px;
  }
  .simba-dock-item {
    min-width: 48px;
    padding: 3px 6px;
    font-size: 10px;
  }
  .simba-dock-item .dock-icon {
    font-size: 16px;
  }
  .app-header {
    padding: 16px 12px;
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    align-self: flex-end;
  }
}

/* --- B. Foldable Phones: Unfolded Square / Tablet Screen (e.g., Galaxy Z Fold, Pixel Fold) --- */
@media (min-width: 600px) and (max-width: 900px) and (min-aspect-ratio: 4/5) and (max-aspect-ratio: 5/4) {
  .app-container {
    max-width: 92%;
  }
  .portal-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px;
  }
  .portal-card {
    padding: 24px;
  }
}

/* Foldables CSS Spanning Specification (Dual-Screen / Fold Postures) */
@media (spanning: single-fold-vertical) {
  .app-container {
    display: grid;
    grid-template-columns: env(fold-left, 1fr) calc(100vw - env(fold-left, 1fr) - env(fold-width, 20px));
    gap: env(fold-width, 24px);
  }
}

/* --- C. iPads & Tablets (768px to 1180px in Portrait & Landscape) --- */
@media (min-width: 768px) and (max-width: 1180px) {
  .app-container {
    max-width: 740px;
  }
  .simba-app-dock {
    max-width: 680px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
    border-left: 1px solid rgba(212, 175, 55, 0.25);
    border-right: 1px solid rgba(212, 175, 55, 0.25);
  }
  .portal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* --- D. iPhone Dynamic Island, Notch & Landscape Safe Area Handling --- */
@supports (padding: env(safe-area-inset-top)) {
  body.simba-app-mode {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 16px)) !important;
  }
  .simba-app-dock {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 12px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
}

/* Hide .simba-app-dock on admin.html to let #mobile-admin-bar operate seamlessly */
body.is-admin-portal .simba-app-dock {
  display: none !important;
}

