/* ==========================================================================
   HB TALK - DASHBOARD, CHAT, CALLS & PARTNERS STYLES (dashboard.css)
   ========================================================================== */

/* App Shell Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-body);
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-body);
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.sidebar-link span {
  white-space: nowrap;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-link:hover {
  background-color: var(--bg-subtle);
  color: var(--primary);
}

.sidebar-link:hover svg {
  color: var(--primary);
}

.sidebar-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active svg {
  color: var(--primary);
}

.sidebar-badge {
  margin-left: auto;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

/* Sidebar Quota Widget */
.sidebar-quota-box {
  margin: 14px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-md);
}

.quota-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-full);
}

.quota-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* App Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Topbar */
.app-topbar {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 80;
}

.topbar-search {
  position: relative;
  width: 340px;
}

.topbar-search input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-main);
  transition: var(--transition);
}

.topbar-search input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  width: 18px;
  height: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* User Menu Dropdown */
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.user-menu-trigger:hover {
  background: var(--bg-subtle);
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.user-level {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Page Container */
.dashboard-content {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Welcome Banner */
.welcome-hero {
  background: linear-gradient(135deg, #4338ca 0%, #312e81 100%);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.welcome-hero::after {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-hero h1 {
  color: #ffffff;
  font-size: 1.85rem;
  margin-bottom: 8px;
}

.welcome-hero p {
  color: #c7d2fe;
  font-size: 1rem;
  max-width: 520px;
}

.welcome-actions {
  display: flex;
  gap: 12px;
  z-index: 2;
}

/* Dashboard Quick Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-info span {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Dashboard Layout 2-Column: Left 2/3, Right 1/3 */
.dashboard-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.dashboard-section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Partner Card Component (Used in Dashboard & Find Partners) */
.partner-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.partner-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-glow);
  box-shadow: var(--shadow-md);
}

.partner-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.partner-avatar-wrapper {
  position: relative;
}

.partner-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.partner-avatar-wrapper .status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
}

.partner-meta h4 {
  font-size: 1.05rem;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.partner-country {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.partner-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.partner-bio {
  font-size: 0.875rem;
  color: var(--text-body);
  margin-bottom: 16px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.partner-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.topic-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 500;
}

.partner-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   Find Partners Page Grid & Filters
   ========================================================================== */
.partners-filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.filter-select {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-main);
  cursor: pointer;
}

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

/* ==========================================================================
   3-Column Chat System (chat.html)
   ========================================================================== */
.chat-wrapper {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  background: var(--bg-surface);
}

/* Left Conversations List */
.chat-sidebar {
  width: 320px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
}

.chat-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-sidebar-header h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.chat-thread-list {
  flex: 1;
  overflow-y: auto;
}

.chat-thread-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}

.chat-thread-item:hover {
  background: var(--bg-subtle);
}

.chat-thread-item.active {
  background: var(--primary-light);
}

.chat-thread-info {
  flex: 1;
  min-width: 0;
}

.chat-thread-info-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.chat-thread-info-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-thread-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-thread-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.chat-thread-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Unread message state styling */
.chat-thread-item.has-unread {
  background: rgba(79, 70, 229, 0.04);
}

[data-theme="dark"] .chat-thread-item.has-unread,
body.dark .chat-thread-item.has-unread {
  background: rgba(99, 102, 241, 0.08);
}

.chat-thread-item.has-unread .chat-thread-name {
  font-weight: 700;
  color: var(--text-main);
}

.chat-thread-item.has-unread .chat-thread-time {
  color: var(--primary);
  font-weight: 700;
}

.chat-thread-item.has-unread .chat-thread-snippet {
  color: var(--text-main);
  font-weight: 600;
}

.unread-badge {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  flex-shrink: 0;
}

.unread-total-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(79, 70, 229, 0.2);
  white-space: nowrap;
}

/* Center Active Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  position: relative;
}

.chat-header {
  padding: 14px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg-row {
  display: flex;
  gap: 10px;
  max-width: 70%;
}

.chat-msg-row.incoming {
  align-self: flex-start;
}

.chat-msg-row.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.5;
  position: relative;
}

.chat-msg-row.incoming .chat-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.chat-msg-row.outgoing .chat-bubble {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 0.7rem;
  margin-top: 4px;
  display: block;
}

.chat-msg-row.incoming .chat-msg-time { color: var(--text-subtle); }
.chat-msg-row.outgoing .chat-msg-time { color: rgba(255, 255, 255, 0.75); text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  width: fit-content;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dot-pulse {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1s infinite alternate;
}

.dot-pulse:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 1; }
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input-field {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  color: var(--text-main);
}

.chat-input-field:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
}

/* Right Chat Details Panel (Spacious Profile Area) */
.chat-details-panel {
  width: 360px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 24px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Full Screen Call Interface (calls.html)
   ========================================================================== */
.call-fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: #090d16;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.call-top-bar {
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 10;
}

.call-timer-badge {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-timer-badge .rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1s infinite alternate;
}

.call-stage-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Audio Call Stage */
.audio-call-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
}

.audio-pulse-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 0 0 15px rgba(79, 70, 229, 0.1), 0 0 0 30px rgba(79, 70, 229, 0.05);
  animation: wavePulse 2.5s infinite ease-out;
}

@keyframes wavePulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4), 0 0 0 0 rgba(79, 70, 229, 0.2); }
  100% { box-shadow: 0 0 0 30px rgba(79, 70, 229, 0), 0 0 0 60px rgba(79, 70, 229, 0); }
}

.audio-pulse-ring img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid #6366f1;
}

/* Video Call Stage */
.video-remote-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-local-pip {
  position: absolute;
  bottom: 24px;
  right: 28px;
  width: 200px;
  height: 140px;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: #1e293b;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.video-local-pip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Call Control Deck */
.call-controls-bar {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  z-index: 10;
}

.call-action-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.25rem;
}

.call-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.call-action-btn.active-off {
  background: #ef4444;
  color: #ffffff;
}

.call-action-btn.end-call {
  background: #ef4444;
  width: 60px;
  height: 60px;
}

.call-action-btn.end-call:hover {
  background: #dc2626;
  transform: scale(1.08);
}
