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

:root {
  --blue: #2563eb;
  --blue-dark: #1e3a5f;
  --blue-light: #dbeafe;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --sidebar-w: 260px;
  --green: #16a34a;
  --red: #dc2626;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-dark);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 20px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.logo-name { font-size: 18px; font-weight: 700; }
.logo-sub { font-size: 11px; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.5px; }

.status-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-dot.online { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.status-dot.offline { background: #f87171; }

.status-title { font-size: 13px; font-weight: 600; }
.status-url { font-size: 11px; opacity: 0.5; }

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.4;
  padding: 0 4px;
  margin-bottom: 4px;
}

.quick-actions { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.quick-actions::-webkit-scrollbar { width: 3px; }
.quick-actions::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.quick-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.quick-btn:hover { background: rgba(255,255,255,0.1); color: white; }

.quick-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer { margin-top: auto; }

.btn-clear {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-clear:hover { background: rgba(255,255,255,0.12); color: white; }

.btn-logout {
  display: block;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.35);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.4); color: #fca5a5; }

.quick-btn-ideas {
  background: rgba(99,102,241,0.15) !important;
  border: 1px solid rgba(99,102,241,0.3) !important;
  color: #c7d2fe !important;
}
.quick-btn-ideas:hover { background: rgba(99,102,241,0.25) !important; color: white !important; }

/* ─── CHAT ────────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--gray-200);
  background: white;
}

.chat-header h1 { font-size: 18px; font-weight: 600; }
.chat-header p { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.message.user .avatar {
  background: var(--gray-600);
}

.bubble {
  max-width: 72%;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.message.user .bubble {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.bubble p + p { margin-top: 6px; }

.report-buttons {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: inherit;
}

.btn-html {
  background: var(--blue-light);
  color: var(--blue);
}
.btn-html:hover { background: #bfdbfe; }

.btn-pdf {
  background: #fee2e2;
  color: var(--red);
}
.btn-pdf:hover { background: #fecaca; }

/* Typing indicator */
.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
}
.typing span {
  width: 7px;
  height: 7px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ─── INPUT ───────────────────────────────────── */
.chat-input-area {
  padding: 16px 28px 20px;
  background: white;
  border-top: 1px solid var(--gray-200);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: 14px;
  padding: 10px 10px 10px 16px;
  transition: border-color 0.15s;
}

.input-wrapper:focus-within { border-color: var(--blue); }

textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 140px;
  color: var(--gray-800);
}

textarea::placeholder { color: var(--gray-400); }

.btn-send {
  width: 38px;
  height: 38px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-send:hover { background: #1d4ed8; }
.btn-send:disabled { background: var(--gray-200); cursor: not-allowed; }

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

/* ─── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: white;
  border-radius: 16px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-800);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--gray-400);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-800); }

.modal-body { padding: 20px; }

.modal-row { display: flex; gap: 12px; }

.form-group-modal { flex: 1; }
.form-group-modal label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group-modal select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.form-group-modal select:focus { border-color: var(--blue); background: white; }

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  justify-content: flex-end;
}

.btn-modal-cancel {
  padding: 9px 18px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  color: var(--gray-600);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-modal-cancel:hover { background: var(--gray-100); }

.btn-modal-ok {
  padding: 9px 20px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-modal-ok:hover { background: #1d4ed8; }
