/* Markeer - Stijlen */

:root {
  --color-sidebar: #1a1a2e;
  --color-sidebar-hover: #16213e;
  --color-accent: #4a9eff;
  --color-accent-hover: #3a8eef;
  --color-accent-dim: rgba(74, 158, 255, 0.12);
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-border: #e8eaed;
  --color-text: #1a1a2e;
  --color-text-muted: #6b7280;
  --color-text-light: #9ca3af;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-success: #22c55e;
  --color-overlay: rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.08);
  --transition: 150ms ease;
  --font: system-ui, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 0 16px;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  text-decoration: none;
  color: #fff;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.logo-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0 20px 8px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-item.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

.sidebar-item svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: auto;
}

.sidebar-footer-text {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
}

/* ── Main content ─────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-text);
}

.topbar-title span {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  box-shadow: 0 2px 8px rgba(74,158,255,0.30);
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid rgba(239,68,68,0.25);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.08);
  border-color: var(--color-danger);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn-icon:hover:not(:disabled) {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 13px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 15px;
}

/* ── Cards ──────────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lock-icon {
  color: var(--color-text-light);
  flex-shrink: 0;
}

.card-description {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-light);
}

.stat-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-border);
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.card-actions-right {
  margin-left: auto;
}

/* ── Empty state ─────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Group detail ────────────────────────────────────────── */

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  flex: 1;
  min-width: 0;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.url-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition);
}

.url-item:hover {
  box-shadow: var(--shadow);
}

.url-favicon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.url-favicon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

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

.url-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.url-href {
  font-size: 12px;
  color: var(--color-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.url-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.annotation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Modal ───────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  transform: translateY(12px) scale(0.98);
  transition: transform 200ms ease;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text-muted);
  border-radius: 6px;
  display: flex;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Forms ───────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-of-type {
  margin-bottom: 0;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.form-label .optional {
  color: var(--color-text-light);
  font-weight: 400;
  margin-left: 4px;
}

.form-input {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(74,158,255,0.15);
}

.form-input::placeholder {
  color: var(--color-text-light);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .form-input {
  padding-right: 42px;
}

.input-eye {
  position: absolute;
  right: 11px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--color-text-muted);
  display: flex;
  transition: color var(--transition);
}

.input-eye:hover {
  color: var(--color-text);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ── Toast notifications ─────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  max-width: 320px;
  animation: toast-in 250ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.is-leaving {
  animation: toast-out 200ms ease forwards;
}

.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }
.toast-info    { background: #1e3a5f; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0)  scale(1);    }
  to   { opacity: 0; transform: translateY(8px) scale(0.96); }
}

/* ── Loading ─────────────────────────────────────────────── */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  opacity: 0.6;
  display: inline-block;
}

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

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.skeleton-card {
  height: 140px;
  border-radius: var(--radius-lg);
}

/* ── Dividers / helpers ──────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 20px 0;
}

.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 13px; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .logo-name,
  .sidebar-section-label,
  .sidebar-item span,
  .sidebar-footer-text {
    display: none;
  }

  .sidebar-logo {
    padding: 0 14px 24px;
    justify-content: center;
  }

  .sidebar-item {
    justify-content: center;
    padding: 10px;
  }

  .content {
    padding: 20px 16px;
  }

  .topbar {
    padding: 16px 20px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .url-item {
    flex-wrap: wrap;
  }

  .url-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
  }

  .modal {
    padding: 22px 20px;
  }
}

@media (max-width: 480px) {
  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions-right {
    margin-left: 0;
  }

  .card-actions .btn {
    justify-content: center;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }
}
