/* ============================================================
   BotHippo Premium Design System — theme.css
   Shared across all pages for a consistent, glossy UI
   ============================================================ */

/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== CSS VARIABLES ===== */
:root {
  /* Backgrounds */
  --bg-deep: #060B18;
  --bg-primary: #060B18;
  --bg-surface: #0D1526;
  --bg-card: rgba(15, 25, 50, 0.6);
  --bg-card-solid: #0F1932;
  --bg-input: rgba(148, 163, 200, 0.08);
  --bg-hover: rgba(148, 163, 200, 0.06);

  /* Accent Palette */
  --accent: #00D4FF;
  --accent-dark: #009FCC;
  --accent-glow: rgba(0, 212, 255, 0.25);
  --accent-2: #7C3AED;
  --accent-2-glow: rgba(124, 58, 237, 0.25);

  /* Text */
  --text-primary: #F0F4FF;
  --text-secondary: #94A3C8;
  --text-muted: #637394;
  --text-heading: #FFFFFF;

  /* Borders */
  --border: rgba(148, 163, 200, 0.12);
  --border-focus: rgba(0, 212, 255, 0.5);

  /* Status Colors */
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #FBBF24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --info: #60A5FA;
  --info-bg: rgba(96, 165, 250, 0.12);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 60px var(--accent-glow);
}

/* ===== BASE ===== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== ANIMATED BACKGROUND ===== */
.page-bg {
  position: relative;
  min-height: 100vh;
}

.page-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(0, 212, 255, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(124, 58, 237, 0.05), transparent);
}

.page-bg::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='grid' width='60' height='60' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 60 0 L 0 0 0 60' fill='none' stroke='rgba(148,163,200,0.03)' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23grid)' width='100%25' height='100%25'/%3E%3C/svg%3E");
}

.page-bg>* {
  position: relative;
  z-index: 1;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #33DDFF;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== LAYOUT HELPERS ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

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

.gap-sm {
  gap: 0.5rem;
}

.gap-md {
  gap: 1rem;
}

.gap-lg {
  gap: 1.5rem;
}

.gap-xl {
  gap: 2rem;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 0.75rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mr-1 {
  margin-right: 0.25rem;
}

.mr-2 {
  margin-right: 0.5rem;
}

.mr-3 {
  margin-right: 0.75rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.block {
  display: block;
}

.inline-flex {
  display: inline-flex;
  align-items: center;
}

.relative {
  position: relative;
}

.sticky {
  position: sticky;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

.flex-grow {
  flex-grow: 1;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.space-y-2>*+* {
  margin-top: 0.5rem;
}

.space-y-4>*+* {
  margin-top: 1rem;
}

.space-y-6>*+* {
  margin-top: 1.5rem;
}

.min-h-screen {
  min-height: 100vh;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

/* ===== GRID ===== */
.grid {
  display: grid;
}

.grid-1 {
  grid-template-columns: 1fr;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ===== SITE HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 11, 24, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  transition: background 0.3s, box-shadow 0.3s;
}

.site-header.scrolled {
  background: rgba(6, 11, 24, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.header-inner {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-inner img {
  height: 36px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--accent);
}

.header-user-info {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== GLASS CARDS ===== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  box-shadow: var(--shadow-hover);
}

.glass-card-static {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.card-design {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all 0.3s ease;
}

.card-design:hover {
  border-color: rgba(0, 212, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff !important;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-secondary {
  background: rgba(148, 163, 200, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 200, 0.18);
  border-color: rgba(148, 163, 200, 0.25);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #DC2626);
  color: #fff !important;
  box-shadow: 0 4px 16px var(--danger-bg);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--danger-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1rem;
  border-radius: 14px;
}

.btn-block {
  width: 100%;
}

/* ===== INPUTS & FORMS ===== */
.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all 0.25s ease;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
  background: rgba(148, 163, 200, 0.12);
}

.input-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.input-field {
  appearance: none;
  cursor: pointer;
}

select.input-field option {
  background: #1a2332;
  color: var(--text-primary);
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.3px;
}

.form-group {
  margin-bottom: 1.25rem;
}

/* ===== MESSAGE BOXES ===== */
.message-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.message-box.hidden {
  display: none !important;
}

.message-box.error,
.message-box.bg-red-500 {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.message-box.success,
.message-box.bg-green-500 {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.message-box.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(160deg, #111C35, #0D1526);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  color: var(--text-primary);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 200, 0.04);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: background 0.2s;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--accent);
}

/* ===== STATUS BADGES ===== */
.status-active,
.status-badge-active {
  color: var(--success);
  font-weight: 600;
}

.status-pending,
.status-badge-pending {
  color: var(--warning);
  font-weight: 600;
}

.status-inactive {
  color: var(--danger);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-card .stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-heading);
}

/* ===== AUTH PAGES (Login, Signup, etc.) ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-card), 0 0 80px rgba(0, 212, 255, 0.06);
  position: relative;
  z-index: 1;
}

.auth-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.auth-card h2 i {
  color: var(--accent);
}

.auth-card .auth-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.auth-card .auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

.auth-header-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
  z-index: 2;
}

/* ===== SIDEBAR (Chat, Flow Builder) ===== */
.sidebar {
  background: rgba(13, 21, 38, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
}

/* ===== CHAT-SPECIFIC ===== */
.btn-action {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.unread-badge {
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.bot-unread-indicator {
  background: var(--accent);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1001;
  background: linear-gradient(160deg, #111C35, #0D1526);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s ease-out;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 200, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 200, 0.25);
}

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .header-nav {
    gap: 0.5rem;
  }

  .header-nav .hide-mobile {
    display: none;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .auth-card {
    padding: 1.75rem;
  }
}