/* ========================================================
   TriggerBot - Windows 11 / Fluent Design Dark Theme
   ======================================================== */

:root {
  /* Fluent Dark Color Palette */
  --bg-desktop: #18181b;
  --bg-acrylic: rgba(26, 26, 31, 0.78);
  --bg-acrylic-strong: rgba(22, 22, 26, 0.92);
  --bg-card: rgba(35, 35, 42, 0.65);
  --bg-card-hover: rgba(45, 45, 54, 0.85);
  --bg-card-active: rgba(55, 55, 66, 0.95);
  --bg-input: rgba(24, 24, 28, 0.85);
  --bg-modal-backdrop: rgba(10, 10, 14, 0.75);

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);
  --border-focus: #0078d4;

  /* Accent Colors (Windows 11 Accent Blue) */
  --accent: #0078d4;
  --accent-hover: #1084d8;
  --accent-active: #0067b8;
  --accent-soft: rgba(0, 120, 212, 0.18);
  --accent-soft-border: rgba(0, 120, 212, 0.38);

  /* Status Colors */
  --success: #107c41;
  --success-glow: rgba(16, 124, 65, 0.25);
  --warning: #ff8c00;
  --warning-glow: rgba(255, 140, 0, 0.25);
  --danger: #d13438;
  --danger-hover: #b82d30;
  --danger-glow: rgba(209, 52, 56, 0.25);
  --info: #0099bc;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #c8c8cf;
  --text-tertiary: #8e8e99;
  --text-disabled: #5a5a65;

  /* Elevation Shadows */
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 24px rgba(0, 120, 212, 0.3);

  /* Geometry & Animation */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  /* Font */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-desktop);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 120, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 124, 65, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Container & Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar (Navigation) */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-acrylic);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0078d4, #00bcff);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 120, 212, 0.4);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: block;
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

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

.nav-item.active {
  background: var(--accent-soft);
  color: #60cdff;
  border-color: var(--accent-soft-border);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.85;
}

.nav-item.active svg {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bot-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-disabled);
}

.status-dot.online {
  background: #107c41;
  box-shadow: 0 0 8px #107c41;
}

.status-dot.not_configured {
  background: #ff8c00;
  box-shadow: 0 0 8px #ff8c00;
}

.status-dot.error {
  background: #d13438;
  box-shadow: 0 0 8px #d13438;
}

.user-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--bg-card-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: #60cdff;
  border: 1px solid var(--border-subtle);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(209, 52, 56, 0.2);
  color: #ff9999;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  height: 56px;
  background: var(--bg-acrylic);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
}

.content-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Fluent Acrylic Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-bright);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Dashboard Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.fluent-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.fluent-table th {
  padding: 14px 16px;
  background: rgba(20, 20, 24, 0.6);
  color: var(--text-tertiary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.fluent-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.fluent-table tr:last-child td {
  border-bottom: none;
}

.fluent-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-mode-exact {
  background: rgba(142, 68, 173, 0.2);
  color: #d291ff;
  border-color: rgba(142, 68, 173, 0.4);
}

.badge-mode-contains {
  background: rgba(0, 120, 212, 0.2);
  color: #60cdff;
  border-color: rgba(0, 120, 212, 0.4);
}

.badge-mode-all_words {
  background: rgba(16, 124, 65, 0.2);
  color: #6ccb5f;
  border-color: rgba(16, 124, 65, 0.4);
}

.badge-mode-smart {
  background: rgba(255, 140, 0, 0.2);
  color: #ffaa44;
  border-color: rgba(255, 140, 0, 0.4);
}

.badge-active {
  background: rgba(16, 124, 65, 0.2);
  color: #6ccb5f;
}

.badge-inactive {
  background: rgba(209, 52, 56, 0.2);
  color: #ff8888;
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: monospace;
}

/* Fluent Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: rgba(30, 30, 36, 0.95);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  background: var(--accent-active);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--border-bright);
}

.btn-danger {
  background: rgba(209, 52, 56, 0.2);
  color: #ff9999;
  border-color: rgba(209, 52, 56, 0.4);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
}

/* Fluent Switch Toggle */
.fluent-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.fluent-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: var(--transition-fast);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: var(--transition-fast);
  border-radius: 50%;
}

.fluent-switch input:checked + .switch-slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

.fluent-switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-modal-backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal-window {
  background: var(--bg-acrylic-strong);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(16, 16, 20, 0.6);
}

/* Toast Notifications (Action Center) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--bg-acrylic-strong);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
.toast.warning { border-left: 4px solid var(--warning); }

/* Login Page Overlay */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, #1f1f26 0%, #111115 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(30, 30, 38, 0.85);
  backdrop-filter: blur(30px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-modal);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header .brand-icon {
  margin: 0 auto 16px;
  width: 52px;
  height: 52px;
}

.login-header .brand-icon svg {
  width: 28px;
  height: 28px;
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.login-header p {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: block;
  }

  .content-viewport {
    padding: 16px;
  }
}
