/* OpenClaw AI Command Center Design System */
:root {
  --bg-dark: #05070a;
  --bg-panel: #0f172a;
  --accent: #00e5ff;
  --accent-glow: rgba(0, 229, 255, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-blur: 20px;
  --sidebar-width: 280px;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(0, 229, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  color: var(--text-main);
  margin: 0;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.1);
}

.glass-sidebar {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.accent { color: var(--accent); }
.accent-bg { background: var(--accent); }
.accent-glow { box-shadow: 0 0 20px var(--accent-glow); }
.accent-border { border-color: var(--accent); }

.nav-item-active {
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.all-caps-header {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.task-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.task-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.task-card.selected {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.2);
}

.kanban-column {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.75rem;
  padding: 0.75rem;
  min-height: 200px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.priority-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.priority-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.priority-low { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }

.column-dot { width: 8px; height: 8px; border-radius: 50%; }
.inbox-dot { background: #6366f1; box-shadow: 0 0 8px rgba(99, 102, 241, 0.5); }
.progress-dot { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.done-dot { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  margin-right: 8px;
}

.status-dot-container {
  display: inline-flex;
  align-items: center;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.modal-overlay {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.scrollbar-thin::-webkit-scrollbar { width: 4px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* Tab styles */
.tab-btn { color: var(--text-main); background: transparent; transition: all 0.2s ease; font-weight: 500; border: 1px solid transparent; }
.tab-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.tab-btn.active { background: rgba(0, 229, 255, 0.1); color: var(--accent); border: 1px solid rgba(0, 229, 255, 0.2); }
.tab-content {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.tab-content.active {
  display: block;
}

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

/* Calendar styles */
.calendar-month-view .glass-card {
  min-height: 80px;
}
.calendar-list-view .glass-card {
  margin-bottom: 0.5rem;
}

/* Left Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  padding: 1.5rem 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  transition: opacity 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
}

.sidebar-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: opacity 0.3s ease;
}

.sidebar .tab-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-dim);
}

.sidebar .tab-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}

.sidebar .tab-btn.active {
  background: var(--accent);
  color: var(--bg-dark);
}

.sidebar-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 1rem 0;
}

.sidebar-actions {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Main content with sidebar */
.main-with-sidebar {
  margin-left: var(--sidebar-width);
  padding: 2rem 3rem;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* Ensure horizontal scroll never happens on mobile */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  /* Full width on mobile */
  .main-with-sidebar {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* Header row for filter/status */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1.5rem;
  background: transparent;
}

.filter-select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.task-search-input {
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 0.8rem;
  width: 260px;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='white' opacity='0.5'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.task-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: rgba(255,255,255,0.08);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.15), inset 0 0 10px rgba(0, 229, 255, 0.05);
}

.task-search-input::placeholder {
  color: #64748b;
}

.hamburger-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 60;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.5rem;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  transition: background 0.2s ease;
}

.hamburger-btn:hover {
  background: rgba(255,255,255,0.2);
}

#memorySplitView { height: 600px; overflow: hidden; }
.memory-list { width: 280px; height: 600px; border-right: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; overflow-y: auto; }
.memory-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: all 0.15s ease;
}
.memory-item:hover { background: rgba(255,255,255,0.05); }
.memory-item.active { background: rgba(0, 229, 255, 0.15); border-left: 2px solid var(--accent); }
.memory-preview { flex: 1; display: flex; flex-direction: column; height: 600px; overflow: hidden; }
.memory-preview-header {
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: transparent;
}
.memory-preview-content-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: 530px;
}
.memory-preview-content {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 1rem;
}
.memory-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255,255,255,0.4);
}

/* Mobile Menu Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 45;
  backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  .sidebar { 
    transform: translateX(-100%); 
    transition: transform 0.3s ease; 
    width: 280px !important;
    max-width: 85vw;
  }
  .sidebar.open { 
    transform: translateX(0); 
  }
  .main-with-sidebar { 
    margin-left: 0; 
    padding: 1rem;
    padding-top: 4rem; /* Space for hamburger */
  }
  .hamburger-btn { 
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .top-bar { 
    flex-wrap: wrap; 
    gap: 0.5rem;
  }
  .task-search-input { 
    width: 100% !important;
    min-width: 0;
  }
  
  /* Mobile header adjustments */
  header.px-10 {
    padding: 1rem !important;
  }
  header .flex-col {
    display: none !important;
  }
  header .flex.items-center.gap-4 {
    gap: 0.5rem !important;
  }
  header button span.text-xs {
    display: none;
  }
  header button {
    padding: 0.5rem !important;
  }
  
  /* Tab content padding on mobile */
  .tab-content.p-10, .tab-content.px-10 {
    padding: 1rem !important;
    padding-top: 0.5rem !important;
  }
  
  /* Glass card adjustments for mobile */
  .glass-card.p-6 {
    padding: 1rem !important;
  }
  
  /* KPI grid - stack on mobile */
  .glass-card .grid.grid-cols-2, 
  .glass-card .grid.grid-cols-3,
  .glass-card .grid.grid-cols-4,
  .glass-card .grid.grid-cols-5 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  
  /* KPI boxes - ensure numbers fit */
  .glass-card .p-4, 
  .glass-card [class*="rounded-lg"] {
    padding: 0.75rem !important;
  }
  .glass-card .text-2xl, 
  .glass-card .text-3xl {
    font-size: 1.25rem !important;
    word-break: break-word;
    line-height: 1.2;
  }
  .glass-card .text-[9px],
  .glass-card .text-[10px] {
    font-size: 0.65rem !important;
  }
  
  /* Status boxes - smaller on mobile */
  .flex.gap-4, 
  .flex.gap-3 {
    gap: 0.5rem !important;
  }
  .flex-1.p-4 {
    padding: 0.5rem !important;
    min-width: 0;
  }
  
  /* SLA & Revenue summary boxes */
  .flex.gap-4.mb-6 > .flex-1 {
    min-width: calc(50% - 0.25rem);
    padding: 0.5rem !important;
  }
  
  /* Activity trend bars */
  .flex.gap-2.items-end.h-20,
  .flex.gap-2.items-end.h-24 {
    height: 3rem !important;
  }
  
  /* Filter inputs */
  .filter-select {
    width: 100%;
    max-width: none;
  }
  .flex.flex-wrap.items-center.gap-3 {
    gap: 0.5rem !important;
  }
  
  /* System health bars in sidebar - smaller */
  .glass-sidebar .w-16 {
    width: 3rem !important;
  }
  
  /* Calendar grid - smaller cells */
  #calendarGrid {
    gap: 2px !important;
  }
  
  /* Tables - horizontal scroll */
  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Live feed items */
  .max-h-\[60vh\] {
    max-height: 40vh !important;
  }
  
  /* Modal adjustments */
  .modal-overlay .glass-card {
    margin: 0.5rem !important;
    padding: 1rem !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .grid.grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  /* Form inputs */
  .w-full.max-w-2xl {
    width: calc(100% - 1rem) !important;
  }
  
  /* Stats grid */
  .grid.grid-cols-1.md\:grid-cols-2.gap-6 {
    grid-template-columns: 1fr !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .glass-card .grid.grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
  
  /* Even smaller text */
  .text-3xl {
    font-size: 1.1rem !important;
  }
  .text-2xl {
    font-size: 1rem !important;
  }
  
  /* Single column for status boxes */
  .flex.gap-4.mb-6 {
    flex-wrap: wrap;
  }
  .flex.gap-4.mb-6 > .flex-1 {
    width: calc(50% - 0.25rem);
  }
  
  /* Sidebar nav items - larger touch targets */
  .sidebar .tab-btn {
    padding: 0.75rem;
  }
  
  /* Ensure numbers never overflow boxes */
  .text-2xl, .text-3xl {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  
  /* Make sure KPI boxes don't overflow */
  .glass-card .rounded-lg {
    overflow: hidden;
  }
  
  /* Better touch targets for all buttons */
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Tables scroll properly */
  table {
    min-width: 100%;
  }
  
  /* Main content doesn't overflow */
  body {
    overflow-x: hidden;
  }
  
  /* Grid gap handling */
  .gap-6 {
    gap: 1rem !important;
  }
}
