/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, CSS files are loaded individually via stylesheet_link_tag.
 */

/* Chat system styles - included inline for compatibility */

/* ===== AI CHAT SYSTEM STYLES ===== */

/* Chat toggle button */
.chat-toggle-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.chat-toggle-button:active {
  transform: translateY(0);
}

/* Chat window */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 400px;
  height: 650px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: none;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  border: 1px solid rgba(102, 126, 234, 0.1);
  backdrop-filter: blur(10px);
}

.chat-window.hidden {
  display: none;
}

.chat-window.open {
  display: flex;
}

/* Chat header */
.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.chat-header-brand span {
  font-size: 18px;
  font-weight: 600;
}

.chat-header-profile {
  font-size: 14px;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
}

.chat-close-button {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Chat tabs */
.chat-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.chat-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.chat-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: white;
}

.chat-tab:hover:not(.active) {
  color: #495057;
  background: #f1f3f4;
}

/* Chat content container */
.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.chat-tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-tab-content.active {
  display: flex;
}

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: linear-gradient(to bottom, #fafbfc 0%, #f8f9fa 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
  min-height: 0;
  max-height: 100%;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

/* Message styling */
.message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.message.user {
  justify-content: flex-end;
}

.message.user .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin-left: auto;
}

.message.ai .message-content {
  background: white;
  color: #212529;
}

/* Typing indicator */
.typing-indicator {
  display: none;
  margin: 16px 20px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.1);
  max-width: fit-content;
}

.typing-indicator.show {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeInUp 0.3s ease-out;
}

.message-avatar {
  font-size: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  flex-shrink: 0;
  color: white;
}

.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* Input area */
.chat-input-area {
  padding: 20px 24px;
  background: #fafbfc !important;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 -2px 8px rgba(102, 126, 234, 0.05);
}

.chat-input-container {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 2px solid #e9ecef;
  border-radius: 22px;
  padding: 12px 18px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 44px;
  overflow-y: auto;
  transition: all 0.2s ease;
  scrollbar-width: none;
  background: #fafbfc;
}

.chat-input::-webkit-scrollbar {
  display: none;
}

.chat-input:focus {
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15), 0 2px 8px rgba(102, 126, 234, 0.1);
}

.chat-send-button {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
}

.chat-send-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Message content */
.message-content {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 18px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid rgba(102, 126, 234, 0.1);
  word-wrap: break-word;
}

/* Coaching content */
.coaching-content {
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(to bottom, #fafbfc 0%, #f8f9fa 100%);
  flex: 1;
}

.coaching-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.coaching-actions button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.coaching-actions button:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.coaching-preview {
  margin-top: 32px;
  display: grid;
  gap: 16px;
}

.coaching-preview > div {
  background: white;
  border: 1px solid rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.coaching-preview > div:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Empty states */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: 32px 24px;
  text-align: center;
  color: #6c757d;
}

.chat-empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.chat-empty-state-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #495057;
}

.chat-empty-state-text {
  font-size: 14px;
  line-height: 1.4;
  max-width: 280px;
}

/* Responsive design */
@media (max-width: 768px) {
  .chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  
  .chat-header {
    border-radius: 0;
    padding: 16px 20px;
  }
  
  .chat-input-area {
    border-radius: 0;
    padding: 16px 20px;
  }
}

/* Global styles */
:root {
  --primary-color: #ee1d52;
  --secondary-color: #69c9d0;
  --background-color: #ffffff;
  --text-color: #333333;
  --card-bg: #ffffff;
  --border-color: #e6e6e6;
}

/* Dark mode styles */
[data-theme="dark"] {
  --primary-color: #ff2c55;
  --secondary-color: #7ad9df;
  --background-color: #121212;
  --text-color: #f5f5f5;
  --card-bg: #1e1e1e;
  --border-color: #2d2d2d;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.card {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

/* Animation for stat updates */
@keyframes highlight {
  0% { background-color: transparent; }
  50% { background-color: rgba(238, 29, 82, 0.2); }
  100% { background-color: transparent; }
}

.highlight-update {
  animation: highlight 2s ease;
}

/* Note: Chat system styles moved to chat_system.css */

/* Multi-Channel Selector Styles */
.channel-selector {
  position: relative;
  display: inline-block;
}

.channel-selector-btn {
  display: flex;
  align-items: center;
  min-width: 150px;
  justify-content: space-between;
}

.channel-selector-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  min-width: 250px;
  z-index: 1000;
}

.channel-selector-menu.show {
  display: block;
}

.channel-selector-header {
  padding: 0.5rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  background-color: #f8f9fa;
  font-size: 0.875rem;
  color: #6c757d;
}

.channel-selector-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #212529;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.2s ease;
}

.channel-selector-item:hover {
  background-color: #f8f9fa;
  color: #212529;
  text-decoration: none;
}

.channel-selector-item.active {
  background-color: #e7f3ff;
  color: #0d6efd;
  font-weight: 500;
}

.channel-selector-divider {
  height: 1px;
  background-color: #dee2e6;
  margin: 0.25rem 0;
}

/* Dark mode support for channel selector */
[data-theme="dark"] .channel-selector-menu {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .channel-selector-header {
  background-color: #2d2d2d;
  color: #adb5bd;
  border-color: var(--border-color);
}

[data-theme="dark"] .channel-selector-item {
  color: var(--text-color);
}

[data-theme="dark"] .channel-selector-item:hover {
  background-color: #2d2d2d;
  color: var(--text-color);
}

[data-theme="dark"] .channel-selector-item.active {
  background-color: #1e3a8a;
  color: #93c5fd;
}

[data-theme="dark"] .channel-selector-divider {
  background-color: var(--border-color);
}

/* Full-Screen Loading Overlay */
.dashboard-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeInOverlay 0.3s ease-out;
}

.dashboard-loading-content {
  text-align: center;
  max-width: 500px;
  padding: 2rem;
  animation: slideInUp 0.5s ease-out 0.1s both;
}

.dashboard-loading-overlay .spinner-border {
  border-width: 0.3rem;
  animation: spin 1s linear infinite;
}

.dashboard-loading-overlay .btn-outline-light {
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.dashboard-loading-overlay .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Blur effect for content behind overlay when loading is active */
[data-metrics-loader-loading-value="true"] .main-content > .row {
  filter: blur(3px);
  pointer-events: none;
  transition: filter 0.3s ease;
}

/* Animations */
@keyframes fadeInOverlay {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

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

/* Mobile optimizations for loading overlay */
@media (max-width: 768px) {
  .dashboard-loading-content {
    padding: 1.5rem;
    max-width: 90vw;
  }
  
  .dashboard-loading-content h3 {
    font-size: 1.5rem;
  }
  
  .dashboard-loading-content p {
    font-size: 0.9rem;
  }
  
  .dashboard-loading-overlay .btn-outline-light {
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
  }
}
