@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@600;700&family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

:root {
  /* Core Paatheya Accents */
  --primary-blue: #02379B;
  --primary-blue-hover: #011F6B;
  --secondary-orange: #EE7533;
  --secondary-orange-hover: #D4611E;
  --electric-cyan: #0FBBDB;
  
  /* Typography */
  --font-headings: 'Comfortaa', sans-serif;
  --font-ui: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition-speed: 150ms;
  --transition-bezier: ease-out;
}

/* Dark Mode */
.dark-theme {
  --bg-app: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.6);
  --glass-glow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --primary-blue: #4F8EF7;
  --primary-blue-hover: #3B7EF0;
  --bg-subtle: #334155;
  --bg-subtle-hover: #475569;
}

/* Light Mode */
.light-theme {
  --bg-app: #F0F4FA;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFF;
  --text-main: #0B132B;
  --text-muted: #6B7280;
  --border-color: #E2E8F0;
  --border-focus: #93C5FD;
  --glass-glow: 0 1px 3px rgba(0, 0, 0, 0.05);
  --primary-blue: #02379B;
  --primary-blue-hover: #011F6B;
  --bg-subtle: #F1F5FB;
  --bg-subtle-hover: #E8EEF8;
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6, .sidebar-header span {
  font-family: var(--font-headings);
}

.sidebar-nav-item,
.crm-btn,
.crm-input,
.crm-table th,
.crm-header-actions span,
.theme-toggle,
.form-label,
select,
option {
  font-family: var(--font-ui);
}

body {
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  font-size: 13px;
  transition: background var(--transition-speed) var(--transition-bezier), color var(--transition-speed);
}

/* CRM Layout */
.crm-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

.crm-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
  height: 24px;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-speed);
  margin-bottom: 0.25rem;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 13px;
}

.sidebar-nav-item:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-main);
}

.sidebar-nav-item.active {
  background: var(--primary-blue);
  color: #fff;
}

.crm-main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

.crm-header {
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: var(--bg-app);
  flex-shrink: 0;
}

.crm-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.crm-header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.crm-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.crm-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--glass-glow);
  margin-bottom: 1.5rem;
}

/* Typography */
h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.text-muted {
  color: var(--text-muted);
}

/* Forms & Inputs */
.crm-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  transition: border-color var(--transition-speed);
}
.crm-input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}


/* Buttons */
.crm-btn {
  background: var(--primary-blue);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  transition: opacity var(--transition-speed);
}
.crm-btn:hover {
  opacity: 0.9;
}
.crm-btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.crm-btn-secondary:hover {
  background: var(--bg-subtle-hover);
  opacity: 1;
}

/* Tables */
.crm-table {
  width: 100%;
  border-collapse: collapse;
}
.crm-table th {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 500;
}
.crm-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

/* Dashboard specific classes */
.db-panel { display: none; }
.db-panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-msg {
  max-width: 75%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  line-height: 1.4;
}
.chat-msg.client {
  background: var(--primary-blue);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 0;
}
.chat-msg.agent {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  border-bottom-left-radius: 0;
}
.chat-input-area {
  display: flex;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-app);
}
.login-box {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--glass-glow);
}

/* ================================================================
   CUSTOM TOOLTIP STYLES
   ================================================================ */
.paatheya-tooltip {
  position: absolute;
  pointer-events: none;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-ui, sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 150ms ease-in-out, transform 150ms ease-in-out;
  z-index: 99999;
}
.paatheya-tooltip.visible {
  opacity: 1;
  transform: scale(1);
}

