/* ============ MUSA SHARED STYLES ============ */
/* Design tokens matching the landing page */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;1,400&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0a;
  --paper: #f7f5f0;
  --accent: #e84d1a;
  --accent-hover: #d4410f;
  --muted: #8a8578;
  --subtle: #e8e4dc;
  --success: #2d7a4f;
  --error: #c62828;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.grain {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 999;
}

/* ============ NAV ============ */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-back {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.2s ease;
}

.nav-back:hover {
  color: var(--ink);
}

/* ============ PAGE CONTAINER ============ */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
}

.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.page-header h1 span {
  color: var(--accent);
}

.page-header p {
  color: var(--muted);
  font-size: 1.1rem;
  font-style: italic;
  max-width: 500px;
}

/* ============ FORM STYLES ============ */
.brief-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin-top: -0.25rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--subtle);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  transition: border-color 0.2s ease;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--ink);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%238a8578' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ============ BUTTONS ============ */
.btn-primary {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 1rem 2.5rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--subtle);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  border-color: var(--ink);
}

/* ============ LOADING STATE ============ */
.loading-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  text-align: center;
}

.loading-container.active {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 2rem;
}

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

.loading-text {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.loading-subtext {
  color: var(--muted);
  font-style: italic;
}

/* ============ RESULTS ============ */
.results-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--subtle);
}

.results-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.results-header h1 span {
  color: var(--accent);
}

.results-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.results-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.assets-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.asset-card {
  border: 1px solid var(--subtle);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.asset-card:hover {
  border-color: var(--muted);
}

.asset-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.asset-card-header:hover {
  background: rgba(0,0,0,0.02);
}

.asset-card-header h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.asset-type-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  background: rgba(232, 77, 26, 0.08);
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  white-space: nowrap;
}

.asset-card-body {
  padding: 1.5rem;
  display: none;
}

.asset-card-body.open {
  display: block;
}

.asset-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.asset-card-footer {
  display: none;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--subtle);
  background: rgba(0,0,0,0.015);
}

.asset-card-body.open ~ .asset-card-footer {
  display: flex;
  gap: 0.75rem;
}

/* ============ RESULTS ACTIONS ============ */
.results-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--subtle);
}

/* ============ ERROR STATE ============ */
.error-state {
  display: none;
  text-align: center;
  padding: 4rem 2rem;
}

.error-state.active {
  display: block;
}

.error-state h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.error-state p {
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ============ FOOTER ============ */
.page-footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--subtle);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .nav {
    padding: 1rem 1.5rem;
  }

  .page-container {
    padding: 1.5rem 1.5rem 4rem;
  }

  .results-actions {
    flex-direction: column;
  }
}
