/* AiWerkz V2 — styles.css */

:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface2:    #21263a;
  --border:      #2e3245;
  --accent:      #4f9cf9;
  --accent2:     #7c6af7;
  --success:     #3ecf8e;
  --warning:     #f5a623;
  --danger:      #f24545;
  --text:        #e2e8f0;
  --muted:       #64748b;
  --radius:      8px;
  --sidebar-w:   220px;
  --topbar-h:    52px;
}

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

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

/* ---------------------------------------------------------------------------
   Logo
--------------------------------------------------------------------------- */
.logo-part1 { color: var(--accent);  font-weight: 700; font-size: 22px; }
.logo-part2 { color: var(--accent2); font-weight: 700; font-size: 22px; }

/* ---------------------------------------------------------------------------
   Views
--------------------------------------------------------------------------- */
.view { width: 100%; }

/* ---------------------------------------------------------------------------
   Auth view
--------------------------------------------------------------------------- */
.auth-container {
  max-width: 440px;
  margin: 60px auto;
  padding: 0 16px;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-tagline {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms;
}

.tab-btn.active {
  background: var(--surface2);
  color: var(--text);
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ---------------------------------------------------------------------------
   Forms
--------------------------------------------------------------------------- */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 160ms;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--accent); }

.field textarea { resize: vertical; }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 160ms;
}

.btn:hover    { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-ghost    { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-sm       { padding: 6px 12px; font-size: 12px; }

.btn-row      { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.btn-row-sm   { display: flex; gap: 8px;  align-items: center; margin-top: 10px; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 160ms;
}
.icon-btn:hover { color: var(--text); }

.icon-btn-sm {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 160ms;
}
.icon-btn-sm:hover { color: var(--text); }

/* ---------------------------------------------------------------------------
   Status messages
--------------------------------------------------------------------------- */
.status-msg {
  font-size: 12px;
  padding: 0;
  min-height: 18px;
  margin-top: 10px;
  transition: all 200ms;
}

.status-msg.error   { color: var(--danger); }
.status-msg.success { color: var(--success); }
.status-msg.info    { color: var(--accent); }
.status-msg.warning { color: var(--warning); }

.app-status {
  position: fixed;
  bottom: 16px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12px;
  z-index: 100;
}

/* ---------------------------------------------------------------------------
   Recovery panel
--------------------------------------------------------------------------- */
.recovery-panel {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 16px;
}

.recovery-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.recovery-content { margin-bottom: 12px; }

.recovery-field {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

.recovery-label { color: var(--muted); min-width: 80px; }
.recovery-value { color: var(--warning); font-weight: 600; }
.recovery-empty { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------------------
   App layout
--------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 50;
}

.topbar-logo   { min-width: var(--sidebar-w); }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right  { display: flex; align-items: center; gap: 10px; }

.session-user {
  font-size: 12px;
  color: var(--muted);
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 300ms;
}

.sync-dot.synced  { background: var(--success); }
.sync-dot.syncing { background: var(--warning); animation: pulse 1s infinite; }
.sync-dot.error   { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.app-layout {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------------------------------------------------------------------------
   Sidebar
--------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.category-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: all 160ms;
  position: relative;
}

.category-item:hover { background: var(--surface2); color: var(--text); }
.category-item.active { background: var(--surface2); color: var(--text); }

.cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-actions {
  display: none;
  gap: 2px;
}

.category-item:hover .cat-actions { display: flex; }

/* Add category form */
.add-category-form {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.add-category-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  margin-bottom: 8px;
}

.add-category-form input:focus { border-color: var(--accent); }

.color-swatches {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 160ms;
}

.color-swatch.selected { border-color: var(--text); }

/* ---------------------------------------------------------------------------
   Prompt area
--------------------------------------------------------------------------- */
.prompt-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  max-width: 800px;
}

.prompt-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.prompt-area-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* Prompt cards */
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 160ms;
}

.prompt-card:hover { border-color: var(--accent); }

.prompt-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.prompt-label {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.prompt-cat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.prompt-card-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.prompt-content {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Add prompt form */
.add-prompt-form {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* Empty state */
.empty-state {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}
