:root {
  --bg-color: #0f0f0f;
  --panel-bg: #1a1a1a;
  --header-bg: #242424;
  --border-color: #333333;
  --gold: #d4af37;
  --gold-hover: #f1c40f;
  --text-main: #e0e0e0;
  --text-dim: #a0a0a0;
  --accent-blue: #3498db;
  --msg-human-bg: #2c3e50;
  --msg-ai-bg: #34495e;
  --badge-bg: #d4af37;
  --badge-text: #0f0f0f;
  --selection-bg: rgba(212, 175, 55, 0.1);
  --sidebar-width: 320px;
  --right-panel-width: 350px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

h1,
h2,
h3,
.logo {
  font-family: 'Outfit', sans-serif;
}

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

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top Bar */
.top-bar {
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  height: auto;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  gap: 16px;
  align-items: flex-start;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.filters {
  display: flex;
  gap: 20px;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select,
input {
  background: var(--header-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

select:focus,
input:focus {
  border-color: var(--gold);
}

/* Layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.side-panel {
  display: flex;
  flex-direction: column;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--border-color);
}

.left-panel {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
}

.right-panel {
  width: var(--right-panel-width);
  min-width: var(--right-panel-width);
  border-right: none;
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

.conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  position: relative;
}

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

.panel-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge {
  background-color: var(--gold);
  color: #000;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

/* Scrollbar Styling */
.scroll-container::-webkit-scrollbar {
  width: 6px;
}

.scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Lead List Items */
.lead-item {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}

.lead-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.lead-item.active {
  background-color: var(--selection-bg);
  border-left: 3px solid var(--gold);
}

.lead-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.lead-name {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.lead-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-tag {
  color: var(--gold);
  font-size: 0.7rem;
  border: 1px solid var(--gold);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 700;
}

/* Conversation View */
#conversation-view {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-node {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}

.message-node.Human {
  align-self: flex-end;
}

.message-node.AI {
  align-self: flex-start;
}

.message-node.System,
.message-node.Admin {
  align-self: center;
  max-width: 100%;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}

.Human .message-bubble {
  background-color: var(--msg-human-bg);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.AI .message-bubble {
  background-color: var(--msg-ai-bg);
  border-bottom-left-radius: 4px;
  color: #fff;
  border-left: 2px solid var(--gold);
}

.System .message-bubble,
.Admin .message-bubble {
  background-color: transparent;
  border: 1px dashed var(--text-dim);
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

.message-info {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  gap: 8px;
}

.Human .message-info {
  justify-content: flex-end;
}

/* Lead Card Details */
.lead-card-details {
  padding: 24px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 0.8rem;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.detail-row {
  margin-bottom: 12px;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-all;
}

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

.empty-state,
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.badge-source {
  font-size: 0.7rem;
  background: var(--header-bg);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
}
/* Responsiveness */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 280px;
    --right-panel-width: 300px;
  }
}

@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column;
    overflow-y: auto;
  }
  
  .side-panel, .conversation-panel {
    width: 100%;
    min-width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .conversation-panel {
    min-height: 500px;
  }
  
  .side-panel {
    max-height: 400px;
  }
  
  #app {
    overflow-y: auto;
    height: auto;
  }
  
  body {
    overflow-y: auto;
    height: auto;
  }
}

@media (max-width: 768px) {
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .search-box input {
    width: 100%;
  }
}
