/* ===== BASE RESET & ACCESSIBILITY ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Comfortaa', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #2d3748;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== BACK NAVIGATION ===== */
/* ===== BACK NAVIGATION ===== */
.back-navigation {
  position: fixed;
  top: 2.7rem; /* Changed from 1.5rem - adds 15px (0.9rem) */
  left: 1.8rem;
  z-index: 1000;
}

.back-button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #667eea;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
  backdrop-filter: blur(10px);
}

.back-button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateX(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.back-button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Tooltip styling */
.back-button::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
  z-index: 1000;
  pointer-events: none;
}

.back-button::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a202c;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  margin-bottom: 0.125rem;
  z-index: 1000;
  pointer-events: none;
}

.back-button:hover::after,
.back-button:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .back-navigation {
    top: 1.9rem; /* Adjusted for mobile too */
    left: 1rem;
  }
  
  .back-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Mobile adjustments */
@media (max-width: 500px) {
  .back-navigation {
    top: 1rem;
    left: 1rem;
  }
  
  .back-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }
}

/* ===== LAYOUT ===== */
header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: #1a202c;
}

.subtitle {
  margin: 0 0 0.5rem;
  color: #718096;
  font-size: 0.95rem;
}

.usage-counter {
  font-size: 0.85rem;
  color: #718096;
  margin: 0.5rem 0 0;
  font-weight: 500;
}

.container {
  width: 100%;
  max-width: 500px;
  padding: 2rem 1.5rem;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== INPUT GROUP ===== */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  color: #2d3748;
  font-size: 0.9rem;
  margin-bottom: -0.5rem;
}

select,
input[type="text"] {
  padding: 0.875rem;
  font-size: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: #ffffff;
}

select:focus,
input[type="text"]:focus {
  border-color: #667eea;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232d3748' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.input-hint {
  display: block;
  margin-top: -0.5rem;
  font-size: 0.8rem;
  color: #718096;
  font-style: italic;
}

button {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== LOADING STATE ===== */
.loading {
  margin: 2rem 0;
  text-align: center;
  font-size: 1.1rem;
  color: #667eea;
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== RESULTS ===== */
.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.6s ease-out;
  margin-top: 2rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.idea-card {
  background: #f7fafc;
  border-left: 4px solid #667eea;
  border-radius: 8px;
  padding: 1.25rem;
  transition: transform 0.3s, box-shadow 0.3s;
}

.idea-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.idea-card h2 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: #2d3748;
}

.idea-list {
  color: #4a5568;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.secondary-btn {
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.secondary-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

/* ===== UTILITY ===== */
.hidden {
  display: none;
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 500px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .back-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }

  select,
  input[type="text"],
  button {
    font-size: 0.95rem;
  }
}

@media (max-width: 400px) {
  h1 {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
}