/* Public Layout Styles per AI.md PART 16 */

/* ==================== WEATHER FORM (index.html) ==================== */
.weather-form {
  margin: 1rem 0;
  width: 100%;
}

.weather-form__wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.weather-form__row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.weather-form__input-wrapper {
  position: relative;
  flex: 1;
}

.weather-form__input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.weather-form__units {
  flex-shrink: 0;
  width: 5rem;
}

.weather-form__button-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.weather-form__button {
  flex: 1;
}

.weather-form__button--location {
  flex: 1;
  background-color: var(--color-info);
}

/* Location Details */
.location-detail-row {
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

.location-detail-value--yellow {
  color: var(--color-warning);
}

.location-detail-value--green {
  color: var(--color-success);
}

.location-detail-value--orange {
  color: var(--color-warning);
}

/* Location details section for index.html */
.location-details-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: var(--color-bg);
  border-radius: 0.5rem;
  border: 1px solid var(--color-bg-secondary);
}

.location-detail {
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

/* Forecast Table Colors */
.forecast-temp-high {
  color: var(--color-warning);
}

.forecast-temp-low {
  color: var(--color-info);
}

.forecast-feels-like {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Forecast Cards (Mobile) */
.forecast-details-mobile {
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Console Section */
.console-container {
  margin-top: 30px;
  padding: 20px;
  background-color: var(--color-bg);
  border-radius: 6px;
}

.console-title {
  color: var(--color-primary);
  text-align: center;
  margin-top: 0;
}

.console-label {
  color: var(--color-success);
}

/* Welcome Section */
.welcome-container {
  text-align: center;
  color: var(--color-muted);
  margin: 30px 0;
}

.welcome-title {
  color: var(--color-info);
  font-size: 18px;
  margin-bottom: 15px;
}

.welcome-text {
  font-size: 14px;
  margin-bottom: 20px;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 10px;
  margin: 20px 0;
}

.city-grid-container {
  margin-top: 30px;
  padding: 20px;
  background-color: var(--color-bg-secondary);
  border-radius: 6px;
}

.city-grid-title {
  color: var(--color-success);
}

/* Footer */
.page-footer-main {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--color-bg-secondary);
  color: var(--color-muted);
}

.page-footer-text {
  margin: 0;
  font-size: 0.875rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.page-footer-link {
  color: var(--color-info);
  text-decoration: none;
}

.page-footer-link--green {
  color: var(--color-success);
  text-decoration: none;
}

.page-footer-divider {
  color: var(--color-accent);
}

.page-footer-heart {
  color: var(--color-error);
}

/* ==================== API DOCS (api-docs.html) ==================== */
.api-docs-link-box {
  text-decoration: none;
}

.api-docs-button-inline {
  margin-top: 1rem;
  display: inline-block;
}

/* ==================== PROFILE (user/profile.html) ==================== */
.profile-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.profile-page-header-title {
  color: var(--color-info);
  margin-bottom: 0.5rem;
}

.profile-card {
  margin-bottom: 2rem;
}

.profile-card-header-title {
  color: var(--color-primary);
  margin: 0;
}

.profile-form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.profile-password-button {
  margin-top: 1rem;
}

/* ==================== EDIT LOCATION (edit-location.html) ==================== */
.edit-location-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.edit-error-message {
  display: block;
}

/* ==================== LOADING PAGE (loading.html) ==================== */
.loading-page-container {
  text-align: center;
  margin: 3rem 0;
}

.loading-page-title {
  color: var(--color-info);
  margin: 1rem 0;
}

.loading-page-status-box {
  background-color: var(--color-bg-secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}

.loading-page-status-item {
  color: var(--color-warning);
  margin: 0.5rem 0;
}

.loading-page-status-item--green {
  color: var(--color-success);
  margin: 0.5rem 0;
}

.loading-page-status-item--purple {
  color: var(--color-primary);
  margin: 0.5rem 0;
}

.loading-page-countdown-label {
  color: var(--color-info);
}

.loading-page-countdown-note {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.loading-page-retry-container {
  margin: 1rem 0;
}

.loading-page-retry-button {
  margin: 1rem 0;
}

.loading-page-while-wait-box {
  margin: 2rem 0;
  padding: 1rem;
  background-color: var(--color-bg);
  border-radius: 0.375rem;
}

.loading-page-while-wait-title {
  color: var(--color-warning);
  margin-top: 0;
}

.loading-page-while-wait-text {
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.6;
}

.loading-page-code-box {
  font-family: monospace;
  background: var(--color-bg-secondary);
  padding: 0.75rem;
  border-radius: 0.25rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.loading-page-code-line {
  white-space: nowrap;
}

.loading-page-code-line--cyan {
  color: var(--color-info);
}

.loading-page-code-line--pink {
  color: var(--color-accent);
}

.loading-page-footer-text {
  margin: 0;
}

.coffee-spinner {
  font-size: 4rem;
  animation: steam 2s ease-in-out infinite;
  text-align: center;
  margin: 2rem 0;
}

@keyframes steam {
  0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 1; }
  25% { transform: translateY(-5px) rotate(1deg); opacity: 0.9; }
  50% { transform: translateY(-10px) rotate(0deg); opacity: 0.8; }
  75% { transform: translateY(-5px) rotate(-1deg); opacity: 0.9; }
}

.loading-dots {
  display: inline-block;
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

.status-info {
  background-color: var(--color-bg-secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  text-align: center;
}

.retry-countdown {
  color: var(--color-warning);
  font-weight: bold;
  font-size: 1.2rem;
}

/* ==================== ERROR PAGE (error.html) ==================== */
.error-container {
  max-width: 600px;
  margin: 100px auto;
  padding: 2rem;
  text-align: center;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-title {
  color: var(--color-error);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--color-text);
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--color-bg-secondary);
  border-radius: 8px;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.error-message-box {
  background-color: var(--color-error);
  color: var(--color-bg);
  padding: 10px;
  border-radius: 6px;
  margin: 20px 0;
}

/* ==================== REGISTER PAGE (register.html) ==================== */
.register-container {
  max-width: 450px;
  margin: 80px auto;
  padding: 2rem;
  background: var(--color-bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.register-header {
  text-align: center;
  margin-bottom: 2rem;
}

.register-header h1 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.register-header p {
  color: var(--color-muted);
}

.register-password-mismatch {
  border-color: var(--color-error);
}

.register-password-match {
  border-color: var(--color-muted);
}

.setup-badge {
  display: inline-block;
  background: var(--color-success);
  color: var(--color-bg);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.btn-primary.setup {
  background: var(--color-success);
}

.btn-primary.setup:hover {
  background: var(--color-info);
}

.form-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-muted);
}

.form-footer a {
  color: var(--color-info);
  text-decoration: none;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* NOTE: .error-message is redefined here for the register-page auth error banner.
   This duplicates the error-page .error-message above (pre-existing conflict that
   already existed within the single template-overrides.css file before this split;
   preserved as-is, not introduced by this reorganization). */
.error-message {
  background: rgba(255, 85, 85, 0.1);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* ==================== LOGIN PAGE (login.html) ==================== */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 2rem;
  background: var(--color-bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--color-muted);
}

/* ==================== SETUP PAGES ==================== */
.setup-admin-form-hint {
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.setup-complete-link {
  color: var(--color-info);
}

/* ==================== ADD LOCATION PAGE (add-location.html) ==================== */
.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 var(--space-md);
}

.tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--color-bg-secondary);
}

.search-results {
  position: relative;
  margin-top: var(--space-sm);
}

.gps-button {
  width: 100%;
  margin-bottom: var(--space-lg);
}

.add-location-header {
  margin-bottom: 2rem;
}

.add-location-back-link {
  color: var(--color-info);
}

.add-location-form-hidden {
  display: none;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--color-bg-secondary);
}

.add-location-form-title {
  margin-bottom: 1rem;
}

.add-location-form-actions {
  margin-top: 2rem;
}

.add-location-result-opacity {
  opacity: 0.6;
}

/* Earthquake card hover effect (no JS styles) */
.earthquake-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(139, 233, 253, 0.3);
}

/* Earthquake details toggle */
.eq-details.visible {
  display: block !important;
}

/* ============================================
   PREFERENCES PAGE (AI.md PART 16)
   Mobile-first: options stack, then sit side by side from 768px up.
   ============================================ */

.preferences-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: flex-start;
}

.preferences-current {
  color: var(--color-muted);
}

.preferences-label {
  font-weight: 600;
}

.preferences-fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
}

.preferences-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  /* WCAG 2.1 AA touch target minimum */
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.preferences-option:hover {
  border-color: var(--color-primary);
}

.preferences-option:focus-within {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

/* Selection is shown by border plus the radio control itself, never by
   colour alone, per the WCAG rules in AI.md PART 31 */
.preferences-option:has(input:checked) {
  border-color: var(--color-primary);
}

.preferences-option-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.preferences-option-text {
  display: flex;
  flex-direction: column;
}

.preferences-option-title {
  font-weight: 600;
}

.preferences-option-hint {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.preferences-save {
  align-self: flex-start;
  min-height: 44px;
}

@media (min-width: 768px) {
  .preferences-fieldset {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .preferences-option {
    flex: 1 1 220px;
  }
}
