/* ============ BOTTOM ROW LAYOUT — Apple-style size grid ============ */
.dash-row-bottom {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 140px;
  grid-auto-flow: dense;
  gap: 16px;
}

/* Size classes — medium (data widgets) + small (shortcuts) */
.widget-size-medium {
  grid-column: span 2;
  grid-row: span 2;
}

.widget-size-small {
  grid-column: span 1;
  grid-row: span 1;
}

/* Widget cards fill their grid cell */
.widget-size-medium,
.widget-size-small {
  min-width: 0;
  min-height: 0;
}

.recent-docs-card,
.cal-glance-card,
.voksen-email-glance,
.chat-glance-card,
.dash-shortcut-card {
  height: 100%;
  overflow: hidden;
}

/* ── Widget header action buttons (+ Ny tekst, Ny e-mail) ── */
.widget-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: #64748B;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  font-family: var(--font-family);
  min-height: 28px;
}

.widget-action-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.04);
}

[data-theme="dark"] .widget-action-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .widget-action-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ── Email refresh button ── */
.voksen-email-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.voksen-email-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.voksen-email-refresh:hover {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
}
.voksen-email-refresh:active {
  background: rgba(var(--color-primary-rgb), 0.15);
}
.voksen-email-refresh.spinning svg {
  animation: email-refresh-spin 0.8s linear infinite;
}
@keyframes email-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Grid Drag-and-Drop Reorder ── */

[data-widget-slug][draggable="true"] {
  cursor: grab;
}

[data-widget-slug][draggable="true"]:active {
  cursor: grabbing;
}

.widget-dragging {
  opacity: 0.4;
  transition: opacity 150ms ease;
}

/* Drop indicator — left edge */
.widget-drop-before {
  box-shadow: -3px 0 0 0 var(--color-primary, #696cff),
              0 2px 8px rgba(34, 48, 62, 0.08);
}

/* Drop indicator — right edge */
.widget-drop-after {
  box-shadow: 3px 0 0 0 var(--color-primary, #696cff),
              0 2px 8px rgba(34, 48, 62, 0.08);
}

/* ── Ghost Card — "Tilføj widget" placeholder ── */
/* Ghost "add widget" button — lives outside grid as sibling */
.dash-widget-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--color-text-secondary, #94A3B8);
  background: none;
  border: none;
  padding: 8px 0;
  margin-top: 4px;
  transition: color 150ms ease;
}

.dash-widget-ghost:hover {
  color: var(--color-primary);
}

.dash-widget-ghost:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.dash-widget-ghost-icon {
  color: inherit;
}

.dash-widget-ghost-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: inherit;
}

/* ── 0-Widget Empty State ── */
.dash-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  grid-column: 1 / -1;
  grid-row: span 2;
}

.dash-empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary, #0F172A);
  margin: 16px 0 0;
}

.dash-empty-state-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary, #64748B);
  margin: 4px 0 0;
}

.dash-empty-state-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  margin-top: 16px;
  transition: background 150ms ease, transform 100ms ease;
  min-height: 44px;
  touch-action: manipulation;
}

.dash-empty-state-cta:hover {
  background: var(--color-primary-hover);
}

.dash-empty-state-cta:active {
  transform: scale(0.98);
}

.dash-empty-state-cta:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============ SHORTCUT CARDS ============ */

.dash-shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: var(--color-text-primary, #0F172A);
  transition: transform 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}

.dash-shortcut-card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dash-shortcut-card:active {
  transform: scale(0.98);
}

.dash-shortcut-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(var(--color-primary-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-shortcut-icon svg {
  width: 22px;
  height: 22px;
  color: var(--color-primary);
}

.dash-shortcut-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

/* ============ WIDGET ANIMATIONS ============ */

@keyframes widgetAppear {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes widgetRemove {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.8); }
}

.widget-entering {
  animation: widgetAppear 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.widget-removing {
  animation: widgetRemove 300ms ease-in both;
}

/* Dark mode — Shortcut cards */
[data-theme="dark"] .dash-shortcut-card {
  background: #2b2a27;
  border-color: rgba(255, 255, 255, 0.06);
  color: #e8e6e1;
}

[data-theme="dark"] .dash-shortcut-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dash-shortcut-icon {
  background: rgba(var(--color-primary-rgb), 0.15);
}

/* Dark mode — Drag-and-drop indicators */
[data-theme="dark"] .widget-drop-before {
  box-shadow: -3px 0 0 0 var(--color-primary, #696cff),
              0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .widget-drop-after {
  box-shadow: 3px 0 0 0 var(--color-primary, #696cff),
              0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Dark mode — Ghost card */
[data-theme="dark"] .dash-widget-ghost {
  color: #a3a19b;
}

[data-theme="dark"] .dash-widget-ghost:hover {
  color: var(--color-primary);
}

/* Dark mode — Empty state */
[data-theme="dark"] .dash-empty-state-title {
  color: var(--color-text-primary, #F1F5F9);
}

[data-theme="dark"] .dash-empty-state-desc {
  color: #a3a19b;
}

[data-theme="dark"] .dash-empty-state-cta {
  background: var(--color-primary);
  color: #fff;
}
