/* ComfyLux — dark, minimal */

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

:root {
  --bg:      #0e0e0e;
  --surface: #1a1a1a;
  --border:  #2a2a2a;
  --accent:  #BB86FC;
  --accent2: #03DAC6;
  --text:    #e0e0e0;
  --muted:   #777;
  --lux-bg:  #1e1430;
  --user-bg: #1a2a1a;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
  transition: background 0.3s;
  margin-left: 8px;
}
.dot.ok  { background: var(--accent2); }
.dot.err { background: #cf6679; }

/* Layout */
main {
  display: grid;
  grid-template-columns: 1fr 3fr;
  height: calc(100vh - 45px);
  overflow: hidden;
}

/* Left panel */
.panel-left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.6;
}

.bubble strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  opacity: 0.7;
}

.bubble.lux  { background: var(--lux-bg);  border: 1px solid #3a2a5a; align-self: flex-start; }
.bubble.user { background: var(--user-bg); border: 1px solid #2a3a2a; align-self: flex-end; }
.bubble.error { background: #2a1a1a; border: 1px solid #5a2a2a; color: #cf6679; align-self: flex-start; }

.bubble.lux  strong { color: var(--accent); }
.bubble.user strong { color: var(--accent2); }
.bubble p { margin: 0; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

#lux-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
}
#lux-input:focus { outline: none; border-color: var(--accent); }

#lux-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  align-self: flex-end;
}
#lux-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#lux-btn:hover:not(:disabled) { background: #d0aaff; }

/* Right panel */
.panel-right {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 16px 0;
  flex-shrink: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.setting-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}

.setting-item .label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.setting-item .value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 2px;
  word-break: break-all;
}

/* Model selector */
.model-selector {
  display: flex;
  gap: 6px;
}

.model-pill {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}

.model-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(187, 134, 252, 0.08);
}

.model-pill:hover:not(.active) {
  border-color: #555;
  color: var(--text);
}

/* User prompt textarea */
#user-prompt {
  margin: 8px 16px 0;
  width: calc(100% - 32px);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 68px;
  flex-shrink: 0;
}
#user-prompt:focus { outline: none; border-color: var(--accent); }
#user-prompt::placeholder { color: var(--muted); }

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 10px;
  flex-shrink: 0;
}

.action-bar .gen-status {
  flex: 1;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-bar #action-riff {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.generate-btn {
  background: var(--accent2);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.generate-btn:hover:not(:disabled) { opacity: 0.85; }
.generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Image area */
.image-area {
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  display: block;
  background: var(--surface);
  border-top: 1px solid var(--border);
  width: 100%;
  min-height: 180px;
}

.image-area .image-wrap {
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-area .image-wrap img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.riff-btn {
  padding: 4px 14px;
  background: none;
  border: 0.5px solid #555;
  border-radius: 20px;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.riff-btn:hover { border-color: var(--accent); color: var(--accent); }

.placeholder-text { color: var(--muted); font-size: 0.85rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Thinking animation */
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
.thinking { animation: pulse 1.4s ease-in-out infinite; color: var(--accent); font-style: italic; }

/* Debug badge */
.debug-badge {
  position: fixed;
  bottom: 8px;
  right: 8px;
  background: #111;
  border: 1px solid #333;
  color: #555;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 9999;
}

/* Mobile */
@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .panel-left {
    height: 55vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .panel-right { height: auto; }
  .settings-card { margin: 10px 10px 0; }
  #user-prompt { margin: 6px 10px 0; width: calc(100% - 20px); }
  .action-bar  { padding: 6px 10px 8px; }
  .image-area  { min-height: 50vw; max-height: calc(100svh - 285px); }
  .image-area .image-wrap { min-height: 50vw; }
  .image-area .image-wrap img { max-height: calc(100svh - 285px); object-fit: contain; }
}
