/* ============ CALENDAR GLANCE WIDGET ============ */
.cal-glance-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
}

/* Widget cards — 2nd tier: border-only, no shadow */
.v-voksen .recent-docs-card,
.v-voksen .voksen-email-glance,
.v-voksen .cal-glance-card {
  box-shadow: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.cal-glance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.cal-glance-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

/* "Se kalender" link — header right side */
.cal-glance-link {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
}

.cal-glance-link:hover {
  color: var(--color-text-primary);
}

/* ── Event list ── */
.cal-glance-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
}

.cal-glance-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
  cursor: pointer;
  touch-action: manipulation;
}

.cal-glance-item + .cal-glance-item {
  margin-top: 2px;
}

.cal-glance-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* "Happening now" highlight */
.cal-glance-item.cal-now {
  background: var(--color-info-light);
  box-shadow: inset 3px 0 0 var(--color-info);
}

/* Past events — dimmed */
.cal-glance-item.cal-past {
  opacity: 0.45;
}
.cal-glance-item.cal-past .cal-glance-title {
  text-decoration: line-through;
  text-decoration-color: rgba(0, 0, 0, 0.2);
}

.cal-glance-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-glance-content {
  flex: 1;
  min-width: 0;
}

.cal-glance-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-glance-time {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* All-day badge */
.cal-glance-allday {
  background: var(--cal-event-bg, #EEF2FF);
  color: var(--cal-event-text, #6366F1);
  padding: 1px 8px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Next-event hint when today is empty */
.cal-glance-next-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 4px 0 0;
  font-weight: 400;
}
.cal-glance-next-hint strong {
  font-weight: 600;
  color: var(--color-text-primary);
}

/* "+N mere" overflow link */
.cal-glance-more {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  touch-action: manipulation;
}

.cal-glance-more:hover {
  text-decoration: underline;
}

/* ── Loading skeleton — matches docs skeleton style ── */
.cal-glance-loading {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cal-skeleton-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 8px;
}

.cal-skeleton-item + .cal-skeleton-item {
  margin-top: 2px;
}

.cal-skeleton-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-skeleton-title {
  height: 13px;
  width: 55%;
  flex: none;
}

.cal-skeleton-time {
  height: 12px;
  width: 60px;
  margin-left: auto;
  flex: none;
}

/* ── Empty state — ghost calendar schedule ── */
.cal-glance-empty {
  display: flex;
  flex-direction: column;
  color: var(--color-text-secondary);
}

.cal-ghost-schedule {
  position: relative;
  height: 170px;
  overflow: hidden;
}

.cal-ghost-rows {
  display: flex;
  flex-direction: column;
  filter: blur(3px);
  opacity: 0.18;
  pointer-events: none;
  user-select: none;
}

.cal-ghost-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-top: 1px solid var(--color-border, rgba(0,0,0,.04));
}

.cal-ghost-row:first-child { border-top: none; }

.cal-ghost-time-label {
  width: 32px;
  height: 9px;
  border-radius: 5px;
  background: var(--color-text-secondary, rgba(0,0,0,.3));
  opacity: 0.3;
  flex-shrink: 0;
}

.cal-ghost-bar {
  height: 22px;
  border-radius: 6px;
  opacity: 0.5;
}

.cal-ghost-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--color-text-secondary, rgba(0,0,0,.5));
}

.cal-ghost-overlay svg {
  opacity: 0.5;
  margin-bottom: 8px;
}

.cal-ghost-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text, #1a1a1e);
  margin: 0 0 4px;
}

.cal-ghost-cta {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 8px;
  background: var(--color-primary, #696cff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s, transform .15s;
}

.cal-ghost-cta:hover {
  background: var(--color-primary-hover, #5b5eda);
  color: #fff;
  transform: translateY(-1px);
}

/* Next-event hint below ghost schedule */
.cal-glance-next-hint {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-text-secondary, rgba(0,0,0,.45));
  text-align: center;
  padding: 6px 8px 0;
  margin: 0;
  line-height: 1.4;
}

/* Ghost subtitle (new-user teaser) */
.cal-ghost-sub {
  font-size: 12px;
  color: var(--color-text-secondary, rgba(0,0,0,.45));
  margin: 0 0 12px;
  line-height: 1.4;
}

/* Active-user calm empty state ("Dagen er fri") — matches email-zero pattern */
.cal-free-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 20px 16px 8px;
  color: var(--color-text-secondary, #64748B);
}

.cal-free-day svg {
  opacity: 0.4;
}

.cal-free-day-title {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}

.cal-free-day-link {
  font-size: 12px;
  font-weight: 500;
  color: #a3a19b;
  text-decoration: none;
  transition: color .15s;
}

.cal-free-day-link:hover {
  color: var(--color-primary, #696cff);
  text-decoration: underline;
}

/* Dark mode ghost calendar */
[data-theme="dark"] .cal-ghost-time-label { background: rgba(255,255,255,.2); }
[data-theme="dark"] .cal-ghost-title { color: #fff; }
[data-theme="dark"] .cal-ghost-sub { color: rgba(255,255,255,.5); }
[data-theme="dark"] .cal-ghost-overlay svg { color: rgba(255,255,255,.4); }
[data-theme="dark"] .cal-glance-next-hint { color: rgba(255,255,255,.4); }
[data-theme="dark"] .cal-free-day { color: rgba(255,255,255,.45); }
[data-theme="dark"] .cal-free-day-link { color: rgba(255,255,255,.35); }

/* ── Error state ── */
.cal-glance-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) 0 var(--space-4);
  color: var(--color-text-secondary);
}

.cal-glance-error svg {
  opacity: 0.5;
  color: #f59e0b;
}

.cal-glance-error p {
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin: 0;
}

.cal-glance-retry-btn {
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
  touch-action: manipulation;
}

.cal-glance-retry-btn:hover {
  text-decoration: underline;
}

/* ── Dark mode ── */
[data-theme="dark"] .cal-glance-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .cal-glance-item.cal-now {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: inset 3px 0 0 #818cf8;
}

[data-theme="dark"] .cal-glance-more {
  border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .cal-glance-item.cal-past .cal-glance-title {
  text-decoration-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .cal-glance-allday {
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
}

/* Dark mode muted action links */
[data-theme="dark"] .recent-docs-link,
[data-theme="dark"] .cal-glance-link,
[data-theme="dark"] .voksen-email-link {
  color: #a3a19b;
}

[data-theme="dark"] .recent-docs-link:hover,
[data-theme="dark"] .cal-glance-link:hover,
[data-theme="dark"] .voksen-email-link:hover {
  color: #e8e6e1;
}

/* ── Calendar context menu ── */
.cal-ctx-menu {
  display: none;
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, rgba(0,0,0,0.08));
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  padding: 4px;
  animation: calCtxIn 0.12s ease;
}
@keyframes calCtxIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.cal-ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text-primary, #384551);
  cursor: pointer;
  transition: background 0.1s;
}
.cal-ctx-item:hover {
  background: rgba(0,0,0,0.04);
}
.cal-ctx-item svg {
  flex-shrink: 0;
  color: var(--color-text-secondary, #646e78);
}
.cal-ctx-item--danger {
  color: #ef4444;
}
.cal-ctx-item--danger svg {
  color: #ef4444;
}
.cal-ctx-item--danger:hover {
  background: rgba(239,68,68,0.06);
}
.cal-ctx-divider {
  height: 1px;
  background: var(--color-border, rgba(0,0,0,0.08));
  margin: 4px 8px;
}

/* Dark mode */
[data-theme="dark"] .cal-ctx-menu {
  background: #2a2a2c;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .cal-ctx-item:hover {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .cal-ctx-divider {
  background: rgba(255,255,255,0.08);
}

/* Inline delete confirm bar */
.cal-delete-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--color-error-light);
  border: 1px solid color-mix(in srgb, var(--color-error) 25%, transparent);
  font-size: 13px;
  color: var(--color-danger);
  animation: cal-confirm-in 0.15s ease-out;
}
.cal-delete-confirm span {
  flex: 1;
  font-weight: 500;
}
.cal-delete-yes {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  background: var(--color-error);
  color: var(--color-text-inverted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cal-delete-yes:hover { background: var(--color-danger); }
.cal-delete-no {
  padding: 4px 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-card);
  color: var(--color-text-primary);
  font-size: 13px;
  cursor: pointer;
}
.cal-delete-no:hover { background: var(--color-hover); }
@keyframes cal-confirm-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
[data-theme="dark"] .cal-delete-no {
  background: var(--color-hover-strong);
  border-color: var(--color-border);
}
