/* assets/css/situational-center.css */

:root {
  --primary-color: #2563eb;
  --bg-dark: #111827;
  --bg-card: #1f2937;
  --text-light: #f3f4f6;
  --text-gray: #9ca3af;
  --border-color: #374151;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --sidebar-width: 280px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
  height: 100vh;
  margin: 0;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  /* Ensure header stays solid */
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.app-title {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.75rem;
  color: var(--text-gray);
  font-weight: 400;
}

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

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-title {
  padding: 0 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  cursor: pointer;
}

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

.nav-item.active {
  background-color: rgba(37, 99, 235, 0.1);
  border-left-color: var(--primary-color);
  color: #60a5fa;
}

.submenu {
  display: none;
  background-color: #111827;
  /* Darker than sidebar */
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.submenu.open {
  display: block;
}

.submenu-item {
  display: block;
  padding: 0.6rem 1.5rem 0.6rem 3.5rem;
  /* Increased left padding */
  font-size: 0.9rem;
  color: var(--text-gray);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.submenu-item:hover {
  color: var(--text-light);
  background-color: rgba(255, 255, 255, 0.05);
}

.submenu-item.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: 500;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-gray);
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background-color: #0f1115;
  /* Slightly darker than bg-card */
}

.content-header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(31, 41, 55, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border-color);
}

.page-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(to right, #fff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.right-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.content-body {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* Cards & Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: #4b5563;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-gray);
}

.card-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-trend {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.trend-up {
  color: #34d399;
  /* Green */
}

.trend-down {
  color: #f87171;
  /* Red */
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Specific Section Styles */
.map-container {
  height: 500px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Utility */
.col-span-12 {
  grid-column: span 12 / span 12;
}

.col-span-8 {
  grid-column: span 8 / span 12;
}

.col-span-6 {
  grid-column: span 6 / span 12;
}

.col-span-4 {
  grid-column: span 4 / span 12;
}

.col-span-3 {
  grid-column: span 3 / span 12;
}

@media (max-width: 1024px) {

  .col-span-8,
  .col-span-6,
  .col-span-4,
  .col-span-3 {
    grid-column: span 12 / span 12;
  }
}

/* AI Assistant Styles (Sidebar Mode) */
.ai-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.7);
}

.ai-fab-icon {
  font-size: 1.5rem;
  color: white;
  z-index: 2;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-3px);
  }

  100% {
    transform: translateY(0px);
  }
}

.ai-fab-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  opacity: 0.6;
  z-index: 1;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Sidebar Panel Implementation */
.ai-panel {
  width: 0;
  /* Initial width 0 */
  background: #111827;
  /* Solid background for layout shift */
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  height: 100vh;
  position: relative;
  /* Make sure it sits in flow */
}

.ai-panel.open {
  width: 600px;
  /* Expanded width */
}

.ai-header {
  padding: 1.25rem;
  background: linear-gradient(to right, rgba(59, 130, 246, 0.1), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  /* Prevent text wrap during transition */
  min-width: 400px;
  /* Force inner content width to stay stable */
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6, #9333ea);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
}

.ai-close-btn {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.ai-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scrollbar-width: thin;
  min-width: 400px;
  /* Prevent reflow during open/close */
}

.chat-message {
  max-width: 90%;
  /* Slightly wider in sidebar */
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
  align-items: flex-end;
}

.message-content {
  padding: 1rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
}

.ai-message .message-content {
  background: #1f2937;
  color: #f3f4f6;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-message .message-content {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.4rem;
  padding: 0 0.25rem;
}

.ai-suggestions {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(31, 41, 55, 0.3);
  min-width: 400px;
}

.suggestion-chip {
  background: rgba(55, 65, 81, 0.6);
  border: 1px solid rgba(75, 85, 99, 0.5);
  padding: 0.6rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: white;
  transform: translateY(-1px);
}

.ai-input-area {
  padding: 1rem;
  background: rgba(17, 24, 39, 0.9);
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 400px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 0.5rem;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 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;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}