/* ==========================================================================
   Command Center - Custom Styles
   Aanvulling op Tailwind CSS
   ========================================================================== */

/* ---------- Root Variables ---------- */
:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #4338CA;
  --sidebar-w: 260px;
  --topbar-h: 56px;
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.sidebar-link:hover {
  background: #f1f5f9;
  color: #334155;
}

.dark .sidebar-link {
  color: #94a3b8;
}

.dark .sidebar-link:hover {
  background: #1e293b;
  color: #e2e8f0;
}

.sidebar-link.active {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

.dark .sidebar-link.active {
  background: rgba(79, 70, 229, 0.15);
  color: #a5b4fc;
}

.sidebar-link .badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: #ef4444;
  color: #fff;
  line-height: 1;
}

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
}

/* ---------- Content area ---------- */
.content-scroll {
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---------- Area cards ---------- */
.area-card {
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  cursor: pointer;
}

.area-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-light);
}

.dark .area-card {
  background: #1e293b;
  border-color: #334155;
}

.dark .area-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ---------- Focus Today cards ---------- */
.focus-card {
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  transition: all 0.2s ease;
  position: relative;
}

.focus-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.625rem;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.03), transparent);
  pointer-events: none;
}

.focus-card:hover {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2), 0 4px 12px rgba(0, 0, 0, 0.06);
}

.dark .focus-card {
  background: #1e293b;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ---------- Overdue markering ---------- */
.overdue-item {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}

.dark .overdue-item {
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Priority badges ---------- */
.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.priority-urgent {
  background: #fef2f2;
  color: #dc2626;
}
.priority-high {
  background: #fff7ed;
  color: #ea580c;
}
.priority-medium {
  background: #eff6ff;
  color: #2563eb;
}
.priority-low {
  background: #f0fdf4;
  color: #16a34a;
}

.dark .priority-urgent { background: rgba(220, 38, 38, 0.15); }
.dark .priority-high { background: rgba(234, 88, 12, 0.15); }
.dark .priority-medium { background: rgba(37, 99, 235, 0.15); }
.dark .priority-low { background: rgba(22, 163, 74, 0.15); }

/* ---------- Energy indicators ---------- */
.energy-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
}

.energy-high { background: #ef4444; }
.energy-medium { background: #f59e0b; }
.energy-low { background: #22c55e; }

/* ---------- Type badges ---------- */
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.15s ease;
}

.modal-content {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-height: 85vh;
  overflow-y: auto;
  width: 100%;
  max-width: 32rem;
  animation: slideUp 0.2s ease;
}

.dark .modal-content {
  background: #1e293b;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ---------- Status dots ---------- */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-inbox { background: #94a3b8; }
.status-next { background: #3b82f6; }
.status-waiting { background: #f59e0b; }
.status-scheduled { background: #8b5cf6; }
.status-someday { background: #6b7280; }
.status-done { background: #22c55e; }

/* ---------- Timeline ---------- */
.timeline-line {
  position: absolute;
  left: 1.25rem;
  top: 2.5rem;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.dark .timeline-line {
  background: #334155;
}

.timeline-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
  z-index: 1;
}

.dark .timeline-dot {
  border-color: #0f172a;
}

.tl-email { background: #3b82f6; }
.tl-taak { background: #22c55e; }
.tl-beslissing { background: #8b5cf6; }
.tl-meeting { background: #f59e0b; }
.tl-commitment { background: #ef4444; }
.tl-document { background: #6b7280; }
.tl-telefoongesprek { background: #06b6d4; }
.tl-notitie { background: #a3a3a3; }
.tl-mijlpaal { background: #eab308; }

/* ---------- Checkbox custom ---------- */
.cc-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.cc-checkbox:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.cc-checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---------- Star / Pin ---------- */
.star-btn {
  color: #cbd5e1;
  cursor: pointer;
  transition: color 0.15s ease;
}

.star-btn:hover {
  color: #f59e0b;
}

.star-btn.active {
  color: #f59e0b;
}

/* ---------- Filter bar ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

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

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.dark .filter-chip {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark .filter-chip.active {
  background: var(--primary);
  color: #fff;
}

/* ---------- Table ---------- */
.cc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.cc-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.dark .cc-table th {
  color: #94a3b8;
  border-color: #334155;
}

.cc-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

.dark .cc-table td {
  border-color: #1e293b;
}

.cc-table tr:hover td {
  background: #f8fafc;
}

.dark .cc-table tr:hover td {
  background: rgba(30, 41, 59, 0.5);
}

/* ---------- Empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #94a3b8;
  text-align: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* ---------- Mobile sidebar toggle ---------- */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 30;
  animation: fadeIn 0.2s ease;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    opacity: 0;
    background: #fff;
  }

  .dark .sidebar {
    background: #0f172a;
  }

  .sidebar.open {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (min-width: 769px) {
  .hamburger-btn {
    display: none !important;
  }
}

/* ---------- Transitions ---------- */
.fade-enter {
  animation: fadeIn 0.2s ease;
}

.slide-enter {
  animation: slideUp 0.2s ease;
}

/* ---------- Notification toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  background: #1e293b;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 100;
  animation: slideUp 0.2s ease, fadeOut 0.3s ease 2.5s forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ---------- Print ---------- */
@media print {
  .sidebar,
  .topbar,
  .hamburger-btn,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .content-scroll {
    height: auto;
    overflow: visible;
  }

  body {
    overflow: visible;
  }

  .area-card,
  .focus-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ---------- Misc ---------- */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.action-row {
  transition: background 0.1s ease;
}

.action-row:hover {
  background: #f8fafc;
}

.dark .action-row:hover {
  background: rgba(30, 41, 59, 0.5);
}

/* ---------- Quick capture glow ---------- */
.quick-capture:focus-within {
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

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

/* ---------- Overlay ---------- */
.ai-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: fadeIn 0.15s ease;
  padding: 1rem;
}

/* ---------- Panel ---------- */
.ai-chat-panel {
  width: 100%;
  max-width: 40rem;
  height: min(85vh, 700px);
  background: #0f172a;
  border-radius: 1rem;
  border: 1px solid #1e293b;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

/* ---------- Header ---------- */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #1e293b;
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  flex-shrink: 0;
}

.ai-chat-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* ---------- Context banner ---------- */
.ai-context-banner {
  padding: 0.5rem 1.25rem;
  background: rgba(79, 70, 229, 0.1);
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

/* ---------- Messages area ---------- */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

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

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

/* ---------- Message rows ---------- */
.ai-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

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

.ai-msg-ai {
  align-self: flex-start;
  align-items: flex-start;
}

/* ---------- Bubbles ---------- */
.ai-bubble {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-bubble-user {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.ai-bubble-ai {
  background: #1e293b;
  color: #e2e8f0;
  border-bottom-left-radius: 0.25rem;
  border: 1px solid #334155;
}

.ai-bubble-confirmed {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #e2e8f0;
  border-radius: 1rem;
  padding: 1rem;
}

/* ---------- Proposal items ---------- */
.ai-proposal-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: 0.625rem;
  padding: 0.75rem;
}

.ai-type-icon {
  font-size: 1rem;
}

.ai-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ---------- Action buttons ---------- */
.ai-btn-confirm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.ai-btn-adjust {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.5rem;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-btn-adjust:hover {
  background: #334155;
  color: #e2e8f0;
}

/* ---------- Input area ---------- */
.ai-chat-input {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid #1e293b;
  background: #0f172a;
  flex-shrink: 0;
}

.ai-input-field {
  flex: 1;
  min-height: 2.5rem;
  max-height: 7.5rem;
  padding: 0.625rem 0.875rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  outline: none;
  resize: none;
  width: 100%;
  line-height: 1.5;
  transition: border-color 0.15s ease;
}

.ai-input-field:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ai-input-field::placeholder {
  color: #475569;
}

.ai-input-field:disabled {
  opacity: 0.5;
}

.ai-send-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.ai-send-btn:disabled {
  cursor: not-allowed;
}

/* ---------- Typing indicator ---------- */
.ai-typing {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem 0;
  align-items: center;
}

.ai-typing span {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #64748b;
  animation: ai-typing-bounce 1.4s ease-in-out infinite both;
}

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

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

/* ---------- Mobile responsive ---------- */
@media (max-width: 640px) {
  .ai-chat-overlay {
    padding: 0;
  }

  .ai-chat-panel {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .ai-msg-row {
    max-width: 92%;
  }
}

/* ---------- Loading spinner ---------- */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Completed checkbox */
.cc-checkbox.checked {
  background: #10B981;
  border-color: #10B981;
}
.cc-checkbox.checked svg {
  opacity: 1 !important;
}
