/* ============================================
   Active Technology Bot - Light Theme Dashboard
   Optimized for Meta App Review Video
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f9;
  --bg-section: #f0f2f8;
  --border: #e2e5f1;
  --border-hover: #c7cce0;
  --text: #1a1d2e;
  --text-secondary: #5a6078;
  --text-muted: #8b90a5;
  --accent: #6c5ce7;
  --accent-light: rgba(108, 92, 231, 0.08);
  --accent-glow: rgba(108, 92, 231, 0.15);
  --green: #00b894;
  --green-bg: rgba(0, 184, 148, 0.08);
  --green-border: rgba(0, 184, 148, 0.2);
  --red: #e74c3c;
  --red-bg: rgba(231, 76, 60, 0.06);
  --red-border: rgba(231, 76, 60, 0.2);
  --blue: #0984e3;
  --blue-bg: rgba(9, 132, 227, 0.06);
  --blue-border: rgba(9, 132, 227, 0.2);
  --orange: #f39c12;
  --orange-bg: rgba(243, 156, 18, 0.06);
  --fb-blue: #1877F2;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

/* Subtle background pattern */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-orb {
  display: none;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 50% 0%, rgba(108, 92, 231, 0.03) 0%, transparent 60%);
}

/* ========== App Container ========== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ========== Header ========== */
.header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--fb-blue), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.2);
}

.logo-icon svg {
  width: 28px;
  height: 28px;
}

.logo-text h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-text .subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========== Status Indicator ========== */
.status-indicator {
  position: relative;
  width: 10px;
  height: 10px;
}

.status-indicator .dot {
  position: absolute;
  inset: 0;
  background: var(--green);
  border-radius: 50%;
}

.status-indicator .pulse {
  position: absolute;
  inset: -4px;
  background: var(--green);
  border-radius: 50%;
  opacity: 0.3;
  animation: pulse 2s infinite;
}

.status-indicator.offline .dot {
  background: var(--red);
}

.status-indicator.offline .pulse {
  background: var(--red);
  animation: none;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }

  50% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.status-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
}

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.badge {
  padding: 3px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== Connection Section ========== */
.connection-section {
  border: 2px solid rgba(24, 119, 242, 0.15);
  background: linear-gradient(135deg, #ffffff, rgba(24, 119, 242, 0.02));
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  background: var(--fb-blue);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.25);
}

.primary-btn:hover {
  background: #1565d8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(24, 119, 242, 0.35);
}

.primary-btn:active {
  transform: translateY(0);
}

.danger-btn {
  padding: 10px 20px;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.danger-btn:hover {
  background: rgba(231, 76, 60, 0.12);
}

.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--bg-section);
  color: var(--text-muted);
}

.status-badge.badge-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.status-badge.badge-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* ========== Auth Message ========== */
.auth-message {
  padding: 16px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-weight: 600;
  font-size: 0.9rem;
  animation: slideDown 0.4s ease;
}

.auth-message.success {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: #0a7b61;
}

.auth-message.error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: #c0392b;
}

@keyframes slideDown {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== Stats Grid ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.messages-icon {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

.replies-icon {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.errors-icon {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.uptime-icon {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  transition: all 0.3s ease;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ========== Main Grid ========== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* ========== Test Chat ========== */
.test-section .test-chat {
  display: flex;
  flex-direction: column;
  height: 380px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 92, 231, 0.15) transparent;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--accent-light);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.message-content {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 85%;
  box-shadow: var(--shadow-sm);
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-content {
  background: var(--accent-light);
  border-color: rgba(108, 92, 231, 0.15);
}

.user-message .message-avatar {
  background: var(--accent-light);
}

.message-content p {
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text);
}

.message-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
}

/* Typing */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 6px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.5);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input */
.chat-input-area {
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  outline: none;
  transition: all 0.2s ease;
}

.chat-input-area input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.chat-input-area input::placeholder {
  color: var(--text-muted);
}

.chat-input-area button {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.chat-input-area button svg {
  width: 18px;
  height: 18px;
}

.chat-input-area button:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ========== Config Items ========== */
.config-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.config-icon {
  font-size: 0.95rem;
}

.config-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.config-status {
  font-size: 0.78rem;
  font-weight: 700;
}

/* ========== Activity Log ========== */
.activity-list {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 92, 231, 0.1) transparent;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-section);
  font-size: 0.76rem;
}

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-dot.system {
  background: var(--blue);
}

.activity-dot.message {
  background: var(--green);
}

.activity-dot.reply {
  background: var(--accent);
}

.activity-dot.error {
  background: var(--red);
}

.activity-text {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  color: var(--text-muted);
  font-size: 0.62rem;
  flex-shrink: 0;
  font-family: 'Inter', monospace;
}

/* ========== Permissions Section ========== */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.permission-card {
  padding: 18px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.25s ease;
}

.permission-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.permission-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.permission-name {
  font-family: 'Inter', 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.permission-required {
  padding: 2px 10px;
  font-size: 0.62rem;
  font-weight: 700;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 20px;
  border: 1px solid var(--red-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.permission-why {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

.permission-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

/* ========== Privacy Section ========== */
.privacy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.privacy-item {
  text-align: center;
  padding: 24px 14px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.25s ease;
}

.privacy-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.privacy-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.privacy-item h3 {
  font-size: 0.82rem;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text);
}

.privacy-item p {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========== How It Works Section ========== */
.how-it-works-section {
  border: 2px solid rgba(108, 92, 231, 0.12);
  background: linear-gradient(135deg, #ffffff, rgba(108, 92, 231, 0.02));
}

.how-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.7;
  margin-bottom: 24px;
}

.how-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.how-step {
  flex: 1;
  min-width: 160px;
  text-align: center;
  padding: 20px 14px;
  position: relative;
}

.how-step-num {
  position: absolute;
  top: 8px;
  left: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.how-step-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.how-step h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.how-step p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.how-step-arrow {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  margin-top: 36px;
  flex-shrink: 0;
}

/* ========== Data Flow Section ========== */
.data-flow-section {
  border: 2px solid rgba(0, 184, 148, 0.15);
  background: linear-gradient(135deg, #ffffff, rgba(0, 184, 148, 0.02));
}

.data-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-section);
}

.flow-emoji {
  font-size: 1.2rem;
}

.flow-user {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue);
}

.flow-webhook {
  background: var(--orange-bg);
  border-color: rgba(243, 156, 18, 0.2);
  color: #d68910;
}

.flow-ai {
  background: var(--accent-light);
  border-color: rgba(108, 92, 231, 0.2);
  color: var(--accent);
}

.flow-reply {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

.flow-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

.flow-notice {
  padding: 14px 20px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #c0392b;
  line-height: 1.6;
  text-align: center;
}

.flow-notice span {
  font-size: 1rem;
}

/* ========== Permission Usage ========== */
.permission-usage {
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 8px;
  font-weight: 600;
  font-style: italic;
}

.permission-card code {
  background: rgba(108, 92, 231, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--accent);
  font-family: 'Inter', monospace;
}

/* ========== Permission Tags ========== */
.perm-tag {
  font-size: 0.7rem;
  padding: 4px 12px;
  background: #f0f2f8;
  border: 1px solid #e2e5f1;
  border-radius: 20px;
  color: #5a6078;
  font-weight: 600;
}

/* ========== Test Description ========== */
.test-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ========== Technical Details ========== */
.tech-section {
  border: 2px solid rgba(9, 132, 227, 0.12);
  background: linear-gradient(135deg, #ffffff, rgba(9, 132, 227, 0.02));
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tech-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tech-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tech-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

/* ========== Badge Variants ========== */
.badge-green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: #5b4bc7;
}

/* ========== Step Indicator (for video) ========== */
.step-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 20px 0;
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.step-item:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.step-item:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.step-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(108, 92, 231, 0.2);
}

.step-item.done {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: currentColor;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
}

.step-item.active .step-num {
  background: var(--accent);
}

.step-item.done .step-num {
  background: var(--green);
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .privacy-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tech-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .how-step-arrow {
    display: none;
  }

  .how-steps {
    gap: 8px;
  }

  .data-flow {
    flex-direction: column;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 600px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .tech-grid {
    grid-template-columns: 1fr;
  }

  .app-container {
    padding: 12px;
  }

  .step-flow {
    flex-direction: column;
  }

  .step-item {
    border-radius: var(--radius-sm) !important;
  }
}