/* components.css — Sidebar, top bar, panels, buttons, stat cards, connector gate */

/* Sidebar */
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-dim);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: var(--neon-cyan);
  text-shadow: 0 0 4px rgba(0, 240, 255, 0.3);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--neon-amber);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  text-shadow: none;
}

/* Top bar */
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.topbar-breadcrumb span {
  color: var(--text-primary);
}

.topbar-spacer {
  flex: 1;
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid var(--border-dim);
  background: var(--bg-elevated);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.connection-dot.connected {
  background: var(--neon-lime);
  box-shadow: 0 0 6px var(--neon-lime);
}

.connection-dot.disconnected {
  background: var(--neon-red);
  box-shadow: 0 0 6px var(--neon-red);
}

.credit-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--neon-amber);
}

.credit-widget .credit-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
  cursor: pointer;
  transition: box-shadow 0.15s;
  flex-shrink: 0;
}

.user-avatar:hover {
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.cyan::before { background: var(--neon-cyan); }
.stat-card.magenta::before { background: var(--neon-magenta); }
.stat-card.violet::before { background: var(--neon-violet); }
.stat-card.lime::before { background: var(--neon-lime); }
.stat-card.amber::before { background: var(--neon-amber); }
.stat-card.red::before { background: var(--neon-red); }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 28px;
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--neon-cyan);
  color: #000;
  font-weight: 700;
}

.btn-primary:hover {
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.btn-danger {
  background: var(--neon-red);
  color: #000;
  font-weight: 700;
}

/* Connector gate */
.connector-gate {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 15, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.connector-gate-content {
  text-align: center;
  max-width: 480px;
  padding: 48px;
}

.connector-gate-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  color: var(--text-dim);
}

.connector-gate-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.connector-gate-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 32px;
  line-height: 1.6;
}

/* Module placeholders */
.module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.module-placeholder-icon {
  width: 64px;
  height: 64px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.module-placeholder-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.module-placeholder-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 400px;
  line-height: 1.6;
}

/* Stat cards grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Generator */
.generator-form {
  max-width: 680px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s;
}

.form-textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
  outline: none;
}

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

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.char-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.form-row-center {
  justify-content: center;
  margin-top: 8px;
}

.form-group-half {
  flex: 1;
}

.form-group-third {
  flex: 1;
  min-width: 0;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888A8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}

.form-select:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
  outline: none;
}

.btn-generate {
  padding: 12px 32px;
  font-size: 15px;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.generator-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  justify-content: center;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-dim);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.generator-error {
  padding: 14px 18px;
  background: rgba(255, 8, 68, 0.1);
  border: 1px solid var(--neon-red);
  border-radius: 8px;
  color: var(--neon-red);
  font-size: 14px;
  margin-bottom: 16px;
}

.generator-results {
  margin-top: 24px;
  border-top: 1px solid var(--border-dim);
  padding-top: 24px;
}

.results-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.variants-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variant-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 16px;
  transition: border-color 0.15s;
}

.variant-card:hover {
  border-color: var(--border-glow);
}

.variant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.variant-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variant-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.variant-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.variant-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.variant-img-form {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.img-form-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.variant-img-preview {
  padding: 0 16px 12px;
}

.variant-img {
  display: block;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Login Gate ─────────────────────────────── */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-void);
}

.login-gate-content {
  text-align: center;
  max-width: 380px;
  width: 100%;
  padding: 40px 32px;
}

.login-gate-logo {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 900;
  margin-bottom: 12px;
}

.login-gate-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  text-align: center;
  font-size: 18px;
  padding: 14px 16px;
  letter-spacing: 4px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

/* Google Sign-In button */
.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: #1f1f1f;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  margin-bottom: 8px;
}

.btn-google-signin:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.btn-google-signin:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.btn-google-signin:disabled {
  cursor: not-allowed;
  background: #e0e0e0;
  color: #888;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.login-error {
  color: var(--neon-red);
  font-size: 13px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation: none;
    opacity: 0.5;
  }
}

/* ── History Panel ──────────────────────────── */
.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-dim);
  z-index: 300;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
  animation: panel-in 0.2s ease-out;
}

@keyframes panel-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-dim);
}

.history-panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.history-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.history-panel-close:hover {
  color: var(--text-primary);
}

.history-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-panel-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.history-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-card:hover {
  border-color: var(--neon-cyan);
}

.history-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.history-card-source {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-card-count {
  font-size: 11px;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
}
