/* ============================================================
   PrekenArchief-Uploader - Design System
   Nederlandse, moderne, toegankelijke UI.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap');

:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-surface-2: #f1f3f9;
  --color-border: #e2e6ef;
  --color-primary: #2f5f9e;
  --color-primary-dark: #24497b;
  --color-primary-light: #e8eef8;
  --color-accent: #e2873a;
  --color-success: #2e9e6b;
  --color-danger: #c0392b;
  --color-text: #1f2633;
  --color-text-muted: #667085;
  --color-white: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(31, 38, 51, 0.08);
  --shadow-md: 0 8px 24px rgba(31, 38, 51, 0.12);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-display: "Manrope", "Inter", -apple-system, "Segoe UI", sans-serif;

  --sidebar-width: 240px;
  --navbar-height: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(47, 95, 158, 0.08), transparent 40%),
    radial-gradient(circle at bottom right, rgba(226, 135, 58, 0.07), transparent 40%),
    var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 0.5rem;
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   Layout
   ============================================================ */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #1f2a3a;
  color: #cfd8e3;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--color-white);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}

.sidebar .brand .logo {
  background: linear-gradient(135deg, #f59e42 0%, #e2873a 100%);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--color-white);
  box-shadow: 0 4px 12px rgba(226, 135, 58, 0.4);
}
.sidebar .brand .logo svg {
  width: 18px;
  height: 18px;
}

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

.sidebar .nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7b899c;
  padding: 14px 10px 6px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
  color: #b9c4d4;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
  border: 1px solid transparent;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-white);
  text-decoration: none;
  transform: translateX(2px);
}

.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(47, 95, 158, 0.9), rgba(47, 95, 158, 0.55));
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.sidebar .nav-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar .user-box {
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.sidebar .user-box .name {
  color: var(--color-white);
  font-weight: 600;
}

.sidebar .user-box .role {
  color: #8fa0b5;
  text-transform: capitalize;
}

.main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #2f5f9e 0%, #1f2a3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header .subtitle {
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  line-height: 1;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #35689f 0%, #2f5f9e 55%, #24497b 100%);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(47, 95, 158, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3a70ac 0%, #2f5f9e 55%, #1f3d66 100%);
  box-shadow: 0 6px 20px rgba(47, 95, 158, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

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

.btn-danger {
  background: var(--color-danger);
  color: var(--color-white);
}

.btn-danger:hover {
  filter: brightness(0.92);
}

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

.btn-ghost:hover {
  background: var(--color-primary-light);
}

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

/* ============================================================
   Forms
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

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

.form-group.full {
  grid-column: 1 / -1;
}

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

.form-group label .req {
  color: var(--color-danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  background: var(--color-white);
  color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 95, 158, 0.15);
}

.form-group textarea {
  min-height: 90px;
  resize: vertical;
}

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

/* Select + inline "nieuw aanmaken" knop (admin) */
.select-create-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.select-create-row select {
  flex: 1;
  min-width: 0;
}

.btn-create {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-primary);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  flex-shrink: 0;
}

.btn-create:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.btn-create:active {
  transform: translateY(1px);
}

/* ============================================================
   Cards & tables
   ============================================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 20px;
  border-top: 3px solid var(--color-primary);
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card .card-header h2 {
  font-size: 18px;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

table.data-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--color-surface-2);
}

table.data-table tr:hover td {
  background: var(--color-surface-2);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions .btn {
  padding: 6px 10px;
  font-size: 13px;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background: var(--color-accent);
  color: var(--color-white);
}

.badge-uploader {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-role {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

/* ============================================================
   Dropzone
   ============================================================ */

.dropzone {
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 20%, rgba(47, 95, 158, 0.06), transparent 50%),
    var(--color-primary-light);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.dropzone:hover,
.dropzone.dragover {
  background:
    radial-gradient(circle at 20% 20%, rgba(47, 95, 158, 0.12), transparent 50%),
    #dce7f5;
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
}

.dropzone .dz-icon {
  font-size: 40px;
  margin-bottom: 10px;
  color: var(--color-primary);
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.dropzone p {
  margin: 4px 0;
  color: var(--color-text-muted);
}

.dropzone p.dz-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.dropzone input[type="file"] {
  display: none;
}

.upload-progress {
  display: none;
  margin-top: 12px;
}

.upload-progress .bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress .bar .fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.2s ease;
}

.upload-progress .status {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.file-ready {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: #eaf6ef;
  border: 1px solid #cdeadd;
  border-radius: var(--radius-sm);
  color: var(--color-success);
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 38, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  animation: modalIn 0.25s ease;
  border-top: 3px solid var(--color-primary);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal .modal-header h2 {
  font-size: 18px;
  margin: 0;
}

.modal .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
}

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

/* ============================================================
   Toast
   ============================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  color: var(--color-white);
  box-shadow: var(--shadow-md);
  font-weight: 500;
  font-size: 14px;
  animation: slideIn 0.2s ease;
  min-width: 240px;
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }
.toast.info { background: var(--color-primary); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   Login page
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #131c2b 0%, #1f2a3a 45%, #2f5f9e 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}

.login-page::before {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #e2873a 0%, transparent 70%);
  top: -80px;
  right: -60px;
  animation: floatOrb 14s ease-in-out infinite;
}

.login-page::after {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #3b82c4 0%, transparent 70%);
  bottom: -120px;
  left: -80px;
  animation: floatOrb 18s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 38px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(4px);
  animation: fadeUp 0.5s ease;
}

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

.login-card .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  justify-content: center;
}

.login-card .logo .logo-box {
  background: var(--color-accent);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--color-white);
  font-size: 20px;
}

.login-card h1 {
  font-size: 22px;
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ============================================================
   Stats (dashboard)
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--color-primary);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.stat-card .stat-value {
  font-size: 34px;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--color-primary);
}

.stat-card .stat-label {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-top: 4px;
}

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

/* ============================================================
   Misc
   ============================================================ */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

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

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main { padding: 20px 16px; }
  .nav-group-label { display: none; }
}
