/* =============================================================
   Maho Mockup — UI Kit (phone shell + shared Zen components)
   ============================================================= */

/* ---------- Desktop canvas ---------- */
.studio {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  gap: 28px;
  padding: 28px 32px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(123, 140, 91, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(194, 65, 12, 0.06), transparent 50%),
    linear-gradient(160deg, #EDE9E1 0%, #E2DDD3 45%, #D8D2C6 100%);
}

.studio__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.studio__side {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 56px);
  overflow: auto;
}

/* ---------- Phone frame ---------- */
.phone {
  width: var(--phone-w);
  height: var(--phone-h);
  background: #111;
  border-radius: var(--phone-radius);
  padding: 10px;
  box-shadow: var(--shadow-phone);
  position: relative;
  flex-shrink: 0;
}

.phone__bezel {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--phone-radius) - 6px);
  overflow: hidden;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  position: relative;
}

.phone__island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 34px;
  background: #000;
  border-radius: 20px;
  z-index: 40;
  pointer-events: none;
}

.phone__status {
  height: var(--status-bar-h);
  padding: 14px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
  flex-shrink: 0;
  z-index: 30;
}

.phone__status-time {
  font-size: var(--fs-15);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.phone__status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--fg-1);
}

.phone__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-content);
  position: relative;
}

.phone__home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  z-index: 50;
  pointer-events: none;
}

/* ---------- App page chrome ---------- */
.zen-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-content);
  animation: zen-fade-in var(--dur-slow) var(--ease-out);
}

@keyframes zen-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.zen-toolbar {
  height: var(--toolbar-h);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  position: relative;
  flex-shrink: 0;
  border-bottom: 0;
}

.zen-toolbar__title {
  font-size: var(--fs-18);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.zen-toolbar__left,
.zen-toolbar__right {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
}

.zen-toolbar__left { left: 8px; }
.zen-toolbar__right { right: 8px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  font-size: var(--fs-15);
  font-weight: var(--fw-medium);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.back-btn:hover { background: var(--bg-hover); }
.back-btn:active { transform: scale(0.98); }

.zen-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-content);
  -webkit-overflow-scrolling: touch;
}

.content-wrapper {
  padding: var(--content-pad);
  padding-bottom: calc(var(--content-pad) + 12px);
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.content-wrapper--tab {
  padding-bottom: calc(var(--content-pad) + 8px);
}

/* ---------- Cards ---------- */
.zen-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-paper);
  border: 1px solid var(--border-1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.card-icon {
  width: 44px;
  height: 44px;
  background: var(--grad-matcha);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--washi-50);
  flex-shrink: 0;
}

.card-titles { flex: 1; min-width: 0; }

.card-title {
  font-size: var(--fs-17);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
  margin: 0;
}

.card-subtitle {
  font-size: var(--fs-13);
  color: var(--fg-3);
  margin: 4px 0 0;
}

/* ---------- Buttons ---------- */
.zen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: var(--fs-15);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur), background var(--dur), opacity var(--dur);
  border: none;
  outline: none;
  text-align: center;
}

.zen-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.zen-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.zen-btn-primary {
  background: var(--grad-matcha);
  color: var(--washi-50);
}

.zen-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(123, 140, 91, 0.3);
}

.zen-btn-accent {
  background: var(--grad-shuin);
  color: var(--washi-50);
}

.zen-btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194, 65, 12, 0.3);
}

.zen-btn-outline {
  background: transparent;
  border: 2px solid var(--matcha);
  color: var(--matcha-shade);
}

.zen-btn-outline:hover:not(:disabled) {
  background: #F4F7F0;
}

.zen-btn-ghost {
  background: var(--washi-200);
  color: var(--fg-2);
}

.zen-btn-ghost:hover:not(:disabled) {
  background: var(--washi-300);
}

.zen-btn-block { width: 100%; }

.zen-btn-sm {
  padding: 8px 14px;
  font-size: var(--fs-13);
  border-radius: var(--radius-sm);
}

/* ---------- Mode tabs ---------- */
.input-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--matcha-wash);
  border-radius: var(--radius-md);
  padding: 4px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--matcha);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur) var(--ease-out);
  min-width: 0;
}

.mode-tab span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-tab.active {
  background: #fff;
  color: #4A5E30;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ---------- Hub / language rows ---------- */
.hub-btn,
.language-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--washi-100);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--dur) var(--ease-out);
  width: 100%;
  text-align: left;
  color: inherit;
}

.hub-btn:hover,
.language-btn:hover {
  background: var(--washi-200);
}

.hub-btn:active,
.language-btn:active {
  transform: scale(0.99);
}

.language-btn.active {
  background: var(--bg-selected);
  border-color: var(--matcha);
}

.hub-btn-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hub-icon {
  width: 36px;
  height: 36px;
  background: var(--washi-200);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  flex-shrink: 0;
  font-size: var(--fs-18);
  font-family: var(--font-serif);
  font-weight: var(--fw-semibold);
}

.language-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.language-name {
  font-size: var(--fs-15);
  font-weight: var(--fw-medium);
  color: var(--fg-1);
}

.language-code {
  font-size: var(--fs-13);
  color: var(--fg-3);
}

.hub-chevron { color: var(--fg-4); flex-shrink: 0; }

/* ---------- Tab bar ---------- */
.zen-tab-bar-host {
  flex-shrink: 0;
  background: var(--bg-page);
  border-top: 1px solid var(--border-strong);
  padding-bottom: 8px;
}

.zen-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-page);
  min-height: var(--tab-bar-h);
}

.zen-tab-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
  transition: color var(--dur), transform var(--dur-fast);
  position: relative;
  border-radius: var(--radius-lg);
}

.zen-tab-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: transparent;
  border-radius: 0 0 2px 2px;
  transition: background var(--dur);
}

.zen-tab-button.tab-selected {
  color: var(--matcha);
}

.zen-tab-button.tab-selected::before {
  background: var(--matcha);
}

.zen-tab-button:active {
  transform: scale(0.92);
}

.zen-tab-button.tab-selected .icon {
  transform: scale(1.05);
}

/* ---------- Forms ---------- */
.text-input {
  width: 100%;
  border: 1px solid var(--border-2);
  background: var(--washi-100);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--fs-14);
  color: var(--fg-2);
  line-height: var(--lh-jp);
  resize: vertical;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.text-input:focus {
  border-color: var(--matcha);
  box-shadow: 0 0 0 3px rgba(123, 140, 91, 0.15);
}

.text-input::placeholder {
  color: var(--fg-4);
}

.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-chip {
  border: 1px solid var(--border-2);
  background: var(--bg-surface);
  color: var(--fg-2);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur);
}

.topic-chip.selected,
.topic-chip:hover {
  background: var(--bg-selected);
  border-color: var(--matcha);
  color: var(--matcha-shade);
}

/* ---------- Status pills ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-11);
  font-weight: var(--fw-medium);
}

.status-pill.completed { background: var(--success-bg); color: var(--success); }
.status-pill.processing { background: var(--warning-bg); color: var(--warning); }
.status-pill.failed { background: var(--danger-bg); color: var(--danger); }

/* ---------- Toast ---------- */
.toast-host {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 72px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--sumi-900);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: var(--fs-13);
  box-shadow: var(--shadow-paper-md);
  animation: toast-in var(--dur-slow) var(--ease-out);
}

.toast.success { background: var(--matcha-shade); }
.toast.warning { background: var(--warning); }
.toast.danger { background: var(--shuin); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Studio side panels ---------- */
.side-card {
  background: rgba(254, 253, 251, 0.92);
  border: 1px solid rgba(232, 230, 225, 0.9);
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  box-shadow: var(--shadow-paper);
  backdrop-filter: blur(8px);
}

.side-card h2 {
  margin: 0 0 6px;
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.side-card p {
  margin: 0 0 12px;
  font-size: var(--fs-13);
  color: var(--fg-3);
  line-height: var(--lh-body);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.side-brand__mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--grad-matcha);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: var(--fs-22);
  font-weight: var(--fw-bold);
}

.side-brand__name {
  font-size: var(--fs-18);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
}

.side-brand__sub {
  font-size: var(--fs-12);
  color: var(--fg-3);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-nav__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  color: var(--fg-2);
  font-size: var(--fs-13);
  transition: background var(--dur), border-color var(--dur);
}

.side-nav__btn:hover {
  background: var(--washi-200);
}

.side-nav__btn.active {
  background: var(--bg-selected);
  border-color: rgba(123, 140, 91, 0.35);
  color: var(--matcha-shade);
  font-weight: var(--fw-medium);
}

.side-nav__group {
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--fg-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tweaks-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-1);
  font-size: var(--fs-13);
  color: var(--fg-2);
}

.tweaks-row:last-child { border-bottom: 0; }

.tweaks-toggle {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--washi-300);
  position: relative;
  cursor: pointer;
  border: none;
  transition: background var(--dur);
}

.tweaks-toggle.on { background: var(--matcha); }

.tweaks-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur) var(--ease-out);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.tweaks-toggle.on::after { transform: translateX(18px); }

/* ---------- Empty / loading ---------- */
.empty-state {
  text-align: center;
  padding: 32px 20px;
}

.empty-icon {
  color: var(--fg-4);
  margin-bottom: 12px;
}

.empty-title {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--fg-1);
  margin: 0 0 6px;
}

.empty-hint {
  font-size: var(--fs-13);
  color: var(--fg-3);
  margin: 0 0 16px;
}

/* Icon helper */
.icon {
  display: inline-flex;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--fill svg {
  fill: currentColor;
  stroke: none;
}
