/* ================================================================
   IDEAS & BUGS — Chat Panel Styles
   VERSION 1.0
   ================================================================ */

/* ===== FAB Button ===== */
.ideas-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ideas-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  background: var(--accent-hover, var(--accent));
}

.ideas-fab:active {
  transform: scale(0.95);
}

.ideas-fab svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
}

/* Unread badge */
.ideas-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.ideas-badge:empty,
.ideas-badge[data-count="0"] {
  display: none;
}

/* ===== Chat Panel ===== */
.ideas-panel {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle, #e0e0e0);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.ideas-panel--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== Panel Header ===== */
.ideas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle, #e0e0e0);
  flex-shrink: 0;
}

.ideas-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ideas-header-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg, #1a1a1a);
}

.ideas-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ideas-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--fg-muted, #888);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.ideas-close-btn:hover {
  background: var(--bg-hover, #f0f0f0);
  color: var(--fg, #1a1a1a);
}

/* ===== Bot Status Indicator ===== */
.ideas-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-muted, #888);
}

.ideas-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-muted, #888);
  transition: background 0.3s ease;
}

.ideas-status-dot--online {
  background: var(--success, #22c55e);
  box-shadow: 0 0 4px var(--success, #22c55e);
}

.ideas-status-dot--offline {
  background: var(--danger, #ef4444);
}

/* ===== Panel Content (views area) ===== */
.ideas-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===== View: Conversation List ===== */
.ideas-list-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ideas-new-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.ideas-new-btn:hover {
  background: var(--accent-hover, var(--accent));
}

.ideas-show-all-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-muted, #888);
  cursor: pointer;
  user-select: none;
}

.ideas-show-all-toggle input {
  cursor: pointer;
}

.ideas-conv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ideas-conv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle, #e0e0e0);
  transition: background 0.15s;
}

.ideas-conv-item:hover {
  background: var(--bg-hover, #f8f8f8);
}

.ideas-conv-item--unread {
  background: var(--bg-elevated, #f0f4ff);
}

.ideas-conv-item--unread:hover {
  background: var(--bg-hover, #e8ecf8);
}

.ideas-conv-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
}

.ideas-conv-icon--improvement {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.ideas-conv-icon--bug {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.ideas-conv-body {
  flex: 1;
  min-width: 0;
}

.ideas-conv-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg, #1a1a1a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ideas-conv-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--fg-muted, #888);
}

.ideas-conv-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-elevated, #f0f0f0);
  color: var(--fg-muted, #888);
}

.ideas-conv-status--open { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.ideas-conv-status--in_progress { background: rgba(234, 179, 8, 0.12); color: #ca8a04; }
.ideas-conv-status--resolved { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.ideas-conv-status--closed { background: rgba(107, 114, 128, 0.12); color: #6b7280; }

.ideas-conv-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--fg-muted, #888);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  align-self: center;
}

.ideas-conv-item:hover .ideas-conv-delete {
  opacity: 1;
}

.ideas-conv-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger, #ef4444);
}

.ideas-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--fg-muted, #888);
  font-size: 13px;
}

/* ===== View: New Conversation ===== */
.ideas-new-view {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ideas-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.ideas-back-btn:hover {
  text-decoration: underline;
}

.ideas-category-picker {
  display: flex;
  gap: 12px;
}

.ideas-category-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--border-subtle, #e0e0e0);
  border-radius: 10px;
  background: var(--bg-card, #fff);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--fg, #1a1a1a);
  font-size: 13px;
  font-weight: 600;
}

.ideas-category-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover, #f8f8f8);
}

.ideas-category-btn--selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.ideas-category-btn svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

.ideas-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ideas-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ideas-input {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle, #e0e0e0);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card, #fff);
  color: var(--fg, #1a1a1a);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ideas-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ideas-textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e0e0e0);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card, #fff);
  color: var(--fg, #1a1a1a);
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ideas-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ideas-textarea::placeholder {
  color: var(--fg-muted, #888);
}

.ideas-page-hint {
  font-size: 11px;
  color: var(--fg-muted, #888);
}

.ideas-submit-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-end;
}

.ideas-submit-btn:hover {
  background: var(--accent-hover, var(--accent));
}

.ideas-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== View: Conversation Thread ===== */
.ideas-thread-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle, #e0e0e0);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ideas-thread-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg, #1a1a1a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ideas-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message bubbles */
.ideas-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.ideas-message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.ideas-message--bot,
.ideas-message--admin {
  align-self: flex-start;
  align-items: flex-start;
}

.ideas-message-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ideas-message--user .ideas-message-sender {
  color: var(--accent);
}

.ideas-message--bot .ideas-message-sender {
  color: var(--fg-muted, #888);
}

.ideas-message--admin .ideas-message-sender {
  color: #ca8a04;
}

.ideas-sender-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
}

.ideas-sender-badge--bot {
  background: rgba(107, 114, 128, 0.12);
  color: var(--fg-muted, #888);
}

.ideas-sender-badge--admin {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.ideas-message-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.ideas-message--user .ideas-message-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ideas-message--bot .ideas-message-bubble {
  background: var(--bg-elevated, #f0f0f0);
  color: var(--fg, #1a1a1a);
  border-bottom-left-radius: 4px;
}

.ideas-message--admin .ideas-message-bubble {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.25);
  color: var(--fg, #1a1a1a);
  border-bottom-left-radius: 4px;
}

.ideas-message-time {
  font-size: 10px;
  color: var(--fg-muted, #888);
  margin-top: 2px;
}

/* Input area at bottom of thread */
.ideas-input-area {
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle, #e0e0e0);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.ideas-input-area--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.ideas-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle, #e0e0e0);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-card, #fff);
  color: var(--fg, #1a1a1a);
  resize: none;
  max-height: 80px;
  min-height: 36px;
  transition: border-color 0.2s;
}

.ideas-chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.ideas-send-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ideas-send-btn:hover {
  background: var(--accent-hover, var(--accent));
}

.ideas-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ideas-send-btn svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
}

/* Admin reply toggle */
.ideas-admin-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 16px 0;
  font-size: 11px;
  color: var(--fg-muted, #888);
}

.ideas-admin-toggle label {
  cursor: pointer;
  user-select: none;
}

.ideas-admin-toggle input {
  cursor: pointer;
}

/* Conversation closed notice */
.ideas-closed-notice {
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--fg-muted, #888);
  border-top: 1px solid var(--border-subtle, #e0e0e0);
  flex-shrink: 0;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] .ideas-fab {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .ideas-fab:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ideas-panel {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .ideas-input,
[data-theme="dark"] .ideas-textarea,
[data-theme="dark"] .ideas-chat-input {
  background: var(--bg-elevated, #2a2a2a);
}

[data-theme="dark"] .ideas-category-btn {
  background: var(--bg-elevated, #2a2a2a);
}

[data-theme="dark"] .ideas-category-btn:hover {
  background: var(--bg-hover, #333);
}

[data-theme="dark"] .ideas-conv-item--unread {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .ideas-message--bot .ideas-message-bubble {
  background: var(--bg-elevated, #2a2a2a);
}

[data-theme="dark"] .ideas-message--admin .ideas-message-bubble {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.2);
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .ideas-fab {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }

  .ideas-fab svg {
    width: 20px;
    height: 20px;
  }

  .ideas-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .ideas-fab,
  .ideas-panel {
    transition: none;
  }
}
