/* ==========================================================================
   OmniConnect Premium Stylesheet
   Design Language: Dark Glassmorphic, Vibrant Gradients, Fluid Animations
   ========================================================================== */

:root {
  --font-primary: 'Inter', sans-serif;
  
  /* Color Palette: Thu Cầm Baby Light Pink Theme */
  --bg-app: #fff5f6; /* Nền hồng trắng sữa dịu nhẹ */
  --bg-sidebar: #ffffff; /* Nền trắng */
  --bg-card: #ffffff; /* Nền trắng */
  --bg-input: #ffffff; /* Nền trắng */
  --border-light: #ffe4e6; /* Viền hồng nhạt */
  --border-focus: #f43f5e; /* Hồng đậm khi focus */
  
  --text-main: #1e293b; /* Slate-800 (Chữ nội dung, hàng bảng màu xám đậm dễ đọc) */
  --text-muted: #64748b; /* Slate-500 (Chữ phụ xám nhẹ) */
  --text-dark: #881337; /* Rose-900 (Màu đỏ đô cho Tiêu đề và Nhãn nổi bật) */
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #f43f5e, #db2777); /* Hồng cánh sen / Rose gradient */
  --grad-success: linear-gradient(135deg, #10b981, #059669);
  --grad-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --grad-info: linear-gradient(135deg, #f43f5e, #fb7185);
  
  /* Brand Specifics */
  --color-facebook: #1877f2;
  --color-zalo: #0068ff;
  --color-shopee: #ee4d2d;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glow-shadow: 0 4px 15px rgba(244, 63, 94, 0.1);
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  font-family: var(--font-primary);
  font-weight: 700;
}

/* Main Container: 3-column Layout grid */
.app-container {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  width: 100vw;
  height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(244, 63, 94, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(219, 39, 119, 0.05) 0%, transparent 40%);
}

/* Hide scrollbars but preserve scrolling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(244, 63, 94, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  font-family: var(--font-primary);
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
}

.btn-primary { background: var(--grad-primary); color: white; box-shadow: var(--glow-shadow); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }

.btn-success { background: var(--grad-success); color: white; }
.btn-success:hover { transform: translateY(-2px); filter: brightness(1.1); }

.btn-danger { background: var(--grad-danger); color: white; }
.btn-danger:hover { transform: translateY(-2px); filter: brightness(1.1); }

.btn-info { background: var(--grad-info); color: white; }
.btn-info:hover { transform: translateY(-2px); filter: brightness(1.1); }

.btn-block { width: 100%; }

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input, .form-group textarea {
  font-family: var(--font-primary);
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-input);
  color: white;
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}
.form-group input:focus, .form-group textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}
.form-help {
  font-size: 11px;
  color: var(--text-dark);
  margin-top: 4px;
}

/* ==========================================
   SIDEBAR COMPONENT
   ========================================== */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--grad-primary);
  position: relative;
}
.logo-icon::after {
  content: '⚡';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
}

.logo-area h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Online Pulse Animation */
.online-pulse {
  position: relative;
  padding-left: 18px;
}
.online-pulse::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: translateY(-50%) scale(0.9); opacity: 0.7; }
  50% { transform: translateY(-50%) scale(1.2); opacity: 1; }
  100% { transform: translateY(-50%) scale(0.9); opacity: 0.7; }
}

/* Nav Tabs in Sidebar */
.nav-tabs {
  display: flex;
  padding: 15px;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}

.nav-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.nav-tab:hover {
  background: rgba(244, 63, 94, 0.05);
  color: #f43f5e;
}

.nav-tab.active {
  background: #f43f5e !important;
  color: white !important;
  border: 1px solid #f43f5e !important;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Conversation List */
.conversations-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dark);
  font-weight: 600;
  padding: 16px 20px 8px;
}

.search-box {
  padding: 8px 16px;
}
.search-box input {
  font-family: var(--font-primary);
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-input);
  color: white;
  font-size: 13px;
  outline: none;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
}

/* Individual Conversation Item */
.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.conv-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-light);
}

.avatar-container {
  position: relative;
  width: 44px;
  height: 44px;
}

.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background-color: #334155;
  border: 1.5px solid var(--border-light);
}

/* Badges for platforms (FB or Zalo) on avatars */
.platform-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  color: white;
  border: 2px solid #0f172a;
}
.platform-badge.facebook {
  background-color: var(--color-facebook);
}
.platform-badge.facebook::after {
  content: 'f';
}
.platform-badge.zalo {
  background-color: var(--color-zalo);
  font-size: 8px;
}
.platform-badge.zalo::after {
  content: 'z';
}
.platform-badge.shopee {
  background-color: var(--color-shopee);
  font-size: 8px;
}
.platform-badge.shopee::after {
  content: 's';
}

.conv-details {
  flex: 1;
  overflow: hidden;
}

.conv-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conv-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 11px;
  color: var(--text-dark);
}

.conv-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.conv-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.unread-badge {
  background: var(--grad-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.empty-state {
  text-align: center;
  color: var(--text-dark);
  font-size: 13px;
  padding: 40px 20px;
}

/* ==========================================
   CHAT WINDOW COMPONENT (2nd Column)
   ========================================== */
.chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border-light);
  background: rgba(15, 23, 42, 0.2);
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
}

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

.current-user-info h3 {
  font-size: 16px;
  font-weight: 600;
}

.user-status {
  font-size: 12px;
  color: #10b981;
}

/* Messages Stream */
.messages-stream {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Message Bubble style */
.message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.incoming {
  align-self: flex-start;
}

.message-wrapper.outgoing {
  align-self: flex-end;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
}

.incoming .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.outgoing .message-bubble {
  background: var(--grad-primary);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.message-time {
  font-size: 10px;
  color: var(--text-dark);
  margin-top: 4px;
  padding: 0 4px;
}

.incoming .message-time {
  align-self: flex-start;
}

.outgoing .message-time {
  align-self: flex-end;
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: rgba(15, 23, 42, 0.4);
}

/* Quick replies bar */
.quick-replies-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.quick-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dark);
  align-self: center;
  text-transform: uppercase;
  margin-right: 4px;
  white-space: nowrap;
}

.quick-reply-pill {
  font-family: var(--font-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.quick-reply-pill:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #818cf8;
}

#chat-form {
  display: flex;
  gap: 12px;
}

#message-input {
  flex: 1;
  font-family: var(--font-primary);
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-input);
  color: white;
  outline: none;
  font-size: 14px;
  transition: var(--transition-smooth);
}

#message-input:focus {
  border-color: #6366f1;
}

.send-btn {
  background: var(--grad-primary);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  box-shadow: var(--glow-shadow);
}

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

.send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
  transform: rotate(0deg);
  transition: var(--transition-smooth);
}

/* Chat Empty State / Dashboard welcome */
.chat-empty-state {
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
  background: rgba(15, 23, 42, 0.1);
}

.empty-illustration {
  font-size: 72px;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

.chat-empty-state h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.chat-empty-state p {
  color: var(--text-muted);
  max-width: 420px;
  margin-bottom: 24px;
  font-size: 14.5px;
  line-height: 1.6;
}

/* ==========================================
   CRM COMPONENT (3rd Column)
   ========================================== */
.crm-panel {
  background: rgba(15, 23, 42, 0.45);
  border-left: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.crm-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(15, 23, 42, 0.3);
}

.crm-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.crm-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ==========================================
   SETTINGS COMPONENT (Replaces Chat stream & CRM)
   ========================================== */
.settings-area {
  grid-column: 2 / 4;
  padding: 40px;
  overflow-y: auto;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.settings-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-header p {
  color: var(--text-muted);
  font-size: 14.5px;
}

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

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.channel-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.channel-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.channel-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
}

.fb-icon-logo {
  background-color: var(--color-facebook);
}

.zalo-icon-logo {
  background-color: var(--color-zalo);
}

.shopee-icon-logo {
  background-color: var(--color-shopee);
}

.channel-card-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.status-indicator {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.status-indicator.connected {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.status-indicator.disconnected {
  background-color: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
}

.channel-card-body {
  flex: 1;
}

.webhook-info-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
  font-size: 13px;
}

.webhook-info-box h4 {
  margin-bottom: 8px;
  color: var(--text-main);
  font-weight: 600;
}

.webhook-info-box p {
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: monospace;
  word-break: break-all;
}

.webhook-url-text, .verify-token-text {
  color: #818cf8;
}

.oauth-box {
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

.oauth-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.channel-card-footer {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

/* Tunnel Setup Guide Card */
.guide-card {
  background: rgba(244, 63, 94, 0.05);
  border: 1px solid rgba(244, 63, 94, 0.15);
  border-radius: 12px;
  padding: 24px;
}

.guide-card h3 {
  color: #f43f5e;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.guide-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.guide-steps {
  padding-left: 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-steps code {
  background: rgba(15, 23, 42, 0.8);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #e2e8f0;
}

.guide-steps pre {
  background: rgba(15, 23, 42, 0.8);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin-top: 6px;
  border: 1px solid var(--border-light);
}

.guide-steps pre code {
  background: transparent;
  padding: 0;
  color: #38bdf8;
}

.webhook-input-group {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.webhook-input-group input {
  flex: 1;
  font-family: var(--font-primary);
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background-color: var(--bg-input);
  color: white;
  font-size: 13px;
  outline: none;
}

/* ==========================================
   SCHEDULE & CALENDAR STYLES
   ========================================== */

.schedule-cell {
  background: var(--bg-card);
  border-color: var(--border-light) !important;
  color: var(--text-main);
  border-radius: 8px;
}

.schedule-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.empty-slot-cell {
  background: rgba(30, 41, 59, 0.2) !important;
  color: var(--text-dark);
}

.pending-slot-cell {
  background: rgba(245, 158, 11, 0.05) !important;
  border-left: 4px solid #f59e0b !important;
}

.success-slot-cell {
  background: rgba(16, 185, 129, 0.05) !important;
  border-left: 4px solid #10b981 !important;
}

.error-slot-cell {
  background: rgba(239, 68, 68, 0.05) !important;
  border-left: 4px solid #ef4444 !important;
}

.skipped-slot-cell {
  background: rgba(100, 116, 139, 0.1) !important;
  border-left: 4px solid #64748b !important;
  opacity: 0.6;
}

.modal-overlay {
  transition: opacity 0.3s ease;
}

.modal-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 20px;
}

@media (max-width: 992px) {
  .modal-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Notion / Google Calendar Styles */
.calendar-grid-cell:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

.calendar-grid-cell:hover .empty-cell-placeholder {
  color: #f43f5e !important;
  border-color: #f43f5e !important;
  background: rgba(244, 63, 94, 0.06) !important;
}

.schedule-board-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.12) !important;
  background: #ffffff !important;
}

.fb-preview-card {
  transition: transform 0.2s ease;
}
.fb-preview-card:hover {
  transform: scale(1.02);
}


