/* OpenMontage Standalone — shared page styles
 * Uses ONLY semantic tokens from theme.css. NO hardcoded colors here.
 * Add page-specific styles in dashboard.css / start.css / preview.css / final.css.
 */

@import url('https://rsms.me/inter/inter.css');

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--th-surface-alt);
  color: var(--th-on-surface);
  min-height: 100vh;
}

a {
  color: var(--th-accent-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  transition: background-color 120ms ease, border-color 120ms ease;
}
button:focus-visible {
  outline: 2px solid var(--th-focus-border);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--th-accent-primary);
  color: var(--th-accent-on-primary);
  border-color: var(--th-accent-primary);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--th-surface);
  color: var(--th-on-surface);
  border-color: var(--th-edge);
}
.btn-secondary:hover {
  background: var(--th-surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--th-on-surface-dim);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--th-surface-hover);
}

.btn-danger {
  background: var(--th-accent-danger);
  color: var(--th-accent-on-primary);
  border-color: var(--th-accent-danger);
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--th-input-text);
  background: var(--th-surface);
  border: 1px solid var(--th-edge);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--th-focus-border);
  outline-offset: 1px;
  border-color: transparent;
}
input::placeholder, textarea::placeholder {
  color: var(--th-placeholder);
}

.card {
  background: var(--th-surface);
  border: 1px solid var(--th-edge);
  border-radius: 12px;
}
.card-hoverable:hover {
  border-color: var(--th-edge-strong);
  box-shadow: 0 4px 12px var(--th-shadow-color);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--th-surface-dim);
  color: var(--th-on-surface-muted);
}
.badge-success { background: var(--th-tint-success); color: var(--th-accent-success); }
.badge-warn    { background: var(--th-tint-warn); color: var(--th-accent-warn); }
.badge-info    { background: var(--th-tint-primary); color: var(--th-accent-primary); }
.badge-danger  { background: var(--th-tint-danger); color: var(--th-accent-danger); }

.text-muted { color: var(--th-on-surface-muted); }
.text-faint { color: var(--th-on-surface-faint); }
.text-dim   { color: var(--th-on-surface-dim); }

/* Page-level chrome — shared across dashboard / start / preview / final. */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--th-edge);
  background: var(--th-surface);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.app-header .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--th-accent-primary);
  color: var(--th-accent-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--th-on-surface-muted);
  font-size: 12px;
}

/* Sub-page header link (e.g. "← Dashboard") — used on start/preview/final. */
.app-header-link {
  text-decoration: none;
  color: var(--th-on-surface-dim);
  display: inline-flex;
  align-items: center;
}
.app-header-link:hover { color: var(--th-on-surface); }

/* Small label in the page header showing the current project name. */
.project-name-label {
  font-size: 12px;
  color: var(--th-on-surface-faint);
}

/* Inline secondary status line (e.g. "music: <track>" on preview page). */
.inline-status-small {
  font-size: 12px;
  color: var(--th-on-surface-muted);
}

/* Modal form field error — used in inline error blocks. */
.field-error {
  font-size: 12px;
  color: var(--th-accent-danger);
}
.field-error[hidden] { display: none; }

/* Modal label above an input. */
.modal-field-label {
  display: block;
  font-size: 12px;
  color: var(--th-on-surface-muted);
  margin-bottom: 6px;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

@media (max-width: 1199px) {
  .narrow-viewport-warning {
    display: block;
    background: var(--th-accent-warn);
    color: var(--th-accent-on-primary);
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
  }
}
@media (min-width: 1200px) {
  .narrow-viewport-warning { display: none; }
}
