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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  background: #f5f6fa;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.view { display: none; }
.view.active { display: block; }

/* ===== HERO ===== */
.hero {
  text-align: center;
  background: linear-gradient(135deg, #003399 0%, #0055cc 100%);
  color: white;
  padding: 40px 20px 30px;
  border-radius: 16px;
  margin-bottom: 30px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}
.hero-sub {
  font-size: 16px;
  opacity: 0.9;
}
.btn-join-hero {
  margin-top: 20px;
  padding: 14px 40px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  background: white;
  color: #003399;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-join-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* ===== INTRO LETTER ===== */
.intro-letter {
  background: linear-gradient(135deg, #f0f4ff 0%, #fafbff 100%);
  border-left: 4px solid #003399;
  border-radius: 12px;
  padding: 24px 22px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.intro-letter p {
  font-size: 15px;
  color: #2a2a2a;
  line-height: 1.7;
  margin-bottom: 12px;
}
.intro-letter p:last-child { margin-bottom: 0; }
.intro-closing {
  color: #003399 !important;
  font-size: 15px !important;
}

/* ===== DOCS SECTION ===== */
.docs-section {
  background: white;
  border-radius: 12px;
  padding: 22px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.docs-section h2 {
  font-size: 18px;
  color: #003399;
  margin-bottom: 4px;
}
.docs-intro {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
}
.docs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 540px) {
  .docs-grid { grid-template-columns: 1fr; }
}
.docs-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-group-title {
  font-size: 13px;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.doc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #003399;
  text-decoration: none;
  background: #f8faff;
  transition: border-color 0.15s, background 0.15s;
}
.doc-link:hover {
  border-color: #003399;
  background: #eef2ff;
}
.euemotion-link { color: #6B2D8B; }
.euemotion-link:hover {
  border-color: #6B2D8B;
  background: #f5eeff;
}
.doc-link-soon {
  color: #aaa;
  background: #f5f5f5;
  border-color: #e5e7eb;
  cursor: default;
  font-style: italic;
}
.doc-link-soon:hover {
  border-color: #e5e7eb;
  background: #f5f5f5;
}
.doc-icon { font-size: 16px; }

/* ===== INFO SECTION ===== */
.info-section {
  background: white;
  border-radius: 12px;
  padding: 24px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.info-section h2 {
  font-size: 18px;
  color: #003399;
  margin-bottom: 10px;
  margin-top: 20px;
}
.info-section h2:first-child { margin-top: 0; }
.info-section p { color: #444; margin-bottom: 12px; }

/* Benefits grid */
.benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.benefit {
  background: #f0f4ff;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.benefit-icon { font-size: 24px; margin-bottom: 6px; }
.benefit h3 { font-size: 14px; color: #003399; margin-bottom: 4px; }
.benefit p { font-size: 12px; color: #555; margin: 0; }

/* Steps */
.steps-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.step {
  flex: 1;
  background: #f0f4ff;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #333;
}
.step-num {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  background: #003399;
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ===== SELECT SECTION ===== */
.select-section {
  text-align: center;
  margin-bottom: 30px;
}
.select-section h2 {
  font-size: 18px;
  color: #333;
  margin-bottom: 16px;
}

.cards-row {
  display: flex;
  gap: 14px;
}
.card {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 28px 16px 22px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  font-family: inherit;
  color: white;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.card:active { transform: translateY(0); }

.card-eudicas { background: linear-gradient(135deg, #003399 0%, #0055cc 100%); }
.card-euemotion { background: linear-gradient(135deg, #6B2D8B 0%, #9B59B6 100%); }

.card-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
.card-full {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 14px;
  line-height: 1.4;
}
.card-action {
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 8px 16px;
  display: inline-block;
}

/* ===== FORM VIEW ===== */
.form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.btn-back {
  background: #e9ecef;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  color: #333;
}
.btn-back:hover { background: #dee2e6; }
.form-title { font-size: 22px; color: #003399; }
.form-title.euemotion { color: #6B2D8B; }
.form-subtitle { font-size: 14px; color: #666; }

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}
.form-group input,
.form-group select {
  padding: 10px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #003399;
  box-shadow: 0 0 0 3px rgba(0,51,153,0.1);
}
.form-group input.euemotion:focus,
.form-group select.euemotion:focus {
  border-color: #6B2D8B;
  box-shadow: 0 0 0 3px rgba(107,45,139,0.1);
}

/* ===== SIGNATURE ===== */
.signature-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.signature-section label {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.sig-instruction {
  font-size: 13px;
  color: #888;
  margin: 4px 0 10px;
}
.signature-wrapper {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: white;
  overflow: hidden;
  touch-action: none;
}
.signature-wrapper canvas {
  display: block;
  width: 100%;
  height: 200px;
}
.btn-clear {
  margin-top: 8px;
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
}
.btn-clear:hover { background: #f5f5f5; }

/* ===== ACCEPTANCE ===== */
.acceptance {
  margin-bottom: 20px;
}
.checkbox-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  line-height: 1.5;
}
.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #003399;
}

/* ===== SUBMIT ===== */
.submit-section { text-align: center; }
.btn-submit {
  background: linear-gradient(135deg, #003399 0%, #0055cc 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 400px;
}
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,51,153,0.3);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-submit.euemotion {
  background: linear-gradient(135deg, #6B2D8B 0%, #9B59B6 100%);
}
.btn-submit.euemotion:hover {
  box-shadow: 0 6px 20px rgba(107,45,139,0.3);
}
.submit-note {
  font-size: 12px;
  color: #999;
  margin-top: 10px;
}

/* ===== CONFIRMATION ===== */
.confirmation {
  text-align: center;
  padding-top: 80px;
}
.confirm-icon {
  width: 80px;
  height: 80px;
  line-height: 80px;
  background: #27ae60;
  color: white;
  border-radius: 50%;
  font-size: 40px;
  margin: 0 auto 20px;
}
.confirmation h1 {
  font-size: 24px;
  color: #27ae60;
  margin-bottom: 12px;
}
.confirmation p { color: #555; margin-bottom: 10px; }
.confirm-note { font-size: 13px; color: #999; }
.btn-new {
  margin-top: 24px;
  background: #003399;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.btn-new:hover { background: #0055cc; }

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: white;
}
.loading-overlay.active {
  display: flex;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { font-size: 16px; font-weight: 500; }
.loading-sub { font-size: 13px; opacity: 0.7; margin-top: 4px; }

/* ===== ERROR MESSAGE ===== */
.error-msg {
  background: #fee;
  color: #c0392b;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
  display: none;
}
.error-msg.visible { display: block; }

/* ===== DOCUMENT PREVIEW (Improvement 2) ===== */
.doc-preview-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.doc-preview-label {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 2px;
}
.doc-preview-hint {
  font-size: 13px;
  color: #888;
  margin: 0 0 10px;
}
.doc-preview-box {
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  background: white;
  -webkit-overflow-scrolling: touch;
}
.doc-preview-iframe {
  width: 100%;
  min-height: 200px;
  border: none;
  display: block;
  background: white;
}
.doc-preview-loading {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* ===== DOWNLOAD BUTTON (Improvement 1) ===== */
.btn-download {
  display: inline-block;
  margin: 16px auto 8px;
  background: #27ae60;
  color: white;
  text-decoration: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s, transform 0.2s;
}
.btn-download:hover {
  background: #219a52;
  transform: translateY(-1px);
}

/* ===== CONFIRMATION EXTENDED ===== */
.confirm-divider {
  border: none;
  border-top: 1.5px solid #e5e7eb;
  margin: 28px 0 24px;
}
.confirm-next-box {
  background: #fff8ec;
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 20px 18px;
  text-align: center;
}
.confirm-next-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f59e0b;
  color: white;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.confirm-next-title {
  font-size: 17px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
}
#confirm-next-text {
  color: #555;
  font-size: 15px;
  margin-bottom: 6px;
}
.confirm-next-hint {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
}
.confirm-next-box .btn-submit {
  margin: 0 auto 12px;
  display: block;
  max-width: 320px;
}
.confirm-all-done {
  font-size: 18px;
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 16px;
}
.btn-new-skip {
  background: #888;
  font-size: 14px;
  padding: 10px 24px;
}
.btn-new-skip:hover {
  background: #666;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hero h1 { font-size: 22px; }
  .benefits-grid { grid-template-columns: 1fr; }
  .cards-row { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
  .steps-row { flex-direction: column; }
  .btn-submit { padding: 14px 24px; font-size: 16px; }
}
