/* DESIGN SYSTEM VARIABLES */
:root {
  --font-title: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  /* Color Palette */
  --bg-primary: #0a0d16;
  --bg-secondary: #121824;
  --bg-tertiary: #1b2336;
  --border-color: #242f4c;
  
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.15);
  
  --success: #10b981; /* Emerald */
  --success-glow: rgba(16, 185, 129, 0.15);
  
  --danger: #ef4444; /* Red */
  --danger-hover: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.15);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  --glass-bg: rgba(18, 24, 36, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* GENERAL STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
}

/* NAVIGATION */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(10, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 24px;
}

.logo {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  color: var(--primary);
  font-size: 22px;
  filter: drop-shadow(0 0 8px var(--primary));
}

.logo span span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition-smooth);
}

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

/* BUTTONS */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 14px var(--danger-glow);
}

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

.btn-admin {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-admin:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-block {
  display: flex;
  width: 100%;
  justify-content: center;
}

/* HERO SECTION */
.hero-section {
  position: relative;
  min-height: 550px;
  padding-top: 140px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.badge {
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 24px;
}

.hero-section h1 {
  font-size: 52px;
  line-height: 1.2;
  margin-bottom: 20px;
  background: linear-gradient(to right, #ffffff, #93c5fd, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  color: var(--text-muted);
  font-size: 18px;
  max-width: 600px;
  margin-bottom: 32px;
}

.hero-bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

/* PRODUCTS SECTION */
.products-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 120px;
}

.section-title {
  font-size: 32px;
  text-align: center;
  margin-bottom: 48px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

.product-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.product-card:hover {
  transform: translateY(-8px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.product-image {
  height: 220px;
  background: var(--bg-tertiary);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.product-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  text-transform: uppercase;
}

.product-badge.sale {
  background: #f59e0b;
}

.card-icon {
  font-size: 72px;
  color: var(--text-muted);
  opacity: 0.75;
  transition: var(--transition-smooth);
}

.product-card:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
  color: var(--primary);
  opacity: 1;
}

.product-info {
  padding: 24px;
}

.product-info h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.product-info .price {
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.product-info p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  min-height: 44px;
}

.btn-buy {
  width: 100%;
  justify-content: center;
}

/* CHAT WIDGET */
.chat-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Chat Launcher Button */
.chat-launcher {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  position: relative;
  transition: var(--transition-smooth);
}

.chat-launcher:hover {
  transform: scale(1.08);
}

.chat-launcher i {
  transition: var(--transition-smooth);
}

.pulse-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-primary);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Chat Box window */
.chat-box {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 380px;
  height: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.chat-box.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Chat Header */
.chat-header {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: var(--primary);
  position: relative;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-tertiary);
}

.status-dot.online {
  background: var(--success);
}

.agent-info h4 {
  font-size: 15px;
  font-weight: 600;
}

.agent-info .status-text {
  font-size: 12px;
  color: var(--success);
}

.btn-close-chat {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-close-chat:hover {
  color: var(--text-main);
}

/* Chat Body (Scrollable messages / pre-chat) */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.03) 0%, rgba(0,0,0,0) 60%);
}

.welcome-message {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 30px;
}

.welcome-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px var(--primary-glow));
}

.welcome-message h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.welcome-message p {
  color: var(--text-muted);
  font-size: 14px;
}

/* PRE CHAT FORM */
.pre-chat-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-group input, .form-group textarea {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-smooth);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.helper-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* MESSAGES LIST & BUBBLES */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  animation: message-fade 0.25s ease-out forwards;
}

@keyframes message-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.visitor {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.agent {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.sender-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  display: block;
}

.message-text {
  word-break: break-word;
}

/* Delivery Status Indicators */
.delivery-info {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.delivery-info.failed {
  color: var(--danger);
}

.btn-retry-msg {
  background: transparent;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

/* Chat Footer & Input */
.chat-footer {
  border-top: 1px solid var(--border-color);
  padding: 12px 0 0;
  margin-top: 12px;
}

.input-container {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  transition: var(--transition-smooth);
}

.input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-container textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 80px;
}

.btn-send-message {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  transition: var(--transition-smooth);
}

.btn-send-message:hover {
  transform: scale(1.1);
  color: #818cf8;
}

/* ADMIN PANEL (DRAWER) */
.admin-panel-overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 500px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  z-index: 999;
  transform: translateX(100%);
  transition: var(--transition-smooth);
  display: flex;
}

.admin-panel-overlay.open {
  transform: translateX(0);
}

.admin-panel-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

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

.admin-header h3 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #10b981;
}

.btn-close-admin {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.btn-close-admin:hover {
  color: var(--text-main);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.tab-btn {
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.02);
}

.tab-btn.active {
  color: #10b981;
  border-bottom-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

/* Tab Content */
.tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Config Tab Specifics */
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
  padding-bottom: 6px;
}

.copy-url-container {
  display: flex;
  gap: 8px;
}

.copy-url-container input {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: #34d399;
}

.btn-copy {
  padding: 0 16px;
}

.form-actions-admin {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Conversations List Tab */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  font-size: 14px;
}

.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conv-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.conv-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.conv-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.conv-item-lastmsg {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.03);
  padding-top: 8px;
}

/* Webhook Logs Tab */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  font-family: monospace;
  font-size: 12px;
}

.log-item-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.log-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
}

.log-badge.inbound {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.log-badge.outbound {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.log-method {
  font-weight: 700;
}

.log-status {
  font-weight: 700;
}

.log-status.status-2xx {
  color: var(--success);
}

.log-status.status-error {
  color: var(--danger);
}

.log-item-body {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  background: #0d111a;
  display: none;
}

.log-item.expanded .log-item-body {
  display: block;
}

.log-section-title {
  color: #818cf8;
  margin-bottom: 4px;
  margin-top: 8px;
  font-weight: 700;
}

.log-section-title:first-child {
  margin-top: 0;
}

.log-item-body pre {
  background: #07090e;
  padding: 8px;
  border-radius: 4px;
  overflow-x: auto;
  color: #e5e7eb;
  font-size: 11px;
}
