/* Nikkah Ready Mehram Portal — styles
   Brand palette:
     Maroon  #820044
     Sage    #C8DDCB
     Cream   #FFFAF2
     Brown   #3E1700
     Amber   #BA7517 (warnings)
     Red     #A32D2D (errors) */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #3E1700;
  background: #FFFAF2;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #C8DDCB;
  color: #3E1700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.5px;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 18px;
  color: #3E1700;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: #6B5D52;
  letter-spacing: 0.5px;
}

/* States */

.state {
  flex: 1;
  display: none;
  flex-direction: column;
  animation: fadeIn 240ms ease-out;
}

.state.state-active {
  display: flex;
}

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

/* Card */

.card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(62, 23, 0, 0.04), 0 4px 16px rgba(62, 23, 0, 0.06);
  border: 0.5px solid rgba(130, 0, 68, 0.08);
}

.card-header {
  margin-bottom: 24px;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 600;
  color: #3E1700;
  margin: 0 0 10px;
  line-height: 1.25;
}

.card-description {
  font-size: 14px;
  color: #6B5D52;
  margin: 0;
  line-height: 1.55;
}

/* Form */

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: #3E1700;
  letter-spacing: 0.1px;
}

.field-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: #3E1700;
  background: #FFFAF2;
  border: 1px solid rgba(130, 0, 68, 0.18);
  border-radius: 10px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.field-input:hover:not(:focus) {
  border-color: rgba(130, 0, 68, 0.3);
}

.field-input:focus {
  border-color: #820044;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(130, 0, 68, 0.12);
}

.field-input::placeholder {
  color: #B5A89C;
}

.field-input.field-input-mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 1.5px;
  font-size: 15px;
}

.field-input.field-input-code {
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
  font-weight: 500;
}

.field-input[aria-invalid="true"] {
  border-color: #A32D2D;
  background: #FCF6F6;
}

.field-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(163, 45, 45, 0.12);
}

.field-hint {
  font-size: 12px;
  color: #8A7C70;
  line-height: 1.4;
}

.field-error {
  font-size: 12px;
  color: #A32D2D;
  line-height: 1.4;
  min-height: 0;
  display: none;
}

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

.form-error {
  background: #FCEBEB;
  color: #A32D2D;
  border: 1px solid #F2C8C8;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
}

/* Button */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(130, 0, 68, 0.25);
}

.btn-primary {
  background: #820044;
  color: #FFFAF2;
  margin-top: 6px;
}

.btn-primary:hover:not(:disabled) {
  background: #6B0038;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.99);
}

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

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 250, 242, 0.3);
  border-top-color: #FFFAF2;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

.btn.is-loading .btn-label {
  opacity: 0.6;
}

.btn.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Success state */

.success-icon {
  width: 72px;
  height: 72px;
  margin: 8px auto 20px;
}

.success-icon svg {
  width: 100%;
  height: 100%;
}

#state-success .card-title {
  text-align: center;
}

#state-success .card-description {
  text-align: center;
  margin-bottom: 28px;
}

#state-success strong {
  color: #3E1700;
  font-weight: 600;
  word-break: break-all;
}

.how-it-works {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(130, 0, 68, 0.1);
}

.how-it-works-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: #3E1700;
  margin: 0 0 14px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #C8DDCB;
  color: #3E1700;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.step-text {
  font-size: 13px;
  color: #3E1700;
  line-height: 1.5;
}

.email-preview {
  margin-top: 24px;
}

.email-preview-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #8A7C70;
  margin-bottom: 8px;
}

.email-preview-card {
  background: #FCEBEB;
  border: 1px solid #F2C8C8;
  border-radius: 10px;
  padding: 14px;
}

.email-preview-subject {
  font-weight: 600;
  font-size: 13px;
  color: #3E1700;
  margin-bottom: 8px;
}

.email-preview-body {
  font-size: 12px;
  color: #6B4040;
  line-height: 1.55;
}

/* Footer */

.footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: #8A7C70;
  line-height: 1.5;
}

.footer p {
  margin: 4px 0;
}

.footer-secondary {
  font-size: 11px;
  color: #A89B8E;
}

.footer-link {
  color: #820044;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Small screens */

@media (max-width: 380px) {
  .container {
    padding: 20px 16px 32px;
  }
  .card {
    padding: 24px 20px;
  }
  .card-title {
    font-size: 22px;
  }
  .field-input.field-input-code {
    font-size: 19px;
    letter-spacing: 6px;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .state, .btn-spinner {
    animation: none;
  }
  .btn, .field-input {
    transition: none;
  }
}
