/* Review Studio Design System - Minimal Refined Studio Theme */
:root {
  --bg-app: #0B0E14;
  --bg-surface: #12161F;
  --bg-elevated: #1A202C;
  --border-subtle: #242C3D;
  --border-active: #3E4B66;
  --text-primary: #F0F4F8;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-blue: #38BDF8;
  --accent-teal: #14B8A6;
  --accent-green: #22C55E;
  --accent-red: #EF4444;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --font-ui: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body.studio-app {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-ui);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Header */
.studio-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
  gap: 16px;
}
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
.header-center { display: flex; align-items: center; gap: 10px; }

.studio-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.brand-icon { color: var(--accent-blue); }
.studio-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  font-weight: 600;
}
.project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-green); }
.project-id { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.project-name { font-weight: 500; color: var(--text-primary); }

/* Segmented Control */
.control-segmented {
  display: inline-flex;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.seg-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.zoom-dropdown select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Variant Tabs */
.variant-tabs { display: flex; gap: 4px; }
.v-tab-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}
.v-tab-btn:hover { border-color: var(--border-active); color: var(--text-primary); }
.v-tab-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* Action Buttons */
.btn-tool {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
}
.btn-tool:hover { color: var(--text-primary); border-color: var(--border-active); }
.btn-tool.active { background: rgba(20, 184, 166, 0.15); border-color: var(--accent-teal); color: var(--accent-teal); }

.btn-primary {
  background: var(--accent-teal);
  color: #FFFFFF;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }

/* Canvas */
.studio-canvas {
  flex: 1;
  position: relative;
  overflow: auto;
  background: radial-gradient(circle at 50% 30%, #151922 0%, #0B0E14 70%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 24px 180px;
}

/* Device Frame */
.device-bezel {
  background: #181D28;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 0 auto;
}
.device-header {
  height: 32px;
  background: #141822;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}
.device-tag { color: var(--text-muted); font-family: var(--font-mono); }
.device-variant-name { font-weight: 600; color: var(--text-secondary); }
.device-link { color: var(--accent-blue); text-decoration: none; font-size: 11px; }
.device-link:hover { text-decoration: underline; }

.device-screen {
  background: #FFF;
  height: 780px;
  position: relative;
}
.device-screen iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Dual View Wrapper */
.dual-viewport-wrapper, .legacy-split-wrapper {
  display: flex;
  gap: 32px;
  width: 100%;
  max-width: 1720px;
  justify-content: center;
}
.desktop-side, .split-side { flex: 1; max-width: 1280px; }
.mobile-side { width: 375px; flex-shrink: 0; }
.before-header { background: #2D1515; }
.before-header .device-tag { color: #FCA5A5; }
.after-header { background: #132E27; }
.after-header .device-tag { color: #6EE7B7; }

/* Bottom Drawer (Mix & Match Matrix) */
.mix-match-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
  transition: transform 0.25s ease;
}
.mix-match-drawer.collapsed .drawer-body { display: none; }
.drawer-handle {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: var(--bg-surface);
}
.handle-title { display: flex; align-items: baseline; gap: 12px; font-weight: 600; font-size: 13px; }
.handle-hint { font-size: 11px; color: var(--text-muted); font-weight: normal; }
.handle-actions { display: flex; align-items: center; gap: 8px; }

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-ghost-sm:hover { color: var(--text-primary); border-color: var(--border-active); }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 12px; }

.drawer-body {
  padding: 16px 20px 20px;
  max-height: 240px;
  overflow-y: auto;
}
.sections-table {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  align-items: center;
}
.row-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.row-radios { display: flex; gap: 8px; }
.radio-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.radio-pill:hover { border-color: var(--border-active); }
.radio-pill.selected {
  background: rgba(20, 184, 166, 0.15);
  border-color: var(--accent-teal);
  color: #5EEAD4;
  font-weight: 600;
}
.radio-pill input { display: none; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent-blue); }

.decision-radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.decision-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
}
.decision-label input { margin-top: 2px; }
.decision-label small { color: var(--text-muted); font-size: 11px; }

.tags-group { display: flex; flex-direction: column; gap: 10px; background: var(--bg-elevated); padding: 12px; border-radius: var(--radius-md); }
.tags-subhead { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.tags-subhead.positive { color: var(--accent-green); }
.tags-subhead.negative { color: var(--accent-red); }
.tags-container { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.tag-pill:hover { border-color: var(--border-active); }
.tag-pill.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--accent-green);
  color: #86EFAC;
  font-weight: 600;
}
.tag-pill.tag-neg.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-red);
  color: #FCA5A5;
}

.json-inspector {
  background: #06090E;
  border: 1px solid var(--border-subtle);
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38BDF8;
  max-height: 140px;
  overflow: auto;
  user-select: text;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--border-active); }
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text-primary); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  background: #10B981;
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
}
.toast-container.show { opacity: 1; transform: translateY(0); }
