/* Enhanced Form Styles - Inspired by modern form UX best practices */

/* Form Section Headers */
.form-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid rgba(18, 39, 114, 0.1);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #2563eb;
  border-radius: 2px;
}

/* Enhanced Form Groups */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.form-label-optional {
  font-weight: 400;
  color: rgba(18, 39, 114, 0.6);
  font-size: 0.875rem;
}

.form-help-text {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: rgba(18, 39, 114, 0.65);
  line-height: 1.4;
}

/* Enhanced Input Styles */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid rgba(18, 39, 114, 0.15);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: all 0.2s ease;
  color: var(--ink);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: rgba(18, 39, 114, 0.25);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(18, 39, 114, 0.4);
}

/* Card-style Radio/Checkbox Options */
.form-options-group {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.form-options-group--grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.form-option-card {
  position: relative;
  display: block;
}

.form-option-card input[type="radio"],
.form-option-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-option-label {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border: 2px solid rgba(18, 39, 114, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  position: relative;
}

.form-option-label:hover {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.02);
}

.form-option-card input:checked + .form-option-label {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-option-indicator {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(18, 39, 114, 0.3);
  border-radius: 50%;
  transition: all 0.2s ease;
  position: relative;
  margin-top: 2px;
}

.form-option-card input[type="checkbox"] + .form-option-label .form-option-indicator {
  border-radius: 6px;
}

.form-option-card input:checked + .form-option-label .form-option-indicator {
  border-color: #2563eb;
  background: #2563eb;
}

.form-option-card input:checked + .form-option-label .form-option-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.form-option-card input[type="checkbox"]:checked + .form-option-label .form-option-indicator::after {
  width: 12px;
  height: 7px;
  border-radius: 0;
  background: transparent;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: translate(-50%, -65%) rotate(-45deg);
}

.form-option-content {
  flex: 1;
}

.form-option-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.form-option-description {
  font-size: 0.875rem;
  color: rgba(18, 39, 114, 0.7);
  line-height: 1.5;
}

/* Compact checkbox list (for Interests) */
.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.625rem;
  margin-top: 0.75rem;
}

/* Two-column checkbox list */
.checkbox-list--two-col {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
  .checkbox-list--two-col {
    grid-template-columns: 1fr;
  }
}

.checkbox-list .form-option-card {
  display: block;
}

.checkbox-list .form-option-label {
  padding: 0.875rem 1rem;
  gap: 0.75rem;
}

.checkbox-list .form-option-title {
  font-size: 0.9375rem;
  margin-bottom: 0;
}

.checkbox-list .form-option-indicator {
  width: 20px;
  height: 20px;
}

/* Enhanced Submit Button */
.form-submit {
  width: 100%;
  padding: 1.125rem 2rem;
  background: var(--ink);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.form-submit:hover:not(:disabled) {
  background: rgba(18, 39, 114, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 39, 114, 0.25);
}

.form-submit:active:not(:disabled) {
  transform: translateY(0);
}

.form-submit:disabled {
  background: rgba(18, 39, 114, 0.4);
  cursor: not-allowed;
  opacity: 0.7;
  transform: none !important;
}

/* Enhanced Messages */
.form-message {
  padding: 1.125rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 2px solid;
}

.form-message.success {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

.form-message.error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* Form intro text */
.form-intro {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgba(18, 39, 114, 0.75);
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: rgba(37, 99, 235, 0.05);
  border-left: 4px solid #2563eb;
  border-radius: 8px;
}

/* Two-column layout for related fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .form-options-group--grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .checkbox-list {
    grid-template-columns: 1fr;
  }

  .form-submit {
    font-size: 1rem;
    padding: 1rem 1.5rem;
  }
}

/* Focus visible for accessibility */
.form-option-label:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* Required field indicator */
.form-label--required::after {
  content: ' *';
  color: #dc2626;
  font-weight: 700;
}

/* Privacy note below submit button */
.form-privacy-note {
  text-align: center;
  font-size: 0.875rem;
  color: rgba(18, 39, 114, 0.65);
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

/* Wider modal for desktop */
@media (min-width: 769px) {
  .modal-content {
    max-width: 700px;
  }
}

/* ========================================
   MOMENT MADLIB FORM STYLES
   ======================================== */

/* Moment container layout */
.moment-container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pad);
  min-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Madlib Story Styles */
.madlib-story {
  background: transparent;
  padding: 2rem 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.madlib-paragraph {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.8;
  color: var(--ink);
  font-weight: 400;
  margin-bottom: 0.5rem;
  display: block;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.madlib-optional {
  opacity: 0.7;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
}

/* Madlib select dropdown */
.madlib-select {
  display: inline;
  padding: 0.25rem 1.25rem 0.25rem 0.5rem;
  border: none;
  border-bottom: 3px solid #2563eb;
  border-radius: 0;
  font-size: inherit;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: transparent;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="6" viewBox="0 0 8 6"><path fill="%232563eb" d="M0 0l4 6 4-6z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0.25rem center;
  background-size: 8px 6px;
  color: #2563eb;
  font-weight: 700;
  font-style: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  vertical-align: baseline;
}

.madlib-select::-ms-expand {
  display: none;
}

.madlib-select:focus {
  outline: none;
  border-bottom-color: #2563eb;
  background-color: rgba(37, 99, 235, 0.05);
}

.madlib-select option {
  background: white;
  color: var(--ink);
  font-style: normal;
  font-weight: 600;
}

.madlib-select:not([value=""]):valid {
  border-bottom-color: var(--ink);
  color: var(--ink);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="6" viewBox="0 0 8 6"><path fill="%23122772" d="M0 0l4 6 4-6z"/></svg>');
}

/* Madlib inline input (timer) */
.madlib-input-inline {
  display: inline;
  width: auto;
  min-width: 200px;
  max-width: 200px;
  padding: 0.25rem 0.5rem;
  border: none;
  border-bottom: 3px solid #2563eb;
  border-radius: 0;
  font-size: inherit;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: transparent;
  text-align: center;
  font-weight: 700;
  color: #2563eb;
  font-style: normal;
  transition: all 0.2s ease;
  vertical-align: baseline;
}

.madlib-input-inline:focus {
  outline: none;
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

.madlib-input-inline:not(:placeholder-shown) {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

/* Madlib standard input */
.madlib-input {
  display: inline;
  width: auto;
  min-width: 200px;
  max-width: 400px;
  padding: 0.25rem 0.5rem;
  border: none;
  border-bottom: 3px solid #2563eb;
  border-radius: 0;
  font-size: inherit;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: transparent;
  font-weight: 700;
  color: #2563eb;
  font-style: normal;
  transition: all 0.2s ease;
  vertical-align: baseline;
}

.madlib-input:focus {
  outline: none;
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

.madlib-input:not(:placeholder-shown) {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

/* Madlib wide input */
.madlib-input-wide {
  display: inline;
  width: auto;
  min-width: 300px;
  max-width: 600px;
  padding: 0.25rem 0.5rem;
  border: none;
  border-bottom: 3px solid #2563eb;
  border-radius: 0;
  font-size: inherit;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: transparent;
  font-weight: 700;
  color: #2563eb;
  font-style: normal;
  transition: all 0.2s ease;
  vertical-align: baseline;
}

.madlib-input-wide:focus {
  outline: none;
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
}

.madlib-input-wide:not(:placeholder-shown) {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

/* Field wrapper for inline inputs with hints */
.madlib-field-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: baseline;
}

.field-hint {
  font-size: 0.75rem;
  color: rgba(18, 39, 114, 0.5);
  font-weight: 400;
  margin-top: 0.25rem;
  line-height: 1.2;
  text-align: center;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Full width madlib */
.madlib-full-width {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Error message styling */
.field-error {
  color: #dc2626;
  font-size: 0.8125rem;
  margin-top: 0.375rem;
  display: none;
}

.field-error.visible {
  display: block;
}

/* Success Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  padding: 1rem;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border: 2px solid #2563eb;
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 700px;
  width: 100%;
  position: relative;
  margin: auto;
}

.modal-content h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 1.5rem 0;
}

.modal-story-block {
  margin-bottom: 1.5rem;
  background: rgba(37, 99, 235, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
}

.modal-story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.modal-story-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: rgba(18, 39, 114, 0.6);
}

.copy-button {
  font-size: 0.875rem;
  color: #2563eb;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.copy-button:hover {
  background: rgba(37, 99, 235, 0.1);
}

.modal-story-text {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ink);
}

.modal-oneliner-text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.modal-button {
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border: 2px solid;
}

.modal-button-primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.modal-button-primary:hover {
  background: rgba(18, 39, 114, 0.85);
  transform: translateY(-1px);
}

.modal-button-secondary {
  background: white;
  color: var(--ink);
  border-color: rgba(18, 39, 114, 0.2);
}

.modal-button-secondary:hover {
  background: rgba(18, 39, 114, 0.05);
}

/* Responsive adjustments for moment form */
@media (max-width: 768px) {
  .madlib-story {
    padding: 1rem 0;
  }

  .madlib-paragraph {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }

  .madlib-input {
    font-size: clamp(1.125rem, 4vw, 1.5rem);
  }
}

@media (max-width: 640px) {
  .modal-actions {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   AI MOMENTS SECTION - INDEX PAGE
   ======================================== */

/* AI Moments Section - Full Width Blue Background */
.ai-moments-section {
  background: #122772;
  color: white;
  padding: clamp(60px, 8vw, 120px) 0;
  margin-top: clamp(40px, 6vw, 80px);
  position: relative;
  overflow: hidden;
}

/* Header with title, controls, and share link */
.ai-moments-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(40px, 6vw, 60px);
  flex-wrap: wrap;
  gap: 1.5rem;
}

.ai-moments-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  margin: 0;
  color: white;
  letter-spacing: -0.01em;
}

/* Navigation controls (circles) */
.moments-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.moment-nav-btn {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.moment-nav-btn:hover {
  opacity: 0.7;
  transform: scale(1.1);
}

.moment-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.moment-nav-btn svg {
  width: 40px;
  height: 40px;
}

/* Share a Moment link */
.share-moment-link {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 400;
  color: white;
  text-decoration: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.share-moment-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* Carousel container */
.moments-carousel {
  max-width: var(--maxw);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.moments-track {
  display: flex;
  transition: transform 0.5s ease;
}

/* Individual moment card */
.moment-card {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  padding: 0 var(--pad);
  box-sizing: border-box;
}

.moment-text {
  font-size: clamp(1.75rem, 4vw, 3.5rem);
  line-height: 1.6;
  color: white;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  margin: 0;
  padding: 0;
  max-width: 1200px;
}

.moment-text strong {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 700;
  color: white;
}

/* Loading state */
.moment-loading {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 4rem 0;
}

.moment-empty {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 4rem 0;
}

/* Dots navigation */
.moments-dots {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: clamp(30px, 5vw, 50px);
}

.moment-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.moment-dot:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.2);
}

.moment-dot.active {
  background: white;
  width: 32px;
  border-radius: 6px;
}

/* Mobile responsiveness */
@media (max-width: 820px) {
  .ai-moments-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .moments-controls {
    order: 2;
  }

  .share-moment-link {
    order: 1;
    width: 100%;
    text-align: right;
  }

  .moment-text {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }

  .moment-nav-btn svg {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 640px) {
  .ai-moments-section {
    padding: clamp(40px, 8vw, 60px) 0;
  }

  .ai-moments-header {
    align-items: stretch;
  }

  .share-moment-link {
    text-align: left;
  }

  .moments-controls {
    justify-content: center;
    width: 100%;
  }
}
