/* Loggføring page styles – light theme with blue accents */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e6eaf2;
  --text: #0f172a;
  --text-muted: #6b7280;
  --blue: #2563eb;
  --blue-600: #1d4ed8;
  --blue-50: #eef2ff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; /* 16px prevents iOS focus zoom */
  -webkit-text-size-adjust: 100%;
}
input, select, textarea, button { font: inherit; }

/* Header removed per request */
/* Back button row */
.back-row { padding: 12px 20px; }
.back-btn { display:inline-block; color: var(--blue); text-decoration: none; font-weight: 600; background: transparent; border: 1px solid var(--border); padding: 8px 12px; border-radius: 10px; }
.back-btn:hover { color: var(--blue-600); border-color: var(--blue-600); }

.logg-main { padding: 16px 20px; max-width: 1200px; margin: 0 auto; }

/* Toolbar */
.search-toolbar { display:flex; align-items:center; justify-content:space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.search-group { display:flex; align-items:center; gap: 10px; flex: 1; }
.input-wrap input { width: 100%; min-width: 280px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.date-range { display:flex; align-items:center; gap:8px; }
.date-range input[type="date"] { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.date-sep { color: var(--text-muted); }
.action-group { display:flex; align-items:center; gap: 8px; }
.btn.danger { background: #ef4444; color:#fff; border-color: #ef4444; }
.btn.danger:hover { background:#dc2626; border-color:#dc2626; }
.btn.danger:disabled { background:#fca5a5; border-color:#fca5a5; cursor:not-allowed; }
.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor:pointer; font-weight:600; }
.btn.primary { background: var(--blue); color:#fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn.ghost { background: transparent; color: var(--text-muted); }
.btn.outline { background: transparent; border-color: var(--border); }

/* Removed summary bar and extra selects */

/* Table */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.archive-table { width: 100%; border-collapse: collapse; }
.archive-table thead th { text-align: left; font-weight: 600; color: var(--text-muted); background: #fbfbfd; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.archive-table tbody td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
/* Problem & Arbeid text cells with collapsible clamp */
.archive-table tbody td:nth-child(6),
.archive-table tbody td:nth-child(7){
  vertical-align: top;
  max-width: 320px;
}
.text-clamp { display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
tr.expanded .text-clamp { display: block; -webkit-line-clamp: unset; line-clamp: unset; white-space: pre-wrap; }

/* Actions in last cell */
.cell-actions { display: flex; flex-direction: row; gap: 8px; align-items: center; }
.expand-btn { padding:6px 10px; border:1px solid var(--border); background:#fff; border-radius:8px; cursor:pointer; font:inherit; }
.expand-btn:hover { border-color: var(--blue); color: var(--blue-600); }
.archive-table tbody tr:hover { background: #fafbff; }
.archive-table input[type="checkbox"] { width: 16px; height: 16px; }

/* .bulk-actions removed (button moved to toolbar) */
.btn.danger { background: #ef4444; color:#fff; border-color: #ef4444; }
.btn.danger:disabled { background:#fca5a5; border-color:#fca5a5; cursor:not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; background: var(--blue-50); color: var(--blue-600); border: 1px solid #dbeafe; }
.badge button { padding: 6px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.badge button:hover { border-color: var(--blue); color: var(--blue-600); }

/* New simple image button (replaces blue circular badge) */
.img-btn { padding:4px 8px; border:1px solid var(--border); background:#fff; border-radius:6px; cursor:pointer; font: inherit; font-size:13px; line-height:1.1; }
.img-btn:hover { border-color: var(--blue); color: var(--blue-600); }

.row-muted { color: var(--text-muted); }

.pagination { display:flex; gap: 8px; }
.pagination.bottom { justify-content: flex-end; padding: 12px; }
.pagination button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.pagination button:hover { border-color: var(--blue); color: var(--blue-600); }

img.thumb { display: block; width: 140px; height: auto; border-radius: 8px; border: 1px solid var(--border); }

/* Responsive */
@media (max-width: 900px) {
  .search-toolbar { flex-direction: column; align-items: stretch; }
  .input-wrap input { min-width: 0; }
}

/* Mobile-friendly archive: convert table rows to labeled cards */
@media (max-width: 780px) {
  .table-wrap { background: transparent; border: none; }
  .archive-table { width: 100%; border-collapse: separate; border-spacing: 0 12px; }
  .archive-table thead { display: none; }
  .archive-table tbody tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
  .archive-table tbody td { display: grid; grid-template-columns: 100px 1fr; gap: 8px; align-items: start; border: none; padding: 6px 0; word-break: break-word; overflow-wrap: anywhere; }
  .archive-table tbody td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); }

  /* Map labels by column index (order now: [Velg], #, Eier, Telefon, Type, Problem, Arbeid, Fullført, Bilde) */
  .archive-table tbody td:nth-child(1)::before { content: 'Velg'; }
  .archive-table tbody td:nth-child(2)::before { content: '#'; }
  .archive-table tbody td:nth-child(3)::before { content: 'Eier'; }
  .archive-table tbody td:nth-child(4)::before { content: 'Telefon'; }
  .archive-table tbody td:nth-child(5)::before { content: 'Type'; }
  .archive-table tbody td:nth-child(6)::before { content: 'Problem'; }
  .archive-table tbody td:nth-child(7)::before { content: 'Arbeid'; }
  .archive-table tbody td:nth-child(8)::before { content: 'Fullført'; }
  .archive-table tbody td:nth-child(9)::before { content: 'Bilde'; }
  /* Adjust last header label to combined */
  .archive-table tbody td:nth-child(9)::before { content: 'Bilde / Detaljer'; }

  /* Make image area and button friendlier on mobile */
  .badge { display: flex; gap: 8px; padding: 6px 10px; border-radius: 12px; }
  .badge button { width: fit-content; padding: 8px 12px; font-size: 14px; }
  img.thumb { width: 100%; height: auto; margin-top: 8px; }
  .cell-actions { flex-direction: row; flex-wrap: wrap; }

  /* Date inputs: stack neatly on small screens */
  .search-group { flex-direction: column; align-items: stretch; gap: 8px; }
  .date-range { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .date-range input[type="date"] { width: 100%; min-width: 0; }
  .date-sep { align-self: center; }
  .action-group { justify-content: flex-start; }
}
