/* ==========================================================================
   PROMPTSHIELD-AI: CLEAN LIGHT-THEME CHATBOT UI
   Modern, Clean, Human-Friendly SaaS Aesthetic (ChatGPT / Linear Style)
   ========================================================================== */

:root {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-main: #ffffff;
  --bg-card: #f1f5f9;
  --bg-hover: #e2e8f0;

  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --warning: #f59e0b;
  --warning-light: #fffbeb;

  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

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

body.light-theme {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.chat-app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-app);
}

/* ==========================================================================
   LEFT SIDEBAR
   ========================================================================== */
.sidebar {
  width: 340px;
  min-width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  gap: 1.25rem;
  overflow-y: auto;
}

.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: block;
}

/* Bot Card in Sidebar */
.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bot-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bot-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-unsecured {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.status-unsecured .dot { background: var(--danger); }

.status-protected {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.status-protected .dot { background: var(--success); }

.bot-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.bot-model {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.prompt-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.toggle-lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.shield-toggle-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.shield-toggle-btn.unshielded {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
}
.shield-toggle-btn.unshielded:hover {
  background: var(--primary-light);
}

.shield-toggle-btn.shielded {
  background: var(--success);
  color: #ffffff;
}

/* Actions in Sidebar */
.action-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.primary-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.primary-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.auto-secure-btn {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

.secondary-btn {
  background-color: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Presets Section */
.presets-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.preset-chip {
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  line-height: 1.3;
}

.preset-chip:hover {
  border-color: var(--primary-border);
  background-color: var(--primary-light);
  color: var(--primary);
  transform: translateX(2px);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.m-title { color: var(--text-muted); }
.m-val { font-weight: 700; color: var(--success); }

.team-cred {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CHAT AREA
   ========================================================================== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

/* Chat Topbar */
.chat-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  background: #ffffff;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #eef2ff;
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-bot-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-bot-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sub-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--danger);
}
.sub-dot.safe { background-color: var(--success); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.topbar-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.topbar-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Chat Messages Stream */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background-color: var(--bg-app);
}

.chat-bubble {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: messageIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-bubble {
  align-self: flex-end;
}

.user-bubble .bubble-text {
  background: var(--primary);
  color: #ffffff;
  padding: 0.85rem 1.15rem;
  border-radius: 18px 18px 4px 18px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
}

.bot-bubble {
  align-self: flex-start;
}

.greeting-box .bubble-text {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

.greeting-box ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.bot-bubble:not(.greeting-box) .bubble-text {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 0.95rem 1.2rem;
  border-radius: 18px 18px 18px 4px;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

/* Security Analysis Card (Attached to Bot Message) */
.security-verdict-card {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.verdict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.verdict-tag {
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.verdict-tag.safe {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.verdict-tag.breached {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.verdict-score {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}

.verdict-reason {
  color: var(--text-secondary);
  line-height: 1.4;
}

.verdict-fix {
  color: var(--text-muted);
  font-size: 0.7rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-light);
}

/* Chat Input Field */
.chat-input-area {
  padding: 1rem 2.5rem 1.25rem;
  background-color: #ffffff;
  border-top: 1px solid var(--border-light);
}

.input-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.6rem 0.35rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.input-form:focus-within {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.chat-input-field {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  text-align: center;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease;
}

.modal-wide {
  max-width: 680px;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  background: #ffffff;
}

.form-textarea {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.4;
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: var(--bg-card);
}

/* Audit Modal Specifics */
.audit-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.audit-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
}

.clean-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.clean-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.25s ease;
}

.metric-comparison-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 0.85rem;
}

.metric-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.m-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.m-score {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.m-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.arrow-divider {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.patches-applied-box {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.75rem;
}

.patch-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 0.5rem;
}

.patch-list {
  list-style: none;
  font-size: 0.78rem;
  color: #047857;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.code-view {
  background: #0f172a;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  max-height: 350px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

.prompt-badge-row {
  margin-bottom: 0.5rem;
}

.prompt-status-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-secondary);
}

/* Quick Live API Box in Sidebar */
.live-api-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.api-box-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.api-input-row {
  display: flex;
  gap: 0.4rem;
}

.api-quick-input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  outline: none;
  background: #ffffff;
}

.api-quick-input:focus {
  border-color: var(--primary);
}

.api-quick-btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.api-quick-btn:hover {
  background: var(--primary-hover);
}

.api-hint {
  font-size: 0.66rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 850px) {
  .chat-app-container { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-light); }
}

