/* ============================================
   Larry & Andrea Stories — Warm Floral Design
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #FFF8F0;
  color: #4A3728;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-weight: normal;
  line-height: 1.3;
}

/* --- Tab Navigation --- */
.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 1rem 1rem 0;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.tab-btn {
  flex: 1;
  max-width: 260px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.9rem 1.2rem;
  border: 2px solid #e8ddd4;
  background: #FFFFFF;
  color: #8a7a6a;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab-btn:first-child {
  border-radius: 14px 0 0 14px;
  border-right: 1px solid #e8ddd4;
}

.tab-btn:last-child {
  border-radius: 0 14px 14px 0;
  border-left: 1px solid #e8ddd4;
}

.tab-btn.active {
  background: linear-gradient(135deg, #F5C6D0 0%, #e8adb9 100%);
  color: #4A3728;
  border-color: #F5C6D0;
}

.tab-btn:not(.active):hover {
  background: #FFF8F0;
  color: #4A3728;
}

/* --- App Container --- */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.25rem;
  padding-bottom: 4rem;
}

/* --- Screens --- */
.screen {
  display: none;
  width: 100%;
  max-width: 800px;
  margin-top: auto;
  margin-bottom: auto;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

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

.screen-content {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  box-shadow:
    0 2px 20px rgba(74, 55, 40, 0.06),
    0 0 0 1px rgba(168, 195, 160, 0.15);
}

/* --- Floral Border Decoration --- */
.floral-border {
  text-align: center;
  padding: 1.5rem 1rem;
  position: relative;
  margin-bottom: 1.5rem;
}

.floral-border::before,
.floral-border::after {
  content: '';
  display: block;
  height: 2px;
  margin: 0 auto;
  max-width: 280px;
  background: linear-gradient(
    90deg,
    transparent,
    #A8C3A0 20%,
    #F5C6D0 50%,
    #A8C3A0 80%,
    transparent
  );
}

.floral-border::before {
  margin-bottom: 1.5rem;
}

.floral-border::after {
  margin-top: 1.5rem;
}

/* --- Welcome Screen --- */
.welcome-content {
  text-align: center;
}

.title-elegant {
  font-size: 2.8rem;
  color: #4A3728;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 1.2rem;
  color: #A8C3A0;
  font-style: italic;
  letter-spacing: 0.05em;
}

.welcome-text {
  font-size: 1.1rem;
  color: #6B5544;
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.headline {
  font-size: 1.55rem;
  color: #4A3728;
  margin-bottom: 2rem;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 60px;
  padding: 1rem 2rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.3;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #F5C6D0 0%, #e8adb9 100%);
  color: #4A3728;
  box-shadow: 0 4px 12px rgba(245, 198, 208, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(245, 198, 208, 0.55);
}

.btn-secondary {
  background: #FFFFFF;
  color: #4A3728;
  border: 2px solid #A8C3A0;
}

.btn-secondary:hover {
  background: #f4f9f2;
}

.btn-outline {
  background: transparent;
  color: #7B6B8A;
  border: 2px solid #C4B7D4;
  min-height: 48px;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-outline:hover {
  background: rgba(196, 183, 212, 0.1);
}

.btn-danger {
  background: #e74c3c;
  color: #FFFFFF;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-control {
  min-height: 52px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.button-group .btn {
  width: 100%;
  max-width: 340px;
}

/* --- Info Link & Section --- */
.info-link {
  display: inline-block;
  font-size: 0.9rem;
  color: #A8C3A0;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 1rem;
}

.info-link:hover {
  color: #8aab80;
}

.info-section {
  margin-top: 1rem;
  padding: 1.5rem;
  background: rgba(168, 195, 160, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(168, 195, 160, 0.2);
  text-align: left;
}

.info-section h3 {
  font-size: 1.1rem;
  color: #4A3728;
  margin-bottom: 0.5rem;
}

.info-section p {
  font-size: 0.95rem;
  color: #6B5544;
}

/* --- Forms --- */
.screen-heading {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 2rem;
  color: #4A3728;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #4A3728;
  margin-bottom: 0.5rem;
}

.required {
  color: #e74c3c;
}

.optional {
  font-weight: 400;
  color: #A8C3A0;
  font-size: 0.9em;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  padding: 1rem 1.25rem;
  border: 2px solid #e8ddd4;
  border-radius: 12px;
  background: #FFF8F0;
  color: #4A3728;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
  outline: none;
  border-color: #F5C6D0;
  box-shadow: 0 0 0 3px rgba(245, 198, 208, 0.2);
}

.form-group input::placeholder {
  color: #c4b5a8;
}

/* --- Checkbox --- */
.checkbox-group {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  cursor: pointer;
  padding: 1.25rem;
  background: rgba(196, 183, 212, 0.08);
  border: 2px solid #e8ddd4;
  border-radius: 12px;
  transition: border-color 0.2s ease;
}

.checkbox-label:hover {
  border-color: #C4B7D4;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 2px solid #C4B7D4;
  border-radius: 6px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: #A8C3A0;
  border-color: #A8C3A0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  display: block;
  width: 8px;
  height: 14px;
  border: solid #FFFFFF;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  margin-top: -3px;
}

.checkbox-label input[type="checkbox"]:focus + .checkbox-custom {
  box-shadow: 0 0 0 3px rgba(168, 195, 160, 0.3);
}

.checkbox-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #6B5544;
  font-weight: 400 !important;
}

/* --- Form Error --- */
.form-error {
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.25);
  color: #c0392b;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* --- Recording Screen --- */
.recording-content {
  text-align: center;
}

.prompt-text {
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 1.35rem;
  font-style: italic;
  color: #4A3728;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  min-height: 3em;
}

/* --- Countdown Overlay --- */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.countdown-overlay[hidden] {
  display: none;
}

.countdown-number {
  font-family: Georgia, serif;
  font-size: 8rem;
  color: #FFFFFF;
  animation: countPulse 1s ease infinite;
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.8; }
}

/* --- Recording Indicator --- */
.recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.recording-indicator[hidden] {
  display: none;
}

.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e74c3c;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.recording-label {
  font-size: 1rem;
  font-weight: 600;
  color: #e74c3c;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- Timer --- */
.timer-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 2.8rem;
  font-weight: 700;
  color: #4A3728;
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
}

/* --- Record Button --- */
.btn-record {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid #e74c3c;
  background: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.15);
}

.btn-record:hover {
  box-shadow: 0 6px 24px rgba(231, 76, 60, 0.25);
}

.btn-record:active {
  transform: scale(0.95);
}

.btn-record.recording {
  animation: recordPulse 1.5s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
  50%      { box-shadow: 0 0 0 20px rgba(231, 76, 60, 0); }
}

.record-icon {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e74c3c;
  transition: all 0.2s ease;
}

.btn-record.recording .record-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

/* --- Recording Controls --- */
.recording-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.recording-controls[hidden] {
  display: none;
}

.time-limit-note {
  font-size: 0.85rem;
  color: #b0a090;
}

/* --- Review Screen --- */
.audio-player-wrapper {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: #FFF8F0;
  border-radius: 14px;
  border: 1px solid #e8ddd4;
}

.audio-player-wrapper audio {
  width: 100%;
  height: 48px;
}

.upload-status {
  text-align: center;
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

.upload-status[hidden] {
  display: none;
}

.upload-status.success {
  background: rgba(168, 195, 160, 0.15);
  color: #6b8a60;
  border: 1px solid rgba(168, 195, 160, 0.3);
}

.upload-status.saving {
  background: rgba(196, 183, 212, 0.15);
  color: #7B6B8A;
  border: 1px solid rgba(196, 183, 212, 0.3);
}

.upload-status.error {
  background: rgba(231, 76, 60, 0.08);
  color: #c0392b;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

/* --- Thank You Screen --- */
.thank-you-content {
  text-align: center;
}

.thank-you-icon {
  font-size: 3rem;
  color: #F5C6D0;
  margin-bottom: 0.5rem;
}

.thank-you-text {
  font-size: 1.15rem;
  color: #6B5544;
  max-width: 480px;
  margin: 0 auto 2rem;
}

/* --- Status Bar --- */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: #FFFFFF;
  border-top: 1px solid #e8ddd4;
  font-size: 0.8rem;
  z-index: 50;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-indicator[hidden] {
  display: none;
}

.status-indicator.online::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #A8C3A0;
  display: inline-block;
}

.status-indicator.offline {
  color: #c0392b;
}

.status-indicator.offline::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
  display: inline-block;
}

.status-pending {
  color: #7B6B8A;
}

.status-pending[hidden] {
  display: none;
}

/* --- Textarea --- */
.form-group textarea {
  width: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  padding: 1rem 1.25rem;
  border: 2px solid #e8ddd4;
  border-radius: 12px;
  background: #FFF8F0;
  color: #4A3728;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-group textarea:focus {
  outline: none;
  border-color: #F5C6D0;
  box-shadow: 0 0 0 3px rgba(245, 198, 208, 0.2);
}

.form-group textarea::placeholder {
  color: #c4b5a8;
}

/* --- Photo Drop Zone --- */
.photo-drop-zone {
  border: 3px dashed #C4B7D4;
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(196, 183, 212, 0.05);
  margin-bottom: 1.5rem;
}

.photo-drop-zone:hover,
.photo-drop-zone.drag-over {
  border-color: #A8C3A0;
  background: rgba(168, 195, 160, 0.08);
}

.drop-zone-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
}

.drop-zone-text {
  font-size: 1.1rem;
  color: #4A3728;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.drop-zone-hint {
  font-size: 0.9rem;
  color: #b0a090;
}

/* --- Photo Preview Grid --- */
.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.photo-preview-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #f0ebe4;
  border: 2px solid #e8ddd4;
}

.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(74, 55, 40, 0.7);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.photo-preview-remove:hover {
  background: #c0392b;
}

/* --- Photo Count --- */
.photo-count {
  text-align: center;
  font-size: 1rem;
  color: #6B5544;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* --- Upload Progress --- */
.upload-progress {
  margin-top: 1.5rem;
}

.upload-progress[hidden] {
  display: none;
}

.progress-bar-track {
  width: 100%;
  height: 12px;
  background: #e8ddd4;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #A8C3A0, #8aab80);
  border-radius: 6px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.95rem;
  color: #6B5544;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .app-container {
    padding: 1.25rem 1rem;
    padding-bottom: 3.5rem;
  }

  .screen-content {
    padding: 1.75rem 1.25rem;
    border-radius: 16px;
  }

  .title-elegant {
    font-size: 2.2rem;
  }

  .headline {
    font-size: 1.3rem;
  }

  .prompt-text {
    font-size: 1.15rem;
  }

  .timer-display {
    font-size: 2.2rem;
  }

  .btn-record {
    width: 100px;
    height: 100px;
  }

  .record-icon {
    width: 40px;
    height: 40px;
  }

  .btn-record.recording .record-icon {
    width: 30px;
    height: 30px;
  }

  .recording-controls {
    flex-direction: column;
    align-items: center;
  }

  .recording-controls .btn {
    width: 100%;
    max-width: 280px;
  }

  .checkbox-label {
    padding: 1rem;
  }

  .checkbox-text {
    font-size: 0.88rem;
  }
}

@media (min-width: 601px) {
  .button-group {
    flex-direction: row;
    justify-content: center;
  }

  .button-group .btn {
    width: auto;
    min-width: 220px;
  }
}
