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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
header {
  background: #1a1a2e;
  color: white;
  padding: 2.5rem 1.5rem 2.2rem;
  text-align: center;
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
}

header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.4rem;
}

header p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
}

/* ---- Main Layout ---- */
main {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ---- Section Cards ---- */
section {
  background: white;
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.04);
}

section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1.25rem;
}

/* ---- Divider ---- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: #9ca3af;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* ---- Newsletter Cards ---- */
.newsletter-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.newsletter-card {
  display: block;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.newsletter-card:hover {
  border-color: #c7d2fe;
  background: #fafbff;
}

.newsletter-card:has(input[name="newsletter"]:checked) {
  border-color: #4f46e5;
  background: #f5f3ff;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.card-header input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #4f46e5;
  flex-shrink: 0;
}

.card-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.2;
}

.card-freq {
  font-size: 0.72rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.card-desc {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
  padding-left: 2.2rem;
}

/* ---- Letterboxd Field ---- */
.letterboxd-field {
  margin-top: 0.9rem;
  padding-left: 2.2rem;
}

.letterboxd-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.35rem;
}

.optional {
  font-weight: 400;
  color: #9ca3af;
  font-size: 0.8rem;
}

.letterboxd-field input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.letterboxd-field input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ---- Genre Field ---- */
.genre-field {
  margin-top: 0.9rem;
  padding-left: 2.2rem;
}

.field-section-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.genre-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}

.genre-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.genre-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #4f46e5;
  flex-shrink: 0;
}

/* ---- Recommended Only Field ---- */
.recommended-only-field {
  margin-top: 0.9rem;
  padding-left: 2.2rem;
}

.recommended-only-row {
  padding: 0;
  font-size: 0.85rem;
}

/* ---- Form Fields ---- */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.35rem;
}

.form-group input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ---- Buttons ---- */
.btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #4f46e5;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #4338ca;
}

.btn-ghost {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.btn-ghost:hover:not(:disabled) {
  background: #e9eaec;
}

/* ---- Checkbox List (unsubscribe) ---- */
.checkbox-list {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: #374151;
  border-radius: 6px;
  user-select: none;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #4f46e5;
  flex-shrink: 0;
}

/* ---- Message Banner ---- */
.message {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.hidden {
  display: none;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.78rem;
  color: #9ca3af;
}

/* ---- India Preview Button ---- */
.preview-btn-row {
  padding-left: 2.2rem;
  margin-top: 0.6rem;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: #4f46e5;
  cursor: pointer;
  transition: color 0.15s;
  font-family: inherit;
  line-height: 1;
}

.preview-btn:hover {
  color: #4338ca;
}

.preview-chevron {
  transition: transform 0.35s ease;
  flex-shrink: 0;
}

.preview-btn.open .preview-chevron {
  transform: rotate(180deg);
}

/* ---- India Preview Panel ---- */
.preview-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.45s ease, opacity 0.3s ease;
}

.preview-panel.open {
  max-height: 540px;
  opacity: 1;
}

.preview-panel-inner {
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.preview-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.preview-panel-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}

.preview-close:hover {
  color: #374151;
  background: #e5e7eb;
}

#india-preview-iframe,
#movie-preview-iframe,
#market-preview-iframe,
#fitness-preview-iframe {
  width: 100%;
  height: 460px;
  border: none;
  display: block;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  header {
    padding: 2rem 1.25rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  section {
    padding: 1.4rem;
  }

  main {
    margin: 1.25rem auto;
  }
}
