/* ThoughtStream (designmd.ai/chef/thoughtstream) Theme
 * Minimal, zen, distraction-free warm neutral aesthetic
 */

:root {
  --bg-page: #FAFAF9;      /* Stone 50 */
  --bg-surface: #FFFFFF;   /* Pure White */
  --bg-subtle: #F5F5F4;    /* Stone 100 */
  --bg-muted: #E7E5E4;     /* Stone 200 */
  
  --border-light: #E7E5E4; /* Stone 200 */
  --border-focus: #78716C; /* Stone 500 */
  
  --text-main: #1C1917;    /* Stone 900 */
  --text-body: #44403C;    /* Stone 700 */
  --text-muted: #78716C;   /* Stone 500 (Signature ThoughtStream neutral) */
  --text-dim: #A8A29E;     /* Stone 400 */
  
  --accent: #1C1917;       /* ThoughtStream Dark Accent */
  --accent-soft: #F5F5F4;
  --success: #15803D;      /* Calm Green */
  --star-gold: #D97706;    /* Amber 600 */
  
  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  line-height: 1.6;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 48px 20px;
}

/* Top Minimal Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 50%;
}

.brand-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.tab-pills {
  display: flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: 20px;
  gap: 2px;
}

.tab-pill {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-pill.active {
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tab Contents */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-content.active {
  display: flex;
}

/* Favorite Recipients Bar */
.fav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.caption {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.fav-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.fav-scroll::-webkit-scrollbar {
  display: none;
}

.fav-chip {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-body);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fav-chip:active, .fav-chip.active {
  background: var(--text-main);
  color: #FFFFFF;
  border-color: var(--text-main);
}

/* Zen Composer Box */
.zen-composer {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
}

.current-target {
  color: var(--text-muted);
}

.current-target strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Zen Switch Toggle */
.zen-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.zen-toggle input {
  display: none;
}

.toggle-slider {
  width: 28px;
  height: 16px;
  background: var(--bg-muted);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #FFFFFF;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.zen-toggle input:checked + .toggle-slider {
  background: var(--text-main);
}

.zen-toggle input:checked + .toggle-slider::after {
  transform: translateX(12px);
}

/* Textarea */
.textarea-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  min-height: 84px;
}

textarea::placeholder {
  color: var(--text-dim);
}

.textarea-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.helper-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.h-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.h-chip:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.icon-button.recording {
  color: #DC2626;
}

.send-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--text-main);
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.send-button:hover {
  opacity: 0.9;
}

/* Zen Loading */
.zen-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.zen-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse-ring 1.4s ease infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Result Section */
.zen-result {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zen-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
}

.result-target {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.result-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zen-message {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-body);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
}

.result-media {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.result-media img {
  width: 100%;
  height: auto;
  display: block;
}

.media-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(28, 25, 23, 0.8);
  color: #FFFFFF;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.result-bottom-actions {
  display: flex;
  gap: 8px;
}

.zen-btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
}

.zen-btn.secondary {
  background: var(--bg-subtle);
  color: var(--text-body);
}

.zen-btn.primary {
  background: var(--text-main);
  color: #FFFFFF;
  flex: 1;
}

.zen-alert {
  font-size: 0.82rem;
  color: var(--success);
  padding: 8px 12px;
  background: #F0FDF4;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}

/* History Stream */
.zen-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.history-stream {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.82rem;
}

.h-target {
  font-weight: 600;
  color: var(--text-main);
}

.h-text {
  color: var(--text-muted);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h-time {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* TAB 2: Full Recipients & Favorites Manager */
.manage-header {
  margin-bottom: 4px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.search-bar input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
}

.search-bar svg {
  color: var(--text-dim);
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: background 0.15s;
}

.room-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.room-type-tag {
  font-size: 0.68rem;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.room-alias {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-light);
  transition: color 0.15s;
}

.star-btn.active {
  color: var(--star-gold);
}

.hidden {
  display: none !important;
}
