/* =========================
  COLOR PALETTE & VARIABLES
  ========================= */
:root {
  --primary: #4361ee;
  --primary-light: #4cc9f0;
  --primary-dark: #3a0ca3;
  --danger: #ef233c;
  --warning: #f4a261;
  --success: #2ec4b6;
  --dark: #2b2d42;
  --light: #f8f9fa;
  --lighter: #ffffff;
  --gray: #e9ecef;
  --dark-gray: #6c757d;
  --Roze: #ec4899;
  --Geel: #fcd34d;
  --Oranje: #f97316;
  --Rood: #ef4444;
  --Groen: #22c55e;
  --Blauw: #3b82f6;
  --Bruin: #8B5C2A;
  --Kaki: #6b5d24;
  --Paars: #a78bfa;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

/* =========================
  BASE RESET & TYPOGRAPHY
  ========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f5f7fa;
  color: var(--dark);
}
button, .btn, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
  border: none;
  outline: none;
  box-shadow: none;
}

/* =========================
  UTILITY CLASSES
  ========================= */
.error-message {
  margin-top: 1.5rem;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(239, 35, 60, 0.1);
  color: var(--danger);
  transition: all 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  visibility: hidden;
}
.error-message.show {
  opacity: 1;
  visibility: visible;
  animation: blink 1.5s ease-in-out 6;
}
.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 35, 60, 0.2);
}
tr.current-user {
  background: rgba(67, 97, 238, 0.12);
  color: var(--primary-dark);
  font-weight: 600;
}

/* =========================
  SKELETON LOADER STYLES
  ========================= */
.skeleton-nav-bar,
.skeleton-header,
.skeleton-filter {
  display: flex;
  align-items: center;
}
.skeleton-nav-bar {
  min-width: 600px;
}
.skeleton-nav-bar .skeleton-cell,
.skeleton-header .skeleton-cell,
.skeleton-filter .skeleton-cell {
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #ececec 25%, #f3f3f3 50%, #ececec 75%);
  animation: skeleton-loading 1.2s infinite linear;
}
.skeleton-nav-bar .skeleton-cell {
  width: 132px !important;
  height: 34px !important;
  margin: 0 !important;
  display: inline-flex !important;
  justify-content: center !important;
  padding: 0.5rem 1rem !important;
  border-radius: 50px !important;
  box-sizing: border-box !important;
}
.skeleton-header .skeleton-cell {
  width: 297px;
  height: 32px;
  margin: 0;
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}
.skeleton-filter {
  gap: 1.5rem;
  background: var(--lighter, #f6f7fb);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.04));
  margin-bottom: 16px;
}
.skeleton-filter .skeleton-cell {
  width: 160px;
  height: 38px;
  margin: 0;
  display: block;
}
.skeleton-table {
  width: 100%;
  margin-bottom: 1rem;
}
.skeleton-table-head {
  height: 50px;
  border-radius: 6px;
  margin: 0 16px;
  background: linear-gradient(90deg, #ececec 25%, #f3f3f3 50%, #ececec 75%);
  background-size: 200px 100%;
  animation: skeleton-loading 5s infinite linear;
}
.skeleton-row {
  display: grid;
  grid-template-columns: 142.67px 104.83px 1fr 115.53px 121.97px 73.06px;
  align-items: center;
  min-height: 97px;
  border-bottom: 1px solid var(--gray, #e0e0e0);
}
.skeleton-cell {
  height: 66%;
  margin: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ececec 25%, #f3f3f3 50%, #ececec 75%);
  animation: skeleton-loading 5s infinite linear;
  box-sizing: border-box;
  border-bottom: 1px solid var(--gray);
  align-items: center;
}
@keyframes skeleton-loading {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* =========================
  NAVIGATION BAR
  ========================= */
.navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
}
.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links a,
.dropdown-content a {
  color: var(--dark);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
}
.nav-links a:hover, 
.nav-links a.active,
.dropbtn:hover,
.dropbtn.active {
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary);
}
.dropdown {
  position: relative;
}
.dropbtn {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  transition: all 0.3s;
}
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background: var(--lighter);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  z-index: 1;
  overflow: hidden;
}
.dropdown-content a {
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}
.dropdown-content a:hover {
  background: var(--gray);
}
.dropdown:hover .dropdown-content {
  display: block;
}
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
}

.logo {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
  LAYOUT & CONTAINER
  ========================= */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 20px;
}
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.header-bar h1 {
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* =========================
  CARD COMPONENT
  ========================= */
.card {
  background: var(--lighter);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* =========================
  TABLE STYLES (INCIDENT & DASHBOARD)
  ========================= */
.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
}
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.dashboard-table th {
  background: var(--light);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
}
.dashboard-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray);
  transition: background 0.2s ease;
}
.dashboard-table tr:last-child td {
  border-bottom: none;
}
.dashboard-table tr:hover td {
  background: rgba(67, 97, 238, 0.03);
}
.incident-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 800px;
}

.incident-table th {
  background: var(--light);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
  position: sticky;
  top: 0;
}

#viewChildIncidentsContent .table-responsive {
  max-height: 350px;
  overflow-y: auto;
}

.incident-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray);
  transition: background 0.2s ease;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.incident-table td[title] {
    position: relative;
}

.incident-table tr:last-child td {
  border-bottom: none;
}

.incident-table tr:hover td {
  background: rgba(67, 97, 238, 0.03);
}

/* =========================
  USER INFO DISPLAY
  ========================= */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* =========================
  BADGES (SEVERITY & GROUP)
  ========================= */
.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: default;
  text-align: center;
}
.severity-0 { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.severity-1 { background: rgba(46, 196, 182, 0.1); color: var(--success);}
.severity-2 { background: rgba(244, 162, 97, 0.1); color: var(--warning);}
.severity-3 { background: rgba(239, 35, 60, 0.1); color: var(--danger);}
.groep-Roze   { background: rgba(236, 72, 153, 0.12); color: var(--Roze);}
.groep-Geel   { background: rgba(252, 211, 77, 0.12); color: var(--Geel);}
.groep-Oranje { background: rgba(249, 115, 22, 0.12); color: var(--Oranje);}
.groep-Rood   { background: rgba(239, 68, 68, 0.12); color: var(--Rood);}
.groep-Groen  { background: rgba(34, 197, 94, 0.12); color: var(--Groen);}
.groep-Blauw  { background: rgba(59, 130, 246, 0.12); color: var(--Blauw);}
.groep-Bruin  { background: rgba(139, 92, 42, 0.12); color: var(--Bruin);}
.groep-Kaki   { background: rgba(107, 93, 36, 0.12); color: var(--Kaki);}
.groep-Paars  { background: rgba(167, 139, 250, 0.12); color: var(--Paars);}

/* =========================
  BUTTONS (PRIMARY, SECONDARY, ICON)
  ========================= */
.btn, .btn-primary, .btn-secondary, .btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  border: none;
  font-size: 0.95rem;
}
.btn {
  padding: 0.6rem 1.25rem;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}
.btn-secondary {
  background: var(--gray);
  color: var(--dark);
}
.btn-secondary:hover {
  background: var(--dark-gray);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}
.btn-icon {
  width: 32px;
  height: 32px;
  background: none;
  color: var(--dark-gray);
  border-radius: 6px;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--gray);
  color: var(--dark);
}
.btn-icon.danger:hover {
  background: rgba(239, 35, 60, 0.1);
  color: var(--danger);
}
#addUserButton:disabled,
#addUserButton.disabled {
  background: var(--gray);
  color: var(--dark-gray);
  cursor: not-allowed;
}

/* =========================
  PAGINATION COMPONENT
  ========================= */
.pagination {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.page-link {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--dark);
  text-decoration: none;
  transition: all 0.3s ease;
  background: var(--light);
}
.page-link:hover, 
.page-link.active {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* =========================
  FORMS (INPUTS, GROUPS, FILTERS)
  ========================= */
.form-control,
.login-form .form-group input,
.incident-filter-form select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s;
  background: var(--light);
  color: var(--dark);
}
.form-control:focus,
.login-form .form-group input:focus,
.incident-filter-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label,
.incident-filter-form label,
.login-form .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--dark-gray);
}
.severity-options {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}
.severity-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.severity-radio {
  position: absolute;
  opacity: 0;
}
.severity-radio:checked + .severity-badge {
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.05);
}

/* =========================
  INCIDENT FILTER & SORT FORM
  ========================= */
.incident-filter-form {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: var(--lighter);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.incident-filter-form button {
  margin-left: 1rem;
}

/* =========================
  LOGIN PAGE STYLES
  ========================= */
.login-card {
  max-width: 400px;
  margin: 5rem auto;
  padding: 2rem;
}
.login-title {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--primary);
}
.login-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}
.login-actions a {
  text-decoration: none;
  color: var(--primary);
}
.login-actions a:hover {
  text-decoration: underline;
}

/* =========================
  DASHBOARD PAGE STYLES
  ========================= */
.dashboard-container {
  display: flex;
  gap: 2%;
  flex-wrap: wrap;
  align-content: start;
  align-items: stretch;
  margin: 1.5rem;
  height: calc(100vh - 7.66rem);
}
.dashboard-item:nth-child(1) {
  width: 25%;
  height: 100%;
}
.dashboard-item:nth-child(2) {
  flex-grow: 1;
  height: 100%;
}
.dashboard-button.active {
  background: var(--primary-dark);
}
.dashboard-content {
  animation: fadeIn 0.3s ease;
}

/* =========================
  ERROR PAGE STYLES
  ========================= */
.container.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 0;
  margin-bottom: 0;
}
.error-message.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: larger;
  padding: 2rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}
h1.error-page {
  text-align: center;
}
.container.error-page form {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* =========================
  RESPONSIVE DESIGN
  ========================= */
@media (max-width: 768px) {
  .nav-links {
    display: none !important;
    flex-direction: column;
    background: var(--lighter);
    position: absolute;
    top: 60px; /* adjust if needed */
    right: 10px;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    z-index: 1001;
    min-width: 160px;
  }

  .nav-links.show {
    display: flex !important;
  }

  .hamburger { 
    display: block; 
  }

  .header-bar { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 1rem; 
  }

  .incident-table { 
    font-size: 0.9rem; 
  }

  .incident-table th, 
  .incident-table td { 
    padding: 0.75rem; 
  }

  .incident-filter-form { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 1rem; 
    padding: 1rem; 
  }

  .dashboard-container {
    flex-direction: column;
    gap: 1rem;
    margin: 0.5rem;
    height: auto;
    }

  .dashboard-item {
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }

  .dashboard-table {
    font-size: 0.95rem;
  }
}

/* =========================
  INCIDDENT MODALS
  ========================= */

  .incident-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
  }

  .incident-modal-content {
    background: var(--light);
    margin: 10vh auto;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    position: relative;
    font-size: 1.1rem;
  }

  .incident-modal-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    transition: color 0.3s ease;
  }

/* ==========================
  Autocomplete Styles
  ========================= */

  .autocomplete-items {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    z-index: 1000;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
  }
  .autocomplete-items.show {
      display: block;
  }
  .autocomplete-item {
      padding: 8px 12px;
      cursor: pointer;
  }
  .autocomplete-item:hover {
      background: #f0f0f0;
  }

/* =========================
  ANIMATIONS
  ========================= */
@keyframes blink {
  0%, 100% { opacity: 1; }
  20%, 60% { opacity: 0; }
  40%, 80% { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}