/* Botech Professional Design System */

/* Color Palette */
:root {
  /* Brand Colors */
  --primary: #134686;    /* Deep Blue */
  --secondary: #ED3F27;  /* Red */
  --accent: #FEB21A;     /* Yellow */
  
  /* Neutral Colors */
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-light: #718096;
  --border: #e2e8f0;
  --border-light: #f7fafc;
  
  /* Interactive States */
  --primary-hover: #0f3a73;
  --primary-light: #e6f0ff;
  --secondary-hover: #d63320;
  --secondary-light: #fef2f2;
  --accent-hover: #e09900;
  --accent-light: #fffbeb;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
}

/* Reset & Base Styles */
* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

html { 
  height: 100%; 
  scroll-behavior: smooth;
}

body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { 
  max-width: 100%; 
  display: block; 
  height: auto;
}

a { 
  color: inherit; 
  text-decoration: none; 
  transition: all 0.2s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-sm);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.875rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p { margin-bottom: var(--space-md); }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container.small { max-width: 768px; }
.container.large { max-width: 1400px; }

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
}

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

@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  height: 72px;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-links { 
  display: none; 
  gap: var(--space-xl); 
  align-items: center;
}

.nav-links a { 
  color: var(--text-muted); 
  font-weight: 500;
  padding: var(--space-sm) 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active { 
  color: var(--primary); 
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-cta { 
  display: flex; 
  gap: var(--space-sm); 
  align-items: center;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn:active { 
  transform: translateY(0); 
  box-shadow: var(--shadow);
}

.btn.secondary {
  background: var(--secondary);
  border-color: var(--secondary);
}

.btn.secondary:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
}

.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text);
}

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

.btn.ghost { 
  background: transparent; 
  color: var(--primary); 
  border: 2px solid var(--border);
  box-shadow: none;
}

.btn.ghost:hover { 
  background: var(--primary-light); 
  border-color: var(--primary);
}

.btn.outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  box-shadow: none;
}

.btn.outline:hover {
  background: var(--primary);
  color: white;
}

.btn.danger { 
  background: var(--secondary); 
  border-color: var(--secondary);
}

.btn.danger:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
}

.btn.large {
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
}

.btn.small {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-xl);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card.highlight {
  border: 2px solid var(--primary);
  position: relative;
}

.card.highlight::before {
  content: 'Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--text);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Hero Section */
.hero {
  padding: var(--space-3xl) 0;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg) 50%, var(--accent-light) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23134686' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  z-index: -1;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-xl);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(19, 70, 134, 0.1);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .lead {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  line-height: 1.6;
}

.hero .actions { 
  display: flex; 
  gap: var(--space-md); 
  flex-wrap: wrap; 
  align-items: center;
}

/* Feature Cards */
.feature {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.feature-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.feature h3 { 
  margin-bottom: var(--space-sm); 
  font-size: 1.25rem; 
  color: var(--primary);
}

.feature p { 
  margin: 0; 
  color: var(--text-muted); 
  line-height: 1.6;
}

/* Pricing */
.pricing { 
  padding: var(--space-3xl) 0; 
  background: var(--bg-alt);
}

.plan {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  height: 100%;
}

.plan h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.price { 
  font-size: 2.5rem; 
  font-weight: 800; 
  color: var(--primary);
  line-height: 1;
}

.price small { 
  font-weight: 500; 
  color: var(--text-muted); 
  font-size: 1rem; 
}

.plan ul { 
  margin: 0; 
  padding: 0; 
  list-style: none;
  flex-grow: 1;
}

.plan li {
  padding: var(--space-sm) 0;
  color: var(--text-muted);
  position: relative;
  padding-left: var(--space-lg);
}

.plan li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* Forms */
form { margin: 0; }

.form-row { 
  display: grid; 
  gap: var(--space-lg); 
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .form-row { grid-template-columns: repeat(2, 1fr); }
}

label { 
  font-weight: 600; 
  display: block; 
  margin-bottom: var(--space-sm); 
  color: var(--text);
}

input[type="text"], 
input[type="email"], 
input[type="password"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 1rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

input:focus, 
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 70, 134, 0.1);
}

textarea { 
  min-height: 120px; 
  resize: vertical; 
  line-height: 1.6;
}

input[type="file"] {
  padding: var(--space-sm);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  cursor: pointer;
}

/* Sections */
section { 
  padding: var(--space-3xl) 0; 
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--space-md);
  color: var(--primary);
}

.section-header p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Footer */
.footer { 
  padding: var(--space-2xl) 0; 
  border-top: 1px solid var(--border); 
  background: var(--bg-alt); 
}

.footer p { 
  color: var(--text-muted); 
  margin: 0; 
  text-align: center; 
}

/* Dashboard Layout */
.dash { 
  display: grid; 
  grid-template-columns: 1fr; 
  min-height: calc(100vh - 72px);
}

.dash-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: var(--space-lg);
  position: relative;
}

.dash-burger { 
  position: absolute; 
  right: var(--space-lg); 
  top: var(--space-lg); 
  cursor: pointer; 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  background: var(--bg);
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.dash-burger:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.dash-sidebar #sidebar-toggle { display: none; }

.dash-user { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md); 
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
}

.avatar { 
  width: 48px; 
  height: 48px; 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.avatar img {
  width: 48px;
  height: auto;
  border-radius: 50%;
}

.avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.user-meta { 
  color: var(--text-muted); 
  font-size: 0.875rem; 
}

.user-meta strong { 
  color: var(--text); 
  display: block; 
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.dash-nav { 
  display: flex;
  flex-direction: column;
  gap: var(--space-xs); 
}

.dash-nav a { 
  padding: var(--space-md); 
  border-radius: var(--radius); 
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all 0.2s ease;
}

.dash-nav a:hover { 
  background: var(--primary-light); 
  color: var(--primary); 
}

.dash-nav a.active { 
  background: var(--primary); 
  color: white; 
}

.dash-main { 
  padding: var(--space-xl); 
  background: var(--bg-alt);
  width: 100%;
  overflow-x: auto;
}

/* Dashboard specific container overrides */
.dash-main .container { 
  max-width: none !important; 
  padding: 0 !important;
  width: 100% !important;
}

.dash-main section { 
  padding: 0 !important;
  width: 100%;
}

.dash-main section > div {
  width: 100%;
  max-width: none;
  padding: 0;
}

.dash-main section .container { 
  max-width: none !important; 
  padding: 0 !important; 
  width: 100% !important;
}

/* IMPORTANT: Do not override explicit grid column classes inside dashboard.
   Pages use .grid.cols-2 / .grid.cols-3 to control layout. */

/* Ensure dashboard content uses full width */
.dash-main > *,
.dash-main section > *,
.dash-main section > div > * {
  width: 100%;
}

.dash-main .card,
.dash-main form,
.dash-main .grid {
  width: 100%;
}

/* Override any container constraints in dashboard */
.dash .container,
.dash section .container,
.dash section > div {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
}

@media (min-width: 1024px) {
  .dash { 
    grid-template-columns: 280px 1fr; 
  }
  .dash-burger { display: none; }
}

/* Sidebar collapse on mobile */
@media (max-width: 1023px) {
  .dash-sidebar { 
    position: sticky; 
    top: 72px; 
    z-index: 10; 
  }
  .dash-nav { display: none; }
  #sidebar-toggle:checked ~ .dash-nav { 
    display: flex; 
    margin-top: var(--space-lg); 
  }
}

/* Utilities */
.center { text-align: center; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.muted { color: var(--text-muted); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.font-bold { font-weight: 700; }

.spacer { height: var(--space-lg); }
.spacer-sm { height: var(--space-sm); }
.spacer-lg { height: var(--space-xl); }
.spacer-xl { height: var(--space-2xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Responsive Design */
@media (max-width: 640px) {
  .container { padding: 0 var(--space-md); }
  .hero { padding: var(--space-2xl) 0; }
  .hero h1 { font-size: 2.5rem; }
  .hero .lead { font-size: 1.125rem; }
  .hero .actions { flex-direction: column; width: 100%; }
  .hero .actions .btn { width: 100%; justify-content: center; }
  
  .nav-cta { flex-direction: column; gap: var(--space-xs); }
  .nav-cta .btn { font-size: 0.875rem; padding: var(--space-xs) var(--space-md); }
  
  section { padding: var(--space-2xl) 0; }
  .card { padding: var(--space-lg); }
  
  .form-row { grid-template-columns: 1fr; }
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Focus styles for accessibility */
.btn:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .nav, .footer, .dash-sidebar { display: none; }
  .dash-main { padding: 0; }
  * { box-shadow: none !important; }
}

/* ----------------------------------------- */
/* Global Alerts                             */
/* ----------------------------------------- */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ----------------------------------------- */
/* Icon Buttons & Small Controls             */
/* ----------------------------------------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--bg-alt);
  border-color: var(--primary);
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fecaca;
}

/* ----------------------------------------- */
/* Knowledge List (Dashboard)                */
/* ----------------------------------------- */
.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.knowledge-item {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.knowledge-item.inactive {
  opacity: 0.6;
  background: var(--bg-alt);
}

.knowledge-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.knowledge-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.knowledge-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-inactive {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
}

.knowledge-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.knowledge-actions {
  display: flex;
  gap: 0.5rem;
}

.knowledge-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.empty-state {
  text-align: center;
  padding: 2rem;
}

/* ----------------------------------------- */
/* Stats Row (Dashboard cards)               */
/* ----------------------------------------- */
.stats-row {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.stat-item { 
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-xs); 
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ----------------------------------------- */
/* Utilities & Helpers                       */
/* ----------------------------------------- */
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.sticky { position: sticky; }
.top-lg { top: var(--space-lg); }
.font-mono { font-family: 'Monaco', 'Menlo', 'Courier New', monospace; }
.space-y-sm > * + * { margin-top: var(--space-sm); }
.space-y-md > * + * { margin-top: var(--space-md); }
.py-xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
.chatbots-list { display: flex; flex-direction: column; gap: var(--space-lg); }

/* Responsive tweaks for stats row */
@media (max-width: 768px) {
  .stats-row { flex-direction: column; gap: var(--space-sm); }
}