/* Word Search Demo — module-specific styles
   Reuses maze_demo.css design tokens and layout conventions */

/* ── Layout ── */
.ws-main {
  display: grid;
  grid-template-columns: 280px 1.5fr;
  gap: 0;
  min-height: calc(100vh - 56px);
  min-height: calc(100dvh - 56px);
}

.ws-col-1 {
  padding: 1rem;
  border-right: 1px solid var(--mg-border);
  overflow-y: auto;
  background: var(--mg-surface);
}

.ws-col-2 {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Section titles ── */
.ws-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-text-muted);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--mg-border);
}

/* ── Type cards ── */
.ws-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ws-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--mg-border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--mg-surface);
  text-align: center;
  min-height: 44px;
}

.ws-type-card:hover {
  border-color: var(--mg-primary);
  background: color-mix(in srgb, var(--mg-primary) 8%, transparent);
}

.ws-type-card.selected {
  border-color: var(--mg-primary);
  background: color-mix(in srgb, var(--mg-primary) 12%, transparent);
  box-shadow: 0 0 0 1px var(--mg-primary);
}

.ws-type-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}

.ws-type-card.locked .lock-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.65rem;
  color: var(--mg-text-muted);
}

.ws-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ws-type-card .type-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--mg-primary);
}

.ws-type-card .type-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--mg-text);
}

.ws-type-card .type-desc {
  font-size: 0.65rem;
  color: var(--mg-text-muted);
}

/* ── Wordlist section ── */
.ws-wordlist-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ws-wordlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 2px solid var(--mg-border);
  border-radius: 0.5rem;
  cursor: pointer;
  background: var(--mg-surface);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mg-text);
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
}

.ws-wordlist-btn:hover {
  border-color: var(--mg-primary);
}

.ws-wordlist-btn.selected {
  border-color: var(--mg-primary);
  background: color-mix(in srgb, var(--mg-primary) 12%, transparent);
  box-shadow: 0 0 0 1px var(--mg-primary);
}

.ws-wordlist-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ── Custom words textarea ── */
.ws-custom-words {
  display: none;
}

.ws-custom-words.active {
  display: block;
}

.ws-custom-words textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem;
  border: 1px solid var(--mg-border);
  border-radius: 0.375rem;
  background: var(--mg-input-bg, var(--mg-surface));
  color: var(--mg-text);
}

.ws-custom-words textarea:focus {
  outline: 2px solid var(--mg-primary);
  outline-offset: 2px;
  border-color: var(--mg-primary);
}

.ws-custom-words .mg-form-hint {
  font-size: 0.75rem;
  color: var(--mg-text-muted);
  margin-top: 0.25rem;
}

/* ── Mobile ── */
.ws-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--mg-surface);
  border-top: 1px solid var(--mg-border);
  z-index: 1000;
}

.ws-tabbar .ws-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--mg-text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  min-height: 44px;
}

.ws-tabbar .ws-tab.active {
  color: var(--mg-primary);
}

.ws-tabbar .ws-tab i {
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .ws-main {
    grid-template-columns: 1fr;
    padding-bottom: 60px;
  }

  .ws-col-1,
  .ws-col-2 {
    display: none;
    border-right: none;
  }

  .ws-col-1.active-panel,
  .ws-col-2.active-panel {
    display: block;
  }

  .ws-tabbar {
    display: flex;
  }

  .ws-type-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .ws-wordlist-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  .ws-main {
    grid-template-columns: 260px 1fr;
  }
}

/* ── Focus indicators ── */
.ws-type-card:focus-within {
  outline: 2px solid var(--mg-primary);
  outline-offset: 2px;
}

.ws-wordlist-btn:focus-within {
  outline: 2px solid var(--mg-primary);
  outline-offset: 2px;
}

/* ── Print ── */
@media print {
  .ws-col-1,
  .ws-tabbar {
    display: none !important;
  }

  .ws-col-2 {
    display: block !important;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ws-type-card,
  .ws-wordlist-btn {
    transition: none;
  }
}
