/* css/components/mobile-landing.css - Mobile Landing Page Styles */
/* Responsive mobile-only interface for phones and small tablets */

/* Mobile container - hidden by default, shown on mobile devices */
#mobile-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #FCFCFF;
  flex-direction: column;
  overflow: hidden;
  z-index: 100; /* Above dashboard content, but below modals (999) */
  /* iOS safe area padding */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

#mobile-container.mobile-mode {
  display: flex;
}

/* Dark theme support */
body.theme-dark #mobile-container {
  background: #1c1c1e;
}

/* Mobile Header - simplified with back button */
.mobile-header {
  background: transparent;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  flex-shrink: 0;
}

/* Back button */
.mobile-back-btn {
  background: transparent;
  border: none;
  color: #ff9500;
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}

.mobile-back-btn:active {
  opacity: 0.6;
}

.mobile-back-btn svg {
  width: 20px;
  height: 20px;
}

body.theme-dark .mobile-back-btn {
  color: #ffaa00;
}

.mobile-header .family-name {
  font-size: 17px;
  font-weight: 600;
  color: #9e9e9e;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.theme-dark .mobile-header .family-name {
  color: #b0b0b0;
}

.mobile-header .profile-pic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.theme-dark .mobile-header .profile-pic {
  border-color: #2c2c2e;
}

/* Mobile Content - New flexbox layout matching FamilyAuth */
.mobile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 40px 20px;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Main content area - centers vertically like FamilyAuth */
.mobile-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 0;
}

/* Dashie Logo - Simpler responsive sizing */
#mobile-container .dashie-logo {
  width: 180px;
  height: auto;
  opacity: 1 !important;
  margin-bottom: 40px;
  flex-shrink: 0;
  /* Force orange logo on mobile - override theme logo changes */
  content: url('/artwork/Dashie_Full_Logo_Orange_Transparent.png') !important;
}

/* Settings Button - Now in flex layout */
.orange-button {
  background: linear-gradient(135deg, #EE9828 0%, #F5A942 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(238, 152, 40, 0.3);
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 200px;
  margin-bottom: 12px;
}

.orange-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.orange-button:not(:disabled):active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(238, 152, 40, 0.4);
}

.orange-button:not(:disabled):hover {
  box-shadow: 0 6px 16px rgba(238, 152, 40, 0.4);
}

/* Logout Button - Now in flex layout */
.secondary-button {
  background: transparent;
  color: #999999;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  padding: 12px 36px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 200px;
}

body.theme-dark .secondary-button {
  border-color: #3A3A3A;
  color: #B0B0B0;
}

.secondary-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.secondary-button:not(:disabled):active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.05);
}

body.theme-dark .secondary-button:not(:disabled):active {
  background: rgba(255, 255, 255, 0.05);
}

.secondary-button:not(:disabled):hover {
  border-color: #666666;
  color: #CCCCCC;
}

/* Mobile Loading Spinner - Circular loader */
.mobile-loading-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 30px 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-loading-bar.active {
  opacity: 1;
}

.mobile-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 149, 0, 0.1);
  border-top-color: #ff9500;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.mobile-progress-text {
  font-size: 16px;
  color: #616161;
  text-align: center;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.theme-dark .mobile-progress-text {
  color: #b0b0b0;
}

body.theme-dark .mobile-loading-spinner {
  border-color: rgba(255, 170, 0, 0.1);
  border-top-color: #ffaa00;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Small phones (iPhone SE, etc) - height < 670px */
@media (max-height: 670px) {
  #mobile-container .dashie-logo {
    width: min(200px, 60vw);
    margin-bottom: 30px;
  }

  .orange-button {
    padding: 14px 40px;
    font-size: 17px;
    width: 180px;
  }

  .secondary-button {
    padding: 10px 32px;
    font-size: 15px;
    width: 180px;
  }

  .mobile-loading-bar {
    margin: 20px 0;
    gap: 16px;
  }

  .mobile-loading-spinner {
    width: 40px;
    height: 40px;
  }

  .mobile-progress-text {
    font-size: 15px;
  }

  .mobile-content {
    padding: 30px 20px;
  }
}

/* Very small phones (iPhone SE in landscape, old Android) - height < 568px */
@media (max-height: 568px) {
  #mobile-container .dashie-logo {
    width: min(160px, 50vw);
    margin-bottom: 25px;
  }

  .orange-button {
    padding: 12px 36px;
    font-size: 16px;
    width: 160px;
  }

  .secondary-button {
    padding: 9px 28px;
    font-size: 14px;
    width: 160px;
  }

  .mobile-loading-bar {
    margin: 15px 0;
    gap: 14px;
  }

  .mobile-loading-spinner {
    width: 36px;
    height: 36px;
  }

  .mobile-progress-text {
    font-size: 14px;
  }

  .mobile-header {
    min-height: 50px;
    padding: 8px 16px;
  }

  .mobile-content {
    padding: 25px 20px;
  }
}

/* Tall phones (iPhone 14 Pro Max, etc) - height > 844px */
@media (min-height: 844px) {
  #mobile-container .dashie-logo {
    width: min(280px, 75vw);
    margin-bottom: 50px;
  }

  .orange-button {
    padding: 18px 56px;
    font-size: 19px;
    width: 220px;
  }

  .secondary-button {
    padding: 14px 42px;
    font-size: 17px;
    width: 220px;
  }

  .mobile-loading-bar {
    margin: 40px 0;
    gap: 24px;
  }

  .mobile-loading-spinner {
    width: 56px;
    height: 56px;
  }

  .mobile-progress-text {
    font-size: 17px;
  }

  .mobile-content {
    padding: 50px 20px;
  }
}

/* Landscape orientation - compress vertical spacing */
@media (orientation: landscape) and (max-height: 500px) {
  #mobile-container .dashie-logo {
    width: min(140px, 40vw);
    margin-bottom: 20px;
  }

  .orange-button {
    padding: 10px 32px;
    font-size: 15px;
    width: 180px;
  }

  .secondary-button {
    padding: 8px 24px;
    font-size: 13px;
    width: 180px;
  }

  .mobile-loading-bar {
    margin: 15px 0;
    gap: 12px;
  }

  .mobile-loading-spinner {
    width: 32px;
    height: 32px;
  }

  .mobile-progress-text {
    font-size: 13px;
  }

  .mobile-header {
    min-height: 45px;
    padding: 6px 12px;
  }

  .mobile-content {
    padding: 20px 20px;
  }
}

/* Hide dashboard elements when mobile mode is active */
body.mobile-mode-active #dashboard-container {
  display: none !important;
  visibility: hidden !important;
}

/* Note: #oauth-login-screen is NOT hidden here - it needs to be visible
   during authentication on mobile. It will be hidden by hideLoginScreen()
   in auth-initializer.js after authentication completes */

/* ========================================
   DISABLE FOCUS STYLES ON MOBILE
   D-pad focus highlighting is not needed for touchscreen devices
   ======================================== */

body.mobile-mode-active *:focus,
body.mobile-mode-active *:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: inherit !important;
}

body.mobile-mode-active button:focus,
body.mobile-mode-active a:focus,
body.mobile-mode-active input:focus,
body.mobile-mode-active select:focus,
body.mobile-mode-active textarea:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Remove any focus rings from Settings modal and other UI elements */
body.mobile-mode-active .dashie-modal *:focus,
body.mobile-mode-active .dashie-modal *:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ========================================
   MOBILE LEGAL LINKS (Privacy & Terms)
   Matches FamilyAuth footer style
   ======================================== */

.mobile-legal-links {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: #9e9e9e;
  padding-top: 20px;
  border-top: 1px solid #E0E0E0;
  flex-shrink: 0;
  margin-top: auto;
}

body.theme-dark .mobile-legal-links {
  border-top-color: #3A3A3A;
}

.mobile-legal-links a {
  color: #1a73e8;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.mobile-legal-links a:active {
  color: #0d47a1;
  background: rgba(26, 115, 232, 0.1);
}

.mobile-legal-links .separator {
  margin: 0 6px;
  color: #bdbdbd;
}

body.theme-dark .mobile-legal-links {
  color: #b0b0b0;
}

body.theme-dark .mobile-legal-links a {
  color: #4da3ff;
}

body.theme-dark .mobile-legal-links a:active {
  color: #80bdff;
  background: rgba(77, 163, 255, 0.15);
}

/* Responsive adjustments for mobile legal links */
@media (max-height: 670px) {
  .mobile-legal-links {
    padding-top: 15px;
    font-size: 12px;
  }
}

@media (max-height: 568px) {
  .mobile-legal-links {
    padding-top: 10px;
    font-size: 11px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .mobile-legal-links {
    padding-top: 8px;
    font-size: 10px;
  }

  .mobile-legal-links a {
    padding: 3px 6px;
  }

  .mobile-legal-links .separator {
    margin: 0 4px;
  }
}
