@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #08090e;
  --bg-secondary: #111420;
  --bg-tertiary: #1a1e30;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  /* Accent Colors */
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.15);
  --accent-blue: #06b6d4;
  --accent-blue-glow: rgba(6, 182, 212, 0.15);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.15);
  --accent-orange: #f59e0b;
  --accent-orange-glow: rgba(245, 158, 11, 0.15);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 70px;
  --glass-blur: blur(16px);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(244, 63, 94, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* App Layout Container */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: rgba(17, 20, 32, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  z-index: 10;
  transition: all 0.3s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2.5rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
  color: white;
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: inset 0 0 12px rgba(139, 92, 246, 0.05);
}

.nav-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.nav-link:hover i {
  transform: translateX(2px);
}

/* Sidebar Footer / API Indicator */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.api-status-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.api-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background-color: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose-glow);
}

.status-dot.connected {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green-glow);
}

/* Main Area Layout */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
.header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  background: rgba(8, 9, 14, 0.3);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  z-index: 9;
}

.header-title-sec h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

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

/* Content Frame */
.content-body {
  flex-grow: 1;
  padding: 2.5rem;
  overflow-y: auto;
  position: relative;
}

/* Glass Card */
.glass-card {
  background: rgba(22, 25, 37, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  border-color: var(--border-hover);
}

/* Grid helper */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Typography & Subheadings */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* File Dropzone */
.dropzone-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 250px;
}

.dropzone-container:hover, .dropzone-container.dragover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.03);
}

.dropzone-icon {
  background: rgba(255, 255, 255, 0.03);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-color);
  color: var(--accent-purple);
  transition: all 0.3s ease;
}

.dropzone-container:hover .dropzone-icon {
  transform: scale(1.1);
  background: rgba(139, 92, 246, 0.1);
}

.dropzone-text {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.dropzone-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-hover);
}

.btn-accent {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.25);
  color: var(--accent-blue);
}

.btn-accent:hover {
  background: rgba(6, 182, 212, 0.18);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.18);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Stat Cards */
.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.stat-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.stat-icon.blue {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.stat-icon.orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Table Container & Table */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(10, 11, 16, 0.2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(26, 30, 48, 0.4);
  padding: 14px 18px;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-main);
}

.data-table tr.highlight-anomaly {
  background: rgba(244, 63, 94, 0.05);
}
.data-table tr.highlight-anomaly td {
  color: #fda4af;
  border-bottom-color: rgba(244, 63, 94, 0.15);
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Inputs & Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: white;
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-purple);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.select-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 40px;
}

/* AI Chat Room */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 600px;
}

.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(10, 11, 16, 0.25);
  margin-bottom: 1.25rem;
}

.chat-bubble {
  display: flex;
  gap: 12px;
  max-width: 80%;
  animation: fadeIn 0.3s ease;
}

.chat-bubble.assistant {
  align-self: flex-start;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-bubble.assistant .chat-avatar {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.chat-bubble.user .chat-avatar {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.chat-content {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
}

.chat-bubble.user .chat-content {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.15);
}

.chat-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.85rem;
}

.chat-content pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 10px 0;
}

.chat-content pre code {
  background: none;
  padding: 0;
}

.chat-content p {
  margin-bottom: 8px;
}
.chat-content p:last-child {
  margin-bottom: 0;
}

.chat-input-bar {
  display: flex;
  gap: 10px;
}

.chat-input-bar input {
  flex-grow: 1;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-blue { background: rgba(6, 182, 212, 0.1); color: var(--accent-blue); border: 1px solid rgba(6, 182, 212, 0.2); }
.badge-green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-orange { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-rose { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.2); }

/* Dynamic Layout Swapper */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

/* Alerts */
.alert-box {
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  font-size: 0.95rem;
  line-height: 1.4;
}

.alert-box.info {
  background: rgba(6, 182, 212, 0.05);
  border-color: rgba(6, 182, 212, 0.15);
  color: #cffafe;
}

.alert-box.warning {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.15);
  color: #fef3c7;
}

.alert-box.error {
  background: rgba(244, 63, 94, 0.05);
  border-color: rgba(244, 63, 94, 0.15);
  color: #ffe4e6;
}

.alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

/* Loader */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Chart Canvas container */
.chart-container-el {
  position: relative;
  height: 350px;
  width: 100%;
  background: rgba(10, 11, 16, 0.15);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.clean-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.clean-tool-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.clean-tool-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-hover);
}

.clean-tool-card h4 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clean-tool-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-grow: 1;
}

/* Forecast controls */
.forecast-setup {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

/* Tabs inside dashboard */
.tab-container {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 1px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 9, 14, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  border-radius: var(--radius-lg);
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

/* Windows 11 Centered Bottom Dock / Taskbar Design Override */
.app-container {
  flex-direction: column !important;
  height: 100vh !important;
  width: 100vw !important;
  overflow: hidden !important;
}

.sidebar {
  position: fixed !important;
  bottom: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: auto !important;
  max-width: 95% !important;
  height: 60px !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 18px !important;
  padding: 8px 16px !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(17, 20, 32, 0.7) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  z-index: 1000 !important;
  margin-bottom: 0 !important;
}

.logo-container, .sidebar-footer {
  display: none !important;
}

.nav-menu {
  flex-direction: row !important;
  gap: 12px !important;
  margin: 0 !important;
  align-items: center !important;
  display: flex !important;
}

.nav-item {
  width: auto !important;
}

.nav-link {
  padding: 8px 16px !important;
  font-size: 0.9rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.nav-link i {
  font-size: 1.15rem !important;
}

.main-wrapper {
  width: 100% !important;
  height: 100vh !important;
}

.content-body {
  padding: 1.5rem 1.5rem 100px 1.5rem !important; /* Save space for dock navigation */
}

/* Responsive adjustment: hide texts on mobile */
@media (max-width: 768px) {
  .sidebar {
    height: 52px !important;
    padding: 6px 12px !important;
    bottom: 12px !important;
  }
  .nav-link span {
    display: none !important;
  }
  .nav-link {
    padding: 8px !important;
  }
  .nav-menu {
    gap: 8px !important;
  }
}
