/* ===== SoulBot Light Design System ===== */

:root {
  --accent: #5b6db3;
  --accent-light: #7b8cc7;
  --accent-dim: #4a5a95;
  --color-bg: #f4f4f9;
  --color-surface: #ffffff;
  --color-surface-hover: rgba(0, 0, 0, 0.03);
  --color-border: rgba(0, 0, 0, 0.07);
  --color-text: #3a3a48;
  --color-text-dim: #787888;
  --color-text-bright: #1a1a28;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.10);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base ===== */
body {
  background: var(--color-bg);
  min-height: 100vh;
  color: var(--color-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== Navbar ===== */
.navbar {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  padding: 0.6rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-text-bright) !important;
  letter-spacing: -0.3px;
}

.navbar-brand svg { display: none; }

.navbar .nav-link {
  color: var(--color-text-dim) !important;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 6px;
  padding: 0.45rem 0.9rem !important;
  transition: var(--transition);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--color-text-bright) !important;
  background: rgba(0, 0, 0, 0.04);
}

.navbar .nav-link.active {
  color: var(--accent) !important;
  background: rgba(91, 109, 179, 0.1);
}

/* Hamburger toggler */
.navbar-toggler {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  background: rgba(0, 0, 0, 0.03);
}
.navbar-toggler:focus {
  box-shadow: 0 0 0 2px rgba(91, 109, 179, 0.2);
  outline: none;
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(60,60,70,0.6)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* Mobile nav */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-top: 0.6rem;
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }
  .navbar .nav-link {
    padding: 0.6rem 1rem !important;
    border-radius: 0;
  }
}

/* ===== Page Heading ===== */
h2 {
  font-weight: 700;
  color: var(--color-text-bright);
  letter-spacing: -0.2px;
  font-size: 1.5rem;
}

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(91, 109, 179, 0.2);
  box-shadow: var(--shadow-hover);
}

.card-header {
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-dim);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.85rem 1.25rem;
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  color: var(--color-text-bright);
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  transition: var(--transition);
  border: 1px solid transparent;
  letter-spacing: 0.1px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #fff;
}

.btn-success {
  background: #4a9b6a;
  border-color: #4a9b6a;
  color: #fff;
}
.btn-success:hover {
  background: #5aab7a;
  border-color: #5aab7a;
  color: #fff;
}

.btn-warning {
  background: #d4a840;
  border-color: #d4a840;
  color: #fff;
}
.btn-warning:hover {
  background: #deb850;
  border-color: #deb850;
  color: #fff;
}

.btn-danger {
  background: #d45050;
  border-color: #d45050;
  color: #fff;
}
.btn-danger:hover {
  background: #de6060;
  border-color: #de6060;
  color: #fff;
}

.btn-info {
  background: #4a8aaa;
  border-color: #4a8aaa;
  color: #fff;
}
.btn-info:hover {
  background: #5a9aba;
  border-color: #5a9aba;
  color: #fff;
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--color-text-dim);
}
.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--color-text-bright);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--accent-dim);
  color: var(--accent);
}
.btn-outline-primary:hover {
  background: rgba(91, 109, 179, 0.08);
  border-color: var(--accent);
  color: var(--accent-dim);
}

.btn-outline-secondary {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--color-text-dim);
}
.btn-outline-secondary:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.25);
  color: var(--color-text-bright);
}

.btn-outline-warning {
  background: transparent;
  border-color: rgba(212, 168, 64, 0.35);
  color: #b89020;
}
.btn-outline-warning:hover {
  background: rgba(212, 168, 64, 0.08);
  color: #a08010;
}

.btn-outline-danger {
  background: transparent;
  border-color: rgba(212, 80, 80, 0.35);
  color: #c04040;
}
.btn-outline-danger:hover {
  background: rgba(212, 80, 80, 0.08);
  color: #b03030;
}

.btn-outline-info {
  background: transparent;
  border-color: rgba(74, 138, 170, 0.35);
  color: #3a7a9a;
}
.btn-outline-info:hover {
  background: rgba(74, 138, 170, 0.08);
  color: #2a6a8a;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 0.7rem 1.8rem;
  font-size: 1rem;
  border-radius: 10px;
}

/* ===== Forms ===== */
.form-control {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  color: var(--color-text-bright);
  padding: 0.6rem 0.9rem;
  transition: var(--transition);
  font-size: 0.9rem;
}

.form-control:focus {
  background: #fff;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(91, 109, 179, 0.12);
  color: var(--color-text-bright);
}

.form-control::placeholder {
  color: rgba(0, 0, 0, 0.25);
}

.form-control:disabled {
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.3);
}

.form-label {
  color: var(--color-text-dim);
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.form-text {
  color: var(--color-text-dim);
  opacity: 0.8;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-input {
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* ===== Tables ===== */
.table {
  color: var(--color-text);
  margin-bottom: 0;
}

.table th {
  color: var(--color-text-dim);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-color: var(--color-border);
  padding: 0.75rem 1rem;
}

.table td {
  border-color: var(--color-border);
  padding: 0.7rem 1rem;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* ===== Alerts ===== */
.alert {
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.9rem;
}

.alert-danger {
  background: #fef0f0;
  border-color: #f5c0c0;
  color: #b03030;
}

.alert-success {
  background: #f0faf4;
  border-color: #b8e0c8;
  color: #307050;
}

.alert-warning {
  background: #fefaf0;
  border-color: #f0d8a0;
  color: #8a7020;
}

.alert-info {
  background: #f0f6fa;
  border-color: #b0d0e8;
  color: #305878;
}

/* ===== Chat ===== */
.chat-box {
  background: #fafafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  height: 55vh;
  max-height: 60vh;
  overflow-y: auto;
}

.chat-box::-webkit-scrollbar {
  width: 5px;
}
.chat-box::-webkit-scrollbar-track {
  background: transparent;
}
.chat-box::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.message {
  margin-bottom: 14px;
  animation: messageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message-role {
  font-weight: 600;
  font-size: 0.75rem;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.message.user .message-role {
  color: var(--accent);
}

.message.assistant .message-role {
  color: #4a9b6a;
}

.message-content {
  border-radius: 12px;
  padding: 10px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 0.9rem;
}

.message.user .message-content {
  background: rgba(91, 109, 179, 0.06);
  border: 1px solid rgba(91, 109, 179, 0.12);
}

.message.assistant .message-content {
  background: #fff;
  border: 1px solid var(--color-border);
}

.chat-input-area {
  position: sticky;
  bottom: 0;
  margin-top: 10px;
}

.chat-input-area .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.chat-input-area .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.typing-hint {
  color: rgba(74, 155, 106, 0.7);
  font-size: 0.82rem;
  margin-bottom: 6px;
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.9; }
}

.message { position: relative; }

/* ===== Avatar ===== */
.avatar-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

.avatar-img:hover {
  transform: scale(1.04);
  border-color: rgba(91, 109, 179, 0.4);
}

.avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

.avatar-placeholder:hover {
  transform: scale(1.04);
}

/* ===== Community ===== */
.community-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
}

.community-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-surface-hover);
  color: var(--color-text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
}

/* ===== Profile Page ===== */
.profile-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* ===== Empty State ===== */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.15;
}

.empty-state p {
  color: var(--color-text-dim);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ===== Badge ===== */
.badge-glow {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(91, 109, 179, 0.08);
  color: var(--accent);
  border: 1px solid rgba(91, 109, 179, 0.15);
}

.badge.bg-success {
  background: #4a9b6a !important;
}
.badge.bg-danger {
  background: #d45050 !important;
}
.badge.bg-warning {
  background: #d4a840 !important;
  color: #fff !important;
}
.badge.bg-secondary {
  background: rgba(0, 0, 0, 0.06) !important;
  color: var(--color-text-dim) !important;
}

/* ===== Text helpers ===== */
.text-muted { color: #787888 !important; }
.text-danger { color: #c04040 !important; }
.text-success { color: #307050 !important; }
.text-warning { color: #8a7020 !important; }
.text-info { color: #305878 !important; }

/* ===== Divider ===== */
.gradient-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.06), transparent);
  margin: 1.25rem 0;
}

/* ===== Link ===== */
a:not(.btn):not(.nav-link):not(.navbar-brand) {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:not(.btn):not(.nav-link):not(.navbar-brand):hover {
  color: var(--accent-dim);
}

/* ===== Pre / Code ===== */
pre {
  color: var(--color-text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ===== Bot Button ===== */
.btn-qqbot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--color-text-dim);
  transition: var(--transition);
  opacity: 0.5;
}

.btn-qqbot:hover {
  opacity: 1;
  background: rgba(91, 109, 179, 0.1);
  border-color: rgba(91, 109, 179, 0.25);
  color: var(--accent);
  transform: scale(1.08);
}

/* ===== Bot Modal ===== */
.qqbot-modal-content {
  background: #fff !important;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.15);
}

.qqbot-modal-content .modal-header {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-bright);
}

.qqbot-modal-content .modal-title {
  font-weight: 700;
  font-size: 1rem;
}

/* ===== Bot Status ===== */
.qqbot-status-on {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(74, 155, 106, 0.08);
  color: #4a9b6a;
  border: 1px solid rgba(74, 155, 106, 0.2);
}

.qqbot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4a9b6a;
  animation: bot-pulse 1.5s ease-in-out infinite;
}

@keyframes bot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 155, 106, 0.5); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 5px rgba(74, 155, 106, 0); }
}

/* ===== Messages / Inbox ===== */
.list-group-item-unread {
  background: rgba(91, 109, 179, 0.04) !important;
  border-left: 2px solid var(--accent-dim) !important;
}

/* ===== Modal ===== */
.modal-content {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.modal-header {
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-bright);
}

.modal-footer {
  border-top: 1px solid var(--color-border);
}

/* ===== Announcement Bar ===== */
.announcement-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fef8e8;
  border: 1px solid #f0d8a0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease both;
}

.announcement-icon {
  flex-shrink: 0;
  color: #b89020;
  margin-top: 1px;
}

.announcement-content {
  color: #8a7020;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.55;
  flex: 1;
}

/* ===== Announcement Modal ===== */
.announcement-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease both;
}

.announcement-modal {
  background: #fff;
  border: 1px solid rgba(200, 160, 80, 0.3);
  border-radius: 16px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.35s ease both;
}

.announcement-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px 0;
  color: #b89020;
}

.announcement-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #8a7020;
}

.announcement-modal-body {
  padding: 20px 28px;
  color: #5a5040;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.announcement-modal-footer {
  padding: 0 28px 24px;
  display: flex;
  justify-content: flex-end;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Agent icon color tags ===== */
.agent-icon-primary { background: var(--accent-dim); color: #fff; }
.agent-icon-success { background: #4a9b6a; color: #fff; }
.agent-icon-info    { background: #4a8aaa; color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
  h2 { font-size: 1.25rem; }
  .card-body { padding: 1rem; }
  .btn { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
  .chat-box { height: 50vh; max-height: 50vh; }
}
