/* --- Design System & CSS Tokens --- */
:root {
  --primary: hsl(217, 100%, 45%);
  --primary-hover: hsl(217, 100%, 35%);
  --bg-login: linear-gradient(135deg, hsl(220, 60%, 10%), hsl(220, 40%, 20%));
  --bg-app: hsl(210, 20%, 98%);
  
  --card-bg: rgba(255, 255, 255, 0.9);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  
  --text-main: hsl(220, 25%, 20%);
  --text-muted: hsl(220, 15%, 50%);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

/* --- Layout Shell --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  margin: 0 auto;
  position: relative;
  background: white;
  transition: all 0.3s ease;
}

/* On Mobile/Small screens, keep it centered and constrained if desired, 
   but for a truly responsive app, we'll let it fill the screen and use 
   an inner wrapper for content constraints. */
@media (max-width: 1023px) {
  .app-container {
    max-width: 480px;
  }
}

.main-layout {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background: var(--bg-app);
}

/* --- Navigation --- */
.sidebar {
  width: 280px;
  background: hsl(220, 60%, 10%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 1200;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.sidebar-item i {
  width: 20px;
  height: 20px;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.sidebar-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.bottom-nav {
  display: none !important; /* Force hide bottom nav on all screens now that we use burger */
}

.app-footer {
  flex-shrink: 0;
  background: white;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.05);
  z-index: 1100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon { width: 24px; height: 24px; }

/* Desktop visibility logic */
@media (min-width: 1024px) {
  .burger-menu-btn { display: none !important; }
  .kanban-header { border-bottom: 1px solid rgba(0,0,0,0.05); padding: 24px 40px !important; }
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .kanban-header { padding: 16px 20px; }
}

/* --- Burger & Mobile Drawer --- */
.burger-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.burger-menu-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: hsl(220, 60%, 10%);
  z-index: 3000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
}

.mobile-nav-drawer.open {
  transform: translateX(280px);
}

.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  transition: all 0.2s;
}

.drawer-item i { width: 20px; height: 20px; }

.drawer-item:hover, .drawer-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.drawer-item.active {
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* --- Login Screen --- */
.login-screen {
  background: var(--bg-login);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: white;
}

.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  background: white;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  display: inline-block;
}

.login-card {
  background: white;
  width: 100%;
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid hsl(210, 20%, 90%);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: hsl(210, 20%, 98%);
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-primary:active { transform: scale(0.98); }

.action-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* --- Kanban Board --- */
.kanban-header {
  padding: 20px;
  background: white;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-container {
  display: flex;
  overflow-x: auto;
  gap: 24px;
  padding: 24px;
  height: calc(100vh - 180px);
  scroll-snap-type: x mandatory;
}

@media (min-width: 1024px) {
  .kanban-container {
      padding: 40px;
      gap: 32px;
  }
}

.kanban-column {
  min-width: 300px;
  max-width: 300px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.column-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.column-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f0f0f0;
}

.task-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f0f4ff;
  color: var(--primary);
  display: inline-block;
  margin-bottom: 8px;
}

/* --- Chat Interface --- */
.chat-wrapper {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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


.message {
  width: fit-content;
  max-width: 90%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
}


.message p {
  margin: 0;
}

.message.ai {
  align-self: flex-start;
  background: #f0f2f5;
  border-bottom-left-radius: 4px;
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  padding: 16px 24px 24px 24px;
  background: white;
  border-top: 1px solid #eee;
}

@media (min-width: 1024px) {
    .chat-input-area {
        background: transparent;
        border-top: none;
    }
    .chat-input-container {
        background: white;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        border: 1px solid #eee;
        padding: 8px;
    }
}

.suggestion-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 0 24px 8px 24px;
  scrollbar-width: none;
}

.suggestion-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  white-space: nowrap;
  background: white;
  border: 1px solid #eee;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-chip {
  background: hsl(217, 100%, 97%);
  border-color: hsl(217, 100%, 90%);
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-chip i {
    opacity: 0.8;
}

.file-chip .remove-file {
    margin-left: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.file-chip .remove-file:hover {
    opacity: 1;
}

/* --- Mention Dropdown --- */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 12px;
  right: 12px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
  border: 1px solid #eee;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  margin-bottom: 8px;
  animation: slideUp 0.2s ease-out;
}

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

.mention-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f8f9fa;
  transition: background 0.2s;
}

.mention-item:last-child {
  border-bottom: none;
}

.mention-item:hover, .mention-item.active {
  background: #f0f7ff;
}

.mention-item .agent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.mention-item i {
  color: var(--primary);
  opacity: 0.7;
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #f0f2f5;
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  width: fit-content;
  margin-bottom: 12px;
  margin-left: 12px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

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

@keyframes typingAnimation {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Active Agent Indicator --- */
.active-agents-list {
  display: flex;
  gap: 8px;
  align-items: center;
}

.active-agent-signal {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(37, 99, 235, 0.15);
  animation: signalEntry 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.signal-dot {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: signalPulse 2s infinite;
}

@keyframes signalPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

@keyframes signalEntry {
  from { opacity: 0; transform: scale(0.8) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
/* --- File Cards (Inline & Media) --- */
.file-card-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  animation: cardEntry 0.3s ease-out;
}

.file-card-icon {
  background: rgba(37, 99, 235, 0.08);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-card-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.file-card-btn-icon {
  background: #f1f3f5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark) !important;
  text-decoration: none !important;
  transition: background 0.2s;
}

.file-card-btn-icon:hover {
  background: #e9ecef;
}

.file-card-btn-action {
  background: var(--primary);
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  color: white !important;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.file-card-btn-action:active {
  transform: scale(0.95);
}

.chat-img {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 10px;
  display: block;
  cursor: zoom-in;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.chat-img:hover {
  transform: translateY(-2px);
}

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