/* Responsive Design - Mobile Breakpoints */

/* Mobile Navigation - Bottom Nav for mobile devices */
.bottom-nav {
  display: none; /* Hidden on desktop */
}

/* Smallest Mobile Devices (under 350px) */
@media (max-width: 375px) {
  body {
    padding: 10px 10px 80px 10px; /* Extra tight padding for very small screens */
  }
  .sub-tabs {
    flex-direction: column; /* Stack tabs vertically */
    gap: 8px;
  }
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
  body {
    padding: 15px 15px 80px 15px; /* Tighter padding for small screens */
  }

  h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  /* Actions buttons - 2x2 grid for small screens */
  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Form elements optimization */
  input[type="text"],
  textarea {
    padding: 12px;
    font-size: 16px; /* Prevents iOS zoom - must be 16px+ */
    line-height: 1.4; /* Better readability on small screens */
    min-height: 44px; /* Touch target minimum */
    -webkit-appearance: none; /* Remove iOS styling */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
  }

  /* Field labels - more compact on small mobile */
  label.field-label {
    font-size: 11px;
    margin-bottom: 6px;
    letter-spacing: 0.3px; /* Tighter spacing */
  }

  /* Form groups - tighter spacing */
  .form-group {
    margin-bottom: 18px; /* Slightly less spacing */
  }

  /* Token info - stack vertically if needed, preserve BOLD GREEN savings */
  .token-info {
    font-size: 11px;
    line-height: 1.4;
  }

  .savings {
    display: block; /* Stack the savings on its own line for emphasis */
    margin-top: 2px;
    /* Keep bold and green - this is the money shot! */
    color: #2d5a3d !important; /* FORCE green - this is the value prop! */
    font-weight: bold !important; /* FORCE bold - must stand out! */
    font-size: 12px; /* Slightly larger for mobile visibility */
  }

  /* Output sections - optimize spacing */
  .output-section {
    margin-bottom: 15px;
  }

  #generated-prompt,
  #ai-response {
    min-height: 100px; /* Smaller height on mobile */
    font-size: 13px;
  }

  /* Copy button full width */
  #copy-prompt {
    width: 100%;
    margin-top: 8px;
  }
}

/* Mobile and Tablet (max-width: 768px) */
@media (max-width: 768px) {
  /* Hide only desktop mode nav buttons, keep mode-container visible */
  .mode-nav {
    display: none;
  }

  /* Optimize mode-container for mobile */
  .mode-container {
    border-width: 2px; /* Thinner border on mobile */
    margin-bottom: 15px;
  }

  /* Optimize sub-nav for mobile */
  .sub-nav {
    padding: 10px 15px; /* More comfortable padding */
  }

  .sub-tabs label {
    padding: 12px 16px; /* Enhanced touch targets */
    font-size: 14px; /* Slightly larger text */
    margin-right: 8px; /* Better spacing between touch targets */
    min-height: 44px; /* iOS recommended minimum touch target */
    min-width: 44px; /* Ensure width meets minimum too */
    display: flex;
    align-items: center; /* Center text vertically */
    justify-content: center; /* Center text horizontally */
  }

  /* Show and style bottom navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: black;
    border-top: 3px solid black;
    padding: 2px;
    z-index: 1000;
    gap: 2px;
  }

  /* Bottom navigation buttons */
  .nav-button {
    flex: 1;
    padding: 20px 10px;
    background: white;
    color: #555;
    border: none;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 700;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.1s ease;
    min-height: 44px; /* Accessibility: minimum touch target */
    text-align: center;
  }

  /* Touch feedback for all devices */
  .nav-button:active {
    background: #e0e0e0;
    transform: scale(0.98); /* Subtle press feedback */
  }

  /* Hover only for devices with hover capability */
  @media (hover: hover) {
    .nav-button:hover {
      background: #f0f0f0;
    }
  }

  /* Active state for bottom nav buttons */
  .nav-button.active {
    background: black;
    color: white;
  }

  /* Add padding to body to account for fixed bottom nav */
  body {
    padding-bottom: 80px; /* Space for bottom navigation */
    padding: 20px 20px 80px 20px; /* Adjust all padding for mobile */
  }

  /* Actions buttons - responsive layout for mobile */
  .actions {
    margin: 20px 0; /* Reduce margin on mobile */
    gap: 8px;
  }

  .actions button {
    flex: 1;
    min-width: 120px; /* Prevent buttons from getting too small */
    padding: 16px 20px; /* Enhanced touch targets */
    font-size: 13px;
    min-height: 44px; /* iOS minimum touch target */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Form elements - mobile optimization */
  input[type="text"],
  textarea {
    font-size: 16px; /* Prevents iOS zoom - must be 16px+ */
    padding: 14px; /* Enhanced touch padding */
    line-height: 1.5; /* Better readability */
    min-height: 44px; /* Touch target minimum */
    -webkit-appearance: none; /* Remove iOS styling */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
  }

  /* Field labels - mobile friendly */
  label.field-label {
    font-size: 12px;
    margin-bottom: 7px;
  }

  /* Form groups - mobile spacing */
  .form-group {
    margin-bottom: 20px;
  }

  /* Output sections - better mobile spacing */
  .output-section {
    margin-bottom: 20px;
  }

  .prompt-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .prompt-header h2 {
    margin: 0;
    font-size: 16px;
  }

  /* Token info mobile layout - keep savings PROMINENT */
  .token-info {
    font-size: 12px;
    flex: 1;
    min-width: 200px; /* Ensure it doesn't get crushed */
  }

  /* Ensure savings percentage stays BOLD and GREEN - the money shot! */
  .savings {
    /* Inherit bold and green from base styles, enhanced for mobile */
    color: #2d5a3d !important; /* Force green color */
    font-weight: bold !important; /* Force bold weight */
    font-size: 12px; /* Slightly larger on mobile for emphasis */
  }

  /* Textarea heights optimized for mobile */
  #generated-prompt,
  #ai-response {
    min-height: 120px;
    font-size: 13px;
  }

  /* Copy button optimized */
  #copy-prompt {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
  }

  /* Mobile typography adjustments */
  h1 {
    font-size: 24px;
    margin-bottom: 20px;
  }
}

/* Tablet Devices (769px - 1024px) - Hybrid Layout */
@media (min-width: 769px) and (max-width: 1024px) {
  body {
    max-width: 800px; /* Slightly smaller than desktop */
    padding: 25px;
  }

  /* Keep desktop navigation but optimize spacing */
  .mode-container {
    margin-bottom: 20px;
  }

  .sub-tabs label {
    padding: 8px 12px; /* Slightly smaller than desktop */
    font-size: 13px;
  }

  /* Actions in single row but with better spacing */
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .actions button {
    flex: 1;
    min-width: 120px; /* Ensure buttons don't get too narrow */
  }

  /* Token info remains prominent on tablets */
  .token-info {
    font-size: 13px;
  }

  /* Keep savings percentage BOLD and GREEN - money shot stays strong */
  .savings {
    /* Ensure bold and green are preserved on tablets */
    color: #2d5a3d !important; /* Force green */
    font-weight: bold !important; /* Force bold */
    font-size: 13px; /* Good size for tablets */
  }

  /* Optimize form elements for tablet touch */
  input[type="text"],
  textarea {
    font-size: 14px;
    padding: 11px;
    line-height: 1.5; /* Consistent readability */
  }

  /* Typography - optimal for tablet reading */
  h1 {
    font-size: 26px; /* Between mobile and desktop */
    margin-bottom: 25px;
  }

  h2 {
    font-size: 18px; /* Balanced heading size */
  }

  /* Form labels - tablet optimized */
  label.field-label {
    font-size: 12px;
    margin-bottom: 7px;
  }
}
