/**
 * Navigation Components
 * Consolidated navigation styles for ListSpot system
 * Production-optimized version with minimal !important usage
 */

/* ============================================================================
   BASE NAVIGATION STYLES
   ============================================================================ */

.listspot-navigation {
  display: block;
  visibility: visible;
  width: 100%;
  min-width: 300px;
  min-height: 56px;
  position: relative;
  z-index: 100;
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  overflow: hidden;
}

/* Ensure all text content within navigation fits properly */
.listspot-navigation * {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Handle terms notice and comments text fitting */
.listspot-navigation .terms-notice,
.listspot-navigation .terms-content {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.listspot-navigation .nav-container {
  display: flex;
  width: 100%;
  min-width: 240px;
  min-height: 40px;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
}

.listspot-navigation .nav-actions {
  display: flex;
  min-width: 160px;
  min-height: 40px;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  box-sizing: border-box;
}

.listspot-navigation .nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-width: 100px;
  min-height: 2.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  transition: all 0.2s ease;
  text-align: center;
  max-width: 160px;
}



/* Button variants */
.listspot-navigation .start-fresh-btn {
  background-color: #ef4444;
  color: white;
}

.listspot-navigation .next-btn {
  background-color: #3b82f6;
  color: white;
}

.listspot-navigation .prev-btn {
  background-color: #6b7280;
  color: white;
}

.listspot-navigation .submit-btn {
  background-color: #10b981;
  color: white;
}

/* Button interactions */
.listspot-navigation .nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.listspot-navigation .nav-btn:active {
  transform: translateY(0);
}

.listspot-navigation .nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.listspot-navigation .nav-btn:disabled:hover {
  transform: none;
}

/* Mobile navigation */
@media (max-width: 768px) {
  .listspot-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
  }

  .listspot-navigation .nav-container {
    flex-direction: column;
    gap: 0.75rem;
    min-width: 200px;
  }

  .listspot-navigation .nav-actions {
    width: 100%;
    justify-content: center;
    gap: 0.75rem;
    min-width: 120px;
  }

  .listspot-navigation .nav-btn {
    flex: 1;
    min-width: 85px;
    max-width: 120px;
    padding: 0.75rem 0.75rem;
    font-size: 0.75rem;
    min-height: 2.25rem;
  }

  .listspot-navigation .start-fresh-btn {
    width: auto;
    margin-bottom: 0.5rem;
    max-width: 200px;
    min-height: 2.25rem;
    flex: 0 0 auto;
  }

  body {
    padding-bottom: 5rem;
  }

  body[data-step="2"] #step-2-content {
    margin-bottom: 5rem;
  }
}

/* Dark mode navigation */
.dark .listspot-navigation {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  color: #f9fafb;
}

@media (prefers-color-scheme: dark) {
  .listspot-navigation {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    color: #f9fafb;
  }
}

/* Dark mode mobile navigation */
@media (max-width: 768px) {
  .dark .listspot-navigation {
    background: #1f2937;
    border-top: 1px solid #374151;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Navigation icons */
.listspot-navigation .nav-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .listspot-navigation .nav-icon {
    width: 0.875rem;
    height: 0.875rem;
  }
}

@media (max-width: 480px) {
  .listspot-navigation .nav-icon {
    width: 0.75rem;
    height: 0.75rem;
  }

  .listspot-navigation .nav-btn {
    min-width: 75px;
    max-width: 100px;
    padding: 0.5rem 0.5rem;
    font-size: 0.7rem;
    gap: 0.25rem;
    min-height: 2rem;
  }

  .listspot-navigation .start-fresh-btn {
    max-width: 160px;
    min-width: 120px;
  }

  .listspot-navigation .nav-container {
    gap: 0.5rem;
    min-width: 180px;
  }

  .listspot-navigation .nav-actions {
    gap: 0.5rem;
    min-width: 100px;
  }

  .listspot-navigation {
    padding: 0.5rem;
  }
}

.dark .listspot-navigation .nav-icon {
  color: #f9fafb;
}

/* Dark mode button variants */
.dark .listspot-navigation .start-fresh-btn {
  background-color: #dc2626;
}

.dark .listspot-navigation .start-fresh-btn:hover {
  background-color: #b91c1c;
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.dark .listspot-navigation .next-btn {
  background-color: #2563eb;
}

.dark .listspot-navigation .next-btn:hover {
  background-color: #1d4ed8;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.dark .listspot-navigation .prev-btn {
  background-color: #4b5563;
}

.dark .listspot-navigation .prev-btn:hover {
  background-color: #374151;
  box-shadow: 0 4px 8px rgba(75, 85, 99, 0.3);
}

.dark .listspot-navigation .submit-btn {
  background-color: #059669;
}

.dark .listspot-navigation .submit-btn:hover {
  background-color: #047857;
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.dark .listspot-navigation .terms-notice {
  background: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

.dark .listspot-navigation .terms-link {
  color: #60a5fa;
}

.dark .listspot-navigation .terms-link:hover {
  color: #93c5fd;
}

/* Step-based visibility */
.listspot-navigation .nav-btn.submit-btn {
  display: none;
}

body[data-step="3"] .listspot-navigation .nav-btn.submit-btn {
  display: flex;
}

body[data-step="3"] .listspot-navigation .nav-btn.next-btn {
  display: none;
}

body[data-step="1"] .listspot-navigation .nav-btn.prev-btn {
  opacity: 0.5;
  cursor: not-allowed;
}

.listspot-navigation .terms-notice {
  display: none;
}

body[data-step="3"] .listspot-navigation .terms-notice {
  display: block;
}

/* ============================================================================
   SUBMIT BUTTON HELPER COMMENT
   ============================================================================ */

/* Submit button container for proper positioning */
.listspot-navigation .submit-btn-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

/* Submit helper comment - hidden by default */
.listspot-navigation .submit-helper-comment {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  pointer-events: none;
}

.listspot-navigation .submit-helper-comment .helper-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  line-height: 1.2;
  text-align: center;
}

/* Show submit helper comment only on step 3 */
body[data-step="3"] .listspot-navigation .submit-helper-comment {
  display: block;
}

/* Dark mode styling for submit helper */
.dark .listspot-navigation .submit-helper-comment {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .listspot-navigation .submit-helper-comment .helper-text {
  color: #cbd5e1;
}

/* Mobile adjustments for submit helper */
@media (max-width: 768px) {
  .listspot-navigation .submit-helper-comment {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-top: 0.375rem;
    margin-bottom: 0;
    font-size: 0.7rem;
    padding: 0.375rem 0.5rem;
    max-width: 200px;
    white-space: normal;
    text-align: center;
  }

  .listspot-navigation .submit-helper-comment .helper-text {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .listspot-navigation .submit-helper-comment {
    font-size: 0.65rem;
    padding: 0.25rem 0.375rem;
    max-width: 160px;
  }

  .listspot-navigation .submit-helper-comment .helper-text {
    font-size: 0.65rem;
  }
}

/* ============================================================================
   PROGRESS BAR SYSTEM
   ============================================================================ */

#progress-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  z-index: 50;
  /* Invisible container: only indicators/labels should be seen */
  min-height: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  pointer-events: none; /* don't block interactions below */
}

#progress-bar .max-w-2xl,
#progress-bar .max-w-4xl {
  padding: 0.25rem 1rem;
}

#progress-line {
  height: 4px;
  background: linear-gradient(90deg, var(--primary-blue) 0%, var(--primary-blue-hover) 100%);
  border-radius: 2px;
  transition: width 0.5s ease;
  position: relative;
  width: 0%;
  max-width: 100%;
}

#progress-line-container {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Step indicators */
.step-indicator {
  min-width: 45px;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.step-circle {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.3s ease;
  margin-bottom: 0.1rem;
}

.step-circle.active {
  background: #3b82f6;
  color: white;
  transform: scale(1.1);
}

.step-circle.completed {
  background: #10b981;
  color: white;
}

.step-label {
  max-width: 80px;
  text-align: center;
}

.step-label p {
  font-size: 0.625rem;
  line-height: 1;
  margin: 0;
  color: #6b7280;
}

.step-label p:first-child {
  font-weight: 600;
  color: #374151;
}

#progressPercentage,
#progressText {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

/* Disable default mobile/desktop progress containers; template-specific styles handle visibility */
.mobile-progress { display: none !important; }
.desktop-progress { background: transparent !important; border: 0 !important; box-shadow: none !important; }

@media (max-width: 768px) {
  .mobile-progress { display: none !important; }
  .desktop-progress { display: block !important; background: transparent !important; box-shadow: none !important; }

  #progress-bar {
    min-height: 40px;
  }

  .step-indicator {
    min-width: 40px;
    min-height: 40px;
  }

  .step-circle {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.625rem;
  }

  .step-label {
    max-width: 60px;
  }

  .step-label p {
    font-size: 0.5rem;
  }
}

/* Dark mode progress bar */
.dark #progress-bar {
  background: transparent !important;
  border-bottom-color: transparent !important;
}

.dark #progress-line {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.dark #progress-line-container {
  background: #374151;
}

/* Dark mode step elements */
.dark .step-circle {
  background: #374151;
  color: #9ca3af;
}

.dark .step-circle.active {
  background: #60a5fa;
  color: white;
}

.dark .step-circle.completed {
  background: #34d399;
  color: white;
}

.dark .step-label p {
  color: #9ca3af;
}

.dark .step-label p:first-child {
  color: #d1d5db;
}

.dark #progressPercentage,
.dark #progressText {
  color: #d1d5db;
}

/* ============================================================================
   MODERN NAVIGATION ENHANCEMENTS
   ============================================================================ */

/* Modern navigation bar styling from custom.css */
nav {
  backdrop-filter: blur(10px);
  background: rgb(255 255 255 / 95%);
  border-bottom: 1px solid rgb(0 0 0 / 10%);
  transition: all 0.3s ease;
}

html.dark nav {
  background: rgb(17 24 39 / 95%);
  border-bottom-color: rgb(255 255 255 / 10%);
}

/* Navigation container constraints */
nav .max-w-6xl {
  max-width: 72rem; /* 1152px - industry standard */
}

/* Logo enhancements */
nav .flex-shrink-0 a {
  transition: transform 0.2s ease;
}

nav .flex-shrink-0 a:hover {
  transform: scale(1.05);
}

/* Navigation link improvements */
nav a {
  position: relative;
  transition: all 0.2s ease;
}

nav a:hover {
  transform: translateY(-1px);
}

/* Active state enhancements */
nav a.border-blue-600 {
  border-bottom-width: 3px;
  font-weight: 600;
}

/* Dropdown improvements */
.dropdown-menu {
  backdrop-filter: blur(10px);
  background: rgb(255 255 255 / 98%);
  border: 1px solid rgb(0 0 0 / 10%);
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 10%), 0 10px 10px -5px rgb(0 0 0 / 4%);
}

html.dark .dropdown-menu {
  background: rgb(17 24 39 / 98%);
  border-color: rgb(255 255 255 / 10%);
}

/* User menu button styling */
#user-menu-button {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  padding: 0.5rem !important;
  background-color: var(--color-gray-100) !important;
  border: 2px solid var(--color-gray-300) !important;
  transition: all var(--transition-base) !important;
  border-radius: var(--border-radius-base);
}

#user-menu-button:hover {
  background-color: var(--color-gray-200) !important;
  border-color: var(--color-primary-blue) !important;
  transform: scale(1.05) !important;
}

.dark #user-menu-button {
  background-color: var(--color-gray-700) !important;
  border-color: var(--color-gray-600) !important;
}

.dark #user-menu-button:hover {
  background-color: var(--color-gray-600) !important;
  border-color: var(--color-primary-blue) !important;
}

/* Avatar visibility fix */
#user-menu-button .h-8.w-8,
#user-menu-button .h-10.w-10 {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Mobile menu improvements */
#mobile-menu {
  backdrop-filter: blur(10px);
  background: rgb(255 255 255 / 98%);
  border-top: 1px solid rgb(0 0 0 / 10%);
}

html.dark #mobile-menu {
  background: rgb(17 24 39 / 98%);
  border-top-color: rgb(255 255 255 / 10%);
}

/* Mobile menu item enhancements */
#mobile-menu a {
  transition: all 0.2s ease;
}

#mobile-menu a:hover {
  transform: translateX(4px);
}

/* Theme toggle improvements */
#theme-toggle,
#theme-toggle-mobile {
  position: relative;
  overflow: hidden;
}

#theme-toggle::before,
#theme-toggle-mobile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#theme-toggle:hover::before,
#theme-toggle-mobile:hover::before {
  opacity: 0.1;
}

/* Responsive improvements */
@media (width <= 768px) {
  nav .max-w-6xl {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  nav .flex-shrink-0 img {
    height: 2rem;
  }

  #user-menu-button {
    padding: 0.75rem !important;
    border-width: 2px !important;
  }
}

/* Focus states for accessibility */
nav button:focus,
nav a:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
nav * {
  transition: all 0.2s ease;
}

/* ============================================================================
   MOBILE PROGRESS BAR SYSTEM
   ============================================================================ */

/* Mobile progress bar styles from listspot-unified.css */
.mobile-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  z-index: 999;
  display: block !important;
}

.mobile-step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mobile-step-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #d1d5db;
  transition: all 0.3s ease;
}

.mobile-step-dot.active {
  background: var(--primary-color);
  transform: scale(1.2);
}

.mobile-step-dot.completed {
  background: var(--success-color);
}

.mobile-back-btn {
  position: fixed;
  top: 5rem;
  left: 1rem;
  z-index: 30;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.mobile-back-btn:hover {
  background: var(--bg-secondary);
}

/* Mobile progress bar responsive behavior */
@media (width <= 768px) {
  .mobile-progress {
    display: block !important;
  }
}

@media (width >= 769px) {
  .mobile-progress,
  .mobile-progress-wrapper,
  .mobile-step-indicator,
  .mobile-progress-title,
  .mobile-progress-track {
    display: none !important;
  }
}

/* ============================================================================
   FIX: NAVIGATION BUTTON TEXT DISPLAY
   ============================================================================ */

/* Enhanced nav-text elements with better text handling */
.listspot-navigation .nav-text {
  display: inline-block;
  text-align: center;
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

/* Improved responsive text visibility */
@media (max-width: 768px) {
  .listspot-navigation .nav-text-full {
    display: none !important;
    visibility: hidden !important;
  }
  .listspot-navigation .nav-text-short {
    display: inline-block !important;
    visibility: visible !important;
  }

  /* Ensure text fits in mobile buttons */
  .listspot-navigation .nav-text {
    max-width: 60px;
    font-size: 0.75rem;
  }
}

/* Desktop view - show full text with proper constraints */
@media (min-width: 769px) {
  .listspot-navigation .nav-text-full {
    display: inline-block !important;
    visibility: visible !important;
  }
  .listspot-navigation .nav-text-short {
    display: none !important;
    visibility: hidden !important;
  }

  /* Ensure text fits in desktop buttons */
  .listspot-navigation .nav-text {
    max-width: 120px;
  }
}

/* Extra small screens - ultra-compact text */
@media (max-width: 480px) {
  .listspot-navigation .nav-text {
    max-width: 45px;
    font-size: 0.7rem;
  }
}
