@import url("./design-tokens.css");
@import url("./shell.css");
@import url("./components.css");

/* ==========================================================================
   EnterCarts — Base styles & primitives
   Tokens:     assets/css/design-tokens.css
   Shell:      assets/css/shell.css
   Components: assets/css/components.css
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  font-size: 17px;
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-body);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--duration-base) var(--ease-standard),
              background-color var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

img,
canvas,
svg {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -80px;
  z-index: calc(var(--z-nav) + 5);
  background: var(--color-cta);
  color: var(--color-on-cta);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-body-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
  font-weight: var(--weight-semibold);
  font-size: var(--text-body-sm);
  min-height: var(--control-h);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-cta);
  color: var(--color-on-cta);
}

.btn-primary:hover {
  background: var(--color-cta-hover);
  color: var(--color-on-cta);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  background: var(--color-primary-active);
}

.btn-success {
  background: var(--color-primary-500);
  color: var(--color-on-cta);
}

.btn-success:hover {
  background: var(--color-primary-600);
  color: var(--color-on-cta);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary-700);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--color-primary-800);
  background: var(--color-primary-soft);
}

.btn-danger {
  background: var(--color-error-600);
  color: var(--color-text-inverse);
}

.btn-danger:hover {
  background: var(--color-error-700);
  color: var(--color-text-inverse);
}

.btn-danger-soft {
  background: var(--color-error-50);
  color: var(--color-error-700);
  border-color: var(--color-error-border);
}

.btn-danger-soft:hover {
  background: var(--color-error-100);
}

/* ==========================================================================
   Legacy modal (studio "How it works" overlays)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: var(--z-overlay);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show,
.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--color-primary-soft);
  color: var(--color-primary-700);
  flex-shrink: 0;
}

.modal-head h2 {
  flex: 1;
  font-size: 17px;
  font-weight: var(--weight-bold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.modal-sub {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  margin-bottom: 18px;
}

.modal-steps {
  list-style: none;
  counter-reset: modalStep;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.modal-steps li {
  display: flex;
  gap: 12px;
  counter-increment: modalStep;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.modal-steps li::before {
  content: counter(modalStep);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-700);
  font-weight: var(--weight-bold);
  font-size: 12px;
  display: grid;
  place-items: center;
}

.modal-step-content strong {
  display: block;
  font-size: 13.5px;
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: 2px;
}

.modal-step-content span,
.modal-step-content p {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   FAQ accordion (base; components.css refines)
   ========================================================================== */
.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 14.5px;
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.faq-question i {
  flex-shrink: 0;
  transition: transform var(--duration-base) var(--ease-standard);
}

.faq-answer {
  display: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--color-text-secondary);
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-item.open .faq-question i {
  transform: rotate(180deg);
}

img.logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
  flex-shrink: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px var(--page-pad, 20px);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  font-weight: var(--weight-semibold);
}

.site-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-text);
}

/* ==========================================================================
   Badge, form, table, and alert primitives
   ========================================================================== */
.ec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-badge);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}

.ec-badge--studio,
.ec-badge--active,
.ec-badge--success {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  border-color: var(--color-primary-200);
}

.ec-badge--neutral {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.ec-badge--new,
.ec-badge--beta {
  background: var(--color-primary-100);
  color: var(--color-primary-800);
  border-color: var(--color-primary-200);
}

.ec-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary-500);
}

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

.ec-label {
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.ec-label--caps {
  font-size: var(--text-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.ec-input,
.ec-select,
.ec-textarea,
.ec-search {
  width: 100%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.ec-textarea {
  min-height: 110px;
  resize: vertical;
}

.ec-input:focus,
.ec-select:focus,
.ec-textarea:focus,
.ec-search:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: var(--ring-focus);
}

.ec-helper {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.ec-error {
  font-size: var(--text-small);
  color: var(--color-error-700);
}

.ec-check,
.ec-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  font-size: var(--text-body-sm);
  color: var(--color-text);
  cursor: pointer;
}

.ec-check input,
.ec-radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary-600);
}

.ec-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.ec-table {
  width: 100%;
  border-collapse: collapse;
}

.ec-table th {
  text-align: left;
}

.ec-alert {
  display: flex;
  gap: var(--space-3);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-body-sm);
}

.ec-alert--success {
  background: var(--color-success-50);
  border-color: var(--color-primary-soft-border);
  color: var(--color-success-700);
}

.ec-alert--warning {
  background: var(--color-warning-50);
  border-color: var(--color-warning-border);
  color: var(--color-warning-700);
}

.ec-alert--error {
  background: var(--color-error-50);
  border-color: var(--color-error-border);
  color: var(--color-error-700);
}

.ec-alert--info {
  background: var(--color-info-50);
  border-color: var(--color-primary-soft-border);
  color: var(--color-info-700);
}

/* ==========================================================================
   Dark theme form controls & scrollbars
   ========================================================================== */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--surface-input);
  color: var(--color-text);
  border-color: var(--color-border);
  color-scheme: dark;
}

[data-theme="dark"] option,
[data-theme="dark"] optgroup {
  background: var(--color-surface);
  color: var(--color-text);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--color-text-muted);
}

[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] textarea:-webkit-autofill,
[data-theme="dark"] select:-webkit-autofill {
  -webkit-text-fill-color: var(--color-text);
  caret-color: var(--color-text);
  box-shadow: 0 0 0 1000px var(--surface-input) inset;
}

[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--color-bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
