/* ─── Interactive Demo Modal ───
 * Port of the Next.js src/components/InteractiveDemoModal.css.
 * Every rule is scoped under .demo-modal-overlay so the theme's base
 * input/button styles (style.css) can't override it.
 */

.demo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: demoFadeIn 0.2s ease;
}

.demo-modal-overlay[hidden],
.demo-modal-overlay [hidden] {
  display: none !important;
}

@keyframes demoFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.demo-modal-overlay .demo-modal-container {
  background: var(--theme-bg-primary, #080B1A);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 40px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: demoSlideUp 0.25s ease;
  box-sizing: border-box;
  text-align: left;
}

.demo-modal-overlay .demo-modal-container::-webkit-scrollbar {
  display: none;
}

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

/* Close button */
.demo-modal-overlay .demo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--theme-text-tertiary, rgba(255, 255, 255, 0.6));
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  min-height: 0;
}

.demo-modal-overlay .demo-modal-close:hover {
  color: var(--theme-text-primary, #fff);
  background: rgba(255, 255, 255, 0.08);
}

/* Header */
.demo-modal-overlay .demo-modal-header {
  margin-bottom: 28px;
}

.demo-modal-overlay .demo-modal-title {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.5px;
  color: var(--theme-text-primary, #fff);
  margin: 0 0 10px;
}

.demo-modal-overlay .demo-modal-subtitle {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  color: var(--theme-text-secondary, rgba(255, 255, 255, 0.8));
  margin: 0 0 14px;
}

.demo-modal-overlay .demo-modal-features {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.demo-modal-overlay .demo-modal-features span {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-text-tertiary, rgba(255, 255, 255, 0.6));
}

.demo-modal-overlay .demo-modal-cta-text {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-text-secondary, rgba(255, 255, 255, 0.8));
  margin: 0;
}

/* Form */
.demo-modal-overlay .demo-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.demo-modal-overlay .demo-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.demo-modal-overlay .demo-modal-input {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--theme-text-primary, #fff);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  height: auto;
  line-height: normal;
  box-shadow: none;
}

.demo-modal-overlay .demo-modal-input::placeholder {
  color: var(--theme-text-tertiary, rgba(255, 255, 255, 0.4));
}

.demo-modal-overlay .demo-modal-input:focus {
  border-color: rgba(76, 0, 240, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.demo-modal-overlay .demo-modal-input.error {
  border-color: #F87171;
}

.demo-modal-overlay .demo-modal-error {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-size: 12px;
  color: #F87171;
  padding-left: 4px;
}

.demo-modal-overlay .demo-modal-submit-error {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-size: 13px;
  color: #F87171;
  text-align: center;
  padding: 8px 12px;
  background: rgba(248, 113, 113, 0.08);
  border-radius: 8px;
}

/* Consent Checkbox */
.demo-modal-overlay .consent-checkbox-wrapper {
  margin-top: 4px;
}
.demo-modal-overlay .consent-checkbox-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  gap: 10px;
}
.demo-modal-overlay .checkbox-input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
  padding: 0;
}
.demo-modal-overlay .checkbox-input::after {
  content: '';
  width: 12px;
  height: 8px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg);
}
.demo-modal-overlay .checkbox-input:checked {
  background: #2E73FF;
  border-color: #79A6FF;
}
.demo-modal-overlay .checkbox-input:checked::after {
  border-left-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}
.demo-modal-overlay .consent-checkbox-text {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}
.demo-modal-overlay .consent-checkbox-text a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  font-size: inherit;
}
.demo-modal-overlay .consent-checkbox-text a:hover {
  color: #fff;
}

/* Submit button */
.demo-modal-overlay .demo-modal-submit {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(55, 53, 53, 1) 0%, rgba(0, 0, 0, 1) 100%);
  color: #fff;
  transition: opacity 0.2s ease, transform 0.1s ease;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  box-shadow: none;
  text-transform: none;
}

.demo-modal-overlay .demo-modal-submit:hover {
  opacity: 0.9;
}

.demo-modal-overlay .demo-modal-submit:active {
  transform: translateY(1px);
}

.demo-modal-overlay .demo-modal-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Spinner */
.demo-modal-overlay .demo-modal-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: demoSpin 0.6s linear infinite;
  box-sizing: border-box;
}

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

/* Success state */
.demo-modal-overlay .demo-modal-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 20px 0;
}

.demo-modal-overlay .demo-modal-success-icon {
  margin-bottom: 4px;
}

.demo-modal-overlay .demo-modal-success-title {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.5px;
  color: var(--theme-text-primary, #fff);
  margin: 0;
}

.demo-modal-overlay .demo-modal-success-text {
  font-family: 'Geist', 'SFPro', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  color: var(--theme-text-secondary, rgba(255, 255, 255, 0.8));
  margin: 0;
}

/* ─── Light theme overrides (the live theme) ─── */
[data-theme="light"] .demo-modal-overlay .demo-modal-container {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-title,
[data-theme="light"] .demo-modal-overlay .demo-modal-success-title {
  color: #1a1a1a;
}

[data-theme="light"] .demo-modal-overlay .demo-modal-subtitle,
[data-theme="light"] .demo-modal-overlay .demo-modal-cta-text,
[data-theme="light"] .demo-modal-overlay .demo-modal-success-text {
  color: rgba(0, 0, 0, 0.75);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-features span {
  color: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-close {
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-close:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-input {
  background: #F3F4F6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #1a1a1a;
}

[data-theme="light"] .demo-modal-overlay .demo-modal-input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .demo-modal-overlay .demo-modal-input:focus {
  border-color: rgba(76, 0, 240, 0.4);
  background: #F8F9FA;
}

[data-theme="light"] .demo-modal-overlay .demo-modal-input.error {
  border-color: #F87171;
}

[data-theme="light"] .demo-modal-overlay .demo-modal-success-icon circle {
  fill: rgba(76, 0, 240, 0.08);
}

[data-theme="light"] .demo-modal-overlay .consent-checkbox-text {
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .demo-modal-overlay .consent-checkbox-text a {
  color: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .demo-modal-overlay .consent-checkbox-text a:hover {
  color: #000;
}

[data-theme="light"] .demo-modal-overlay .checkbox-input {
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .demo-modal-overlay .checkbox-input:checked {
  background: #2E73FF;
  border-color: #2E73FF;
}

[data-theme="light"] .demo-modal-overlay .checkbox-input:checked::after {
  border-left-color: #FFFFFF;
  border-bottom-color: #FFFFFF;
}

/* ─── Responsive ─── */
@media screen and (max-width: 640px) {
  .demo-modal-overlay .demo-modal-container {
    padding: 28px 20px;
    border-radius: 16px;
    max-height: 95vh;
  }

  .demo-modal-overlay .demo-modal-title {
    font-size: 22px;
  }

  .demo-modal-overlay .demo-modal-input {
    padding: 12px 14px;
    font-size: 14px;
  }
}
