/*
 * HOMER Design System
 * ====================
 * Eén bestand. Alle tokens, reset, componenten, utilities.
 *
 * Kernprincipes (uit Homer Persona):
 * - Rust: veel witruimte, geen visuele ruis
 * - Warmte: aardse tinten, niet kil-technisch
 * - Vakmanschap: solide, gebouwd om te werken
 * - Functie eerst: alles heeft een reden
 *
 * Naamconventie: --h-{categorie}-{eigenschap}
 * Classes: .h-{naam} voor utilities en componenten
 */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* -----------------------------------------------------------------------
   * Kleuren  — leisteen, linnen, hout, ochtendlicht
   * --------------------------------------------------------------------- */

  /* Primair */
  --h-color-primary:       #2a5f5f;
  --h-color-primary-light: #3a7575;
  --h-color-primary-dark:  #1e4747;
  /* Achtergronden */
  --h-color-bg:            #faf9f7;
  --h-color-surface:       #ffffff;
  --h-color-surface-dim:   #f5f4f2;

  /* Tekst */
  --h-color-text:          #2c3338;
  --h-color-text-secondary:#5a6268;
  --h-color-text-muted:    #8a9199;
  --h-color-text-inverse:  #faf9f7;

  /* Accent — spaarzaam */
  --h-color-accent:        #c17f4a;
  --h-color-accent-light:  #d4956a;

  /* Functioneel */
  --h-color-success:       #4a7c59;
  --h-color-warning:       #b8860b;
  --h-color-error:         #a63d40;
  --h-color-info:          #4a6fa5;

  /* Randen */
  --h-color-border:        #e2e0dc;
  --h-color-border-strong: #c9c6c0;

  /* Status */
  --h-color-off:           #9ca3af;

  /* -----------------------------------------------------------------------
   * Spacing — 4px grid
   * --------------------------------------------------------------------- */
  --h-space-xs:  0.25rem;  /*  4px */
  --h-space-sm:  0.5rem;   /*  8px */
  --h-space-md:  1rem;     /* 16px */
  --h-space-lg:  1.5rem;   /* 24px */
  --h-space-xl:  2rem;     /* 32px */
  --h-space-2xl: 3rem;     /* 48px */

  /* -----------------------------------------------------------------------
   * Typography
   * --------------------------------------------------------------------- */
  --h-font-family: system-ui, -apple-system, BlinkMacSystemFont,
                   'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --h-font-mono:   'SF Mono', 'Roboto Mono', Consolas, monospace;

  --h-text-xs:   0.75rem;   /* 12px */
  --h-text-sm:   0.875rem;  /* 14px */
  --h-text-base: 1rem;      /* 16px */
  --h-text-lg:   1.125rem;  /* 18px */
  --h-text-xl:   1.25rem;   /* 20px */
  --h-text-2xl:  1.5rem;    /* 24px */
  --h-text-3xl:  1.75rem;   /* 28px */

  --h-weight-normal:   400;
  --h-weight-medium:   500;
  --h-weight-semibold: 600;
  --h-weight-bold:     700;

  --h-leading-tight:   1.25;
  --h-leading-normal:  1.5;
  --h-leading-relaxed: 1.75;

  /* -----------------------------------------------------------------------
   * Borders & Radius
   * --------------------------------------------------------------------- */
  --h-border:        1px solid var(--h-color-border);
  --h-border-strong: 1px solid var(--h-color-border-strong);
  --h-radius-sm:  4px;
  --h-radius-md:  6px;
  --h-radius-lg:  8px;
  --h-radius-xl:  12px;
  --h-radius-full: 9999px;

  /* -----------------------------------------------------------------------
   * Shadows — zacht, niet opdringerig
   * --------------------------------------------------------------------- */
  --h-shadow-sm:  0 1px 2px rgba(44, 51, 56, 0.05);
  --h-shadow-md:  0 2px 8px rgba(44, 51, 56, 0.08);
  --h-shadow-lg:  0 4px 16px rgba(44, 51, 56, 0.1);

  /* -----------------------------------------------------------------------
   * Transitions
   * --------------------------------------------------------------------- */
  --h-transition-fast:   150ms ease;
  --h-transition-normal: 250ms ease;

  /* -----------------------------------------------------------------------
   * Layout
   * --------------------------------------------------------------------- */
  --h-header-height: 60px;
  --h-max-width:     1400px;
  --h-content-width: 1200px;

  /* -----------------------------------------------------------------------
   * Z-index lagen
   * --------------------------------------------------------------------- */
  --h-z-dropdown:  1000;
  --h-z-sticky:    1020;
  --h-z-fixed:     1030;
  --h-z-overlay:   1040;
  --h-z-modal:     1050;
  --h-z-tooltip:   1070;

  /* -----------------------------------------------------------------------
   * BACKWARD COMPATIBILITY — aliassen voor bestaande variabelnamen
   * Verwijder deze na volledige migratie.
   * --------------------------------------------------------------------- */
  --primary-color:          var(--h-color-primary);
  --secondary-color:        var(--h-color-text-secondary);
  --accent-color:           var(--h-color-accent);
  --background-color:       var(--h-color-bg);
  --text-color:             var(--h-color-text);
  --success-color:          var(--h-color-success);
  --warning-color:          var(--h-color-warning);
  --error-color:            var(--h-color-error);
  --info-color:             var(--h-color-info);

  --border-radius:          var(--h-radius-lg);
  --box-shadow:             var(--h-shadow-md);
  --container-border:       var(--h-border);
  --container-radius:       var(--h-radius-lg);
  --container-pending-color:var(--h-color-surface);
  --container-max-width:    var(--h-content-width);
  --medium-container-width: 800px;
  --container-min-width:    250px;
  --small-container-width:  200px;
  --max-content-width:      var(--h-max-width);

  --secundaryColor:         var(--h-color-surface-dim);
  --offColor:               var(--h-color-off);
  --off-color:              var(--h-color-off);
  --container-off-color:    var(--h-color-off);
  --highlight-color:        var(--h-color-accent);

  --button-border-radius:   var(--h-radius-md);
  --button-border:          1px solid var(--h-color-primary);
  --hover-background-color: var(--h-color-primary-light);
  --hover-text-color:       var(--h-color-text-inverse);

  --font-family:       var(--h-font-family);
  --font-size-small:   var(--h-text-sm);
  --font-size-normal:  var(--h-text-base);
  --font-size-large:   var(--h-text-lg);
  --font-size-xl:      var(--h-text-xl);
  --font-size-xxl:     var(--h-text-2xl);

  --spacing-xs: var(--h-space-xs);
  --spacing-sm: var(--h-space-sm);
  --spacing-md: var(--h-space-md);
  --spacing-lg: var(--h-space-lg);
  --spacing-xl: var(--h-space-xl);
}


/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  font-family: var(--h-font-family);
  font-size: var(--h-text-base);
  color: var(--h-color-text);
  background-color: var(--h-color-bg);
  line-height: var(--h-leading-normal);
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--h-weight-semibold);
  line-height: var(--h-leading-tight);
  color: var(--h-color-text);
  margin-top: 0;
  margin-bottom: var(--h-space-md);
}

h1 { font-size: var(--h-text-3xl); }
h2 { font-size: var(--h-text-xl); }
h3 { font-size: var(--h-text-lg); }
h4 { font-size: var(--h-text-base); }

p {
  margin-top: 0;
  margin-bottom: var(--h-space-md);
}

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

a:hover {
  color: var(--h-color-primary-light);
}

code, pre, .mono {
  font-family: var(--h-font-mono);
}


/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

main {
  flex: 1;
  margin-top: var(--h-header-height);
  padding: var(--h-space-lg);
}

.container {
  max-width: var(--h-content-width);
  margin: 0 auto;
  padding: var(--h-space-lg);
  box-sizing: border-box;
}

#main {
  width: 100%;
  max-width: var(--h-max-width);
  margin: 0 auto;
  padding: var(--h-space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: var(--h-space-lg);
}


/* ==========================================================================
   5. HEADER & NAVIGATION
   ========================================================================== */

header {
  background: var(--h-color-primary);
  padding: 0 var(--h-space-lg);
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: var(--h-z-fixed);
  height: var(--h-header-height);
  display: flex;
  align-items: center;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--h-max-width);
  width: 100%;
  margin: 0 auto;
}

.logo {
  flex-shrink: 0;
}

.logo img {
  display: block;
  height: 30px;
  width: auto;
}

.nav-menu {
  display: flex;
  list-style-type: none;
  margin: 0;
  padding: 0;
  gap: 2px;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--h-color-text-inverse);
  text-decoration: none;
  padding: 10px 14px;
  display: block;
  font-size: var(--h-text-sm);
  font-weight: var(--h-weight-medium);
  border-radius: var(--h-radius-sm);
  transition: background-color var(--h-transition-fast);
}

.nav-link:hover,
.nav-link:focus {
  background-color: var(--h-color-primary-light);
  color: var(--h-color-text-inverse);
}

.nav-item.active > .nav-link {
  background-color: var(--h-color-primary-dark);
}

/* Submenu */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--h-color-surface);
  min-width: 200px;
  border-radius: var(--h-radius-lg);
  box-shadow: var(--h-shadow-lg);
  list-style-type: none;
  padding: var(--h-space-sm);
  margin-top: 4px;
  z-index: calc(var(--h-z-fixed) + 1);
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
  display: block;
}

.submenu .nav-link {
  color: var(--h-color-text);
  padding: 8px 12px;
  font-size: var(--h-text-sm);
}

.submenu .nav-link:hover,
.submenu .nav-link:focus {
  background-color: var(--h-color-surface-dim);
  color: var(--h-color-primary);
}

.submenu li.active .nav-link {
  background-color: var(--h-color-surface-dim);
  color: var(--h-color-primary);
  font-weight: var(--h-weight-semibold);
}

.has-submenu > .nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-menu-text {
  font-weight: var(--h-weight-medium);
}

.active-submenu-text {
  font-size: 0.85em;
  opacity: 0.8;
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--h-space-sm);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--h-color-text-inverse);
  margin: 5px 0;
  border-radius: 1px;
  transition: all 0.3s ease;
}

/* Logout */
.logout {
  margin-left: auto;
}

.nav-item.logout .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item.logout .logout-icon {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.nav-item.logout .nav-link:hover .logout-icon {
  transform: translateX(2px);
}

.logout-text {
  display: inline-block;
}


/* ==========================================================================
   6. BUTTONS
   ========================================================================== */

button,
.h-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--h-space-sm);
  padding: var(--h-space-sm) var(--h-space-md);
  font-family: inherit;
  font-size: var(--h-text-base);
  font-weight: var(--h-weight-medium);
  color: var(--h-color-text-inverse);
  background-color: var(--h-color-primary);
  border: 1px solid var(--h-color-primary);
  border-radius: var(--h-radius-md);
  cursor: pointer;
  transition: background-color var(--h-transition-fast),
              border-color var(--h-transition-fast);
  margin-top: var(--h-space-md);
  text-decoration: none;
}

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

button:active,
.h-btn:active {
  background-color: var(--h-color-primary-dark);
  border-color: var(--h-color-primary-dark);
}

button:focus-visible,
.h-btn:focus-visible {
  outline: 2px solid var(--h-color-accent);
  outline-offset: 2px;
}

button:disabled,
.h-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Varianten */
.h-btn-secondary {
  background-color: var(--h-color-surface-dim);
  color: var(--h-color-text);
  border-color: var(--h-color-border);
}

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

.h-btn-ghost {
  background-color: transparent;
  color: var(--h-color-text);
  border-color: transparent;
}

.h-btn-ghost:hover {
  background-color: var(--h-color-surface-dim);
}

.h-btn-danger {
  background-color: var(--h-color-error);
  border-color: var(--h-color-error);
}

.h-btn-danger:hover {
  background-color: #8a2e30;
  border-color: #8a2e30;
}

.h-btn-success {
  background-color: var(--h-color-success);
  border-color: var(--h-color-success);
}

.h-btn-success:hover {
  background-color: #3d6a4b;
  border-color: #3d6a4b;
}

/* Sizes */
.h-btn-sm {
  padding: var(--h-space-xs) var(--h-space-sm);
  font-size: var(--h-text-sm);
}

.h-btn-lg {
  padding: var(--h-space-md) var(--h-space-lg);
  font-size: var(--h-text-lg);
}

/* Geen margin-top als in een button-container */
.button-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--h-space-md);
  margin-top: var(--h-space-lg);
}

.button-container button,
.button-container .h-btn {
  margin-top: 0;
}


/* ==========================================================================
   7. CARDS & CONTAINERS
   ========================================================================== */

/* Standaard card */
.h-card,
.wide-container,
.medium-container,
.small-container {
  border: var(--h-border);
  border-radius: var(--h-radius-lg);
  background-color: var(--h-color-surface);
  box-shadow: var(--h-shadow-sm);
  overflow: hidden;
}

.h-card {
  padding: var(--h-space-lg);
}

/* Wide container — volledige breedte */
.wide-container {
  margin-top: var(--h-space-xl);
  width: 100%;
}

/* Medium container — module kaarten */
.medium-container {
  width: 100%;
  min-width: 250px;
  max-width: 800px;
  transition: box-shadow 0.2s ease;
}

.medium-container:hover {
  box-shadow: var(--h-shadow-md);
}

/* Small container */
.small-container {
  width: 200px;
  padding: var(--h-space-lg);
  text-align: left;
  font-size: var(--h-text-base);
  display: flex;
  flex-direction: column;
}

/* Transparent wide container */
.transparent-wide-container {
  margin-top: var(--h-space-xl);
  padding: var(--h-space-lg);
  width: 100%;
  max-width: var(--h-content-width);
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--h-space-lg);
}

/* Block container */
.block-container {
  margin: var(--h-space-xl);
  padding: var(--h-space-lg);
  border-radius: var(--h-radius-lg);
  background-color: var(--h-color-surface-dim);
  width: 500px;
  box-shadow: var(--h-shadow-sm);
}

/* Hub container */
.hub-container {
  display: block;
  width: 100%;
  border: var(--h-border);
  border-radius: var(--h-radius-lg);
  margin: var(--h-space-lg);
}

/* Container / Card header — donkere titel balk */
.container-header,
.h-section-header {
  background-color: var(--h-color-primary);
  color: var(--h-color-text-inverse);
  padding: var(--h-space-md) var(--h-space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.container-header h2,
.h-section-header h2 {
  margin: 0;
  font-size: var(--h-text-base);
  font-weight: var(--h-weight-semibold);
  color: inherit;
}

/* Container / Card footer */
.container-footer,
.h-section-footer {
  background-color: var(--h-color-primary);
  color: var(--h-color-text-inverse);
  padding: var(--h-space-sm) var(--h-space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.container-footer h3,
.h-section-footer h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: var(--h-weight-medium);
  color: inherit;
}

/* Container content */
.container-content,
.h-card-body {
  padding: var(--h-space-lg);
}

/* Container title */
.container-title {
  margin: 0;
  font-size: var(--h-text-base);
  font-weight: var(--h-weight-semibold);
}

/* Conductor elements */
.conductor-elements-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--h-space-md);
}

.values-and-actuators {
  width: 100px;
}


/* ==========================================================================
   8. PAGE TITLE
   ========================================================================== */

.title-header {
  font-size: var(--h-text-2xl);
  font-weight: var(--h-weight-semibold);
  color: var(--h-color-text);
  margin: var(--h-space-xl) 0 var(--h-space-lg) 0;
  padding: var(--h-space-lg) var(--h-space-xl);
  background: linear-gradient(135deg, 
    var(--h-color-surface) 0%, 
    var(--h-color-surface-dim) 100%);
  border: 1px solid var(--h-color-border);
  border-left: 4px solid var(--h-color-primary);
  border-radius: var(--h-radius-lg);
  display: flex;
  align-items: center;
  gap: var(--h-space-md);
  flex-wrap: wrap;
  box-shadow: var(--h-shadow-sm);
  position: relative;
  letter-spacing: -0.01em;
  transition: all var(--h-transition-normal);
}

.title-header:hover {
  box-shadow: var(--h-shadow-md);
  border-color: var(--h-color-border-strong);
}

.title-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--h-color-primary-light) 50%, 
    transparent 100%);
  opacity: 0.3;
}

.title-header .title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--h-color-primary);
  color: var(--h-color-text-inverse);
  border-radius: var(--h-radius-md);
  font-size: var(--h-text-lg);
  margin-right: var(--h-space-sm);
}

.title-header .title-subtitle {
  font-size: var(--h-text-sm);
  color: var(--h-color-text-secondary);
  font-weight: var(--h-weight-normal);
  margin-left: auto;
  padding-left: var(--h-space-md);
  border-left: 1px solid var(--h-color-border);
}

.title-header .title-actions {
  margin-left: auto;
  display: flex;
  gap: var(--h-space-sm);
  align-items: center;
}

/* Responsive adjustments for title-header */
@media (max-width: 768px) {
  .title-header {
    padding: var(--h-space-md);
    margin: var(--h-space-lg) 0 var(--h-space-md) 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--h-space-sm);
  }
  
  .title-header .title-subtitle {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--h-color-border);
    padding-top: var(--h-space-sm);
    width: 100%;
  }
  
  .title-header .title-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}


/* ==========================================================================
   9. PAGE PATTERNS
   ========================================================================== */

/* Introductie blok bovenaan pagina's */
.h-page-intro,
.page-intro {
  background-color: var(--h-color-surface-dim);
  padding: var(--h-space-md);
  margin-bottom: var(--h-space-lg);
  border-radius: var(--h-radius-lg);
  border-left: 4px solid var(--h-color-info);
}

.h-page-intro p,
.page-intro p {
  margin: var(--h-space-sm) 0;
  color: var(--h-color-text);
}

.h-page-intro a,
.page-intro a {
  color: var(--h-color-info);
  font-weight: var(--h-weight-semibold);
}

.h-page-intro a:hover,
.page-intro a:hover {
  text-decoration: underline;
}

/* Lege state */
.h-empty-state,
.empty-state {
  text-align: center;
  padding: var(--h-space-2xl) var(--h-space-lg);
  color: var(--h-color-text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--h-space-lg);
  opacity: 0.3;
}

.empty-state-text {
  font-size: var(--h-text-xl);
  margin-bottom: var(--h-space-sm);
}

.empty-state-hint {
  font-size: var(--h-text-sm);
  margin-bottom: var(--h-space-lg);
}

/* Insight card — aha-momenten */
.h-insight,
.insight {
  background: var(--h-color-surface-dim);
  border-left: 3px solid var(--h-color-accent);
  padding: var(--h-space-md);
  border-radius: 0 var(--h-radius-lg) var(--h-radius-lg) 0;
  margin: var(--h-space-md) 0;
}

/* Legend section */
.legend-section {
  margin-top: var(--h-space-2xl);
  padding: var(--h-space-xl);
  background-color: var(--h-color-surface-dim);
  border-radius: var(--h-radius-lg);
  border: var(--h-border);
}


/* ==========================================================================
   10. COLLAPSIBLE SECTIONS
   ========================================================================== */

.h-collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: var(--h-space-sm);
  border-radius: var(--h-radius-sm);
  transition: background-color 0.2s ease;
}

.h-collapsible-header:hover {
  background-color: var(--h-color-surface-dim);
}

.h-collapsible-content {
  display: none;
  margin-top: var(--h-space-md);
  padding-top: var(--h-space-md);
  border-top: var(--h-border);
}

.h-collapsible-content.expanded {
  display: block;
}

.h-collapsible-content.collapsed {
  display: none;
}

.h-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.h-chevron.expanded {
  transform: rotate(90deg);
}


/* ==========================================================================
   11. STATUS INDICATORS
   ========================================================================== */

.h-status {
  display: inline-flex;
  align-items: center;
  gap: var(--h-space-sm);
  font-size: var(--h-text-sm);
}

.h-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--h-color-off);
}

.h-status.online::before  { background-color: var(--h-color-success); }
.h-status.warning::before { background-color: var(--h-color-warning); }
.h-status.offline::before { background-color: var(--h-color-error); }
.h-status.pending::before { background-color: var(--h-color-warning); }

/* Badges */
.h-badge {
  display: inline-block;
  font-size: var(--h-text-xs);
  padding: 2px 8px;
  border-radius: var(--h-radius-full);
  font-weight: var(--h-weight-medium);
}

.h-badge-success {
  background-color: rgba(74, 124, 89, 0.1);
  color: var(--h-color-success);
}

.h-badge-warning {
  background-color: rgba(184, 134, 11, 0.1);
  color: var(--h-color-warning);
}

.h-badge-error {
  background-color: rgba(166, 61, 64, 0.1);
  color: var(--h-color-error);
}

.h-badge-info {
  background-color: rgba(74, 111, 165, 0.1);
  color: var(--h-color-info);
}

.h-badge-neutral {
  background-color: var(--h-color-surface-dim);
  color: var(--h-color-text-secondary);
}

/* Role indicators */
.role-indicator {
  font-size: var(--h-text-xs);
  padding: 0.25rem 0.75rem;
  border-radius: var(--h-radius-full);
  font-weight: var(--h-weight-medium);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.role-indicator::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}

.role-indicator.admin {
  background-color: #fdf2f8;
  color: #9d174d;
}
.role-indicator.admin::before {
  background-color: #9d174d;
}

.role-indicator.editor {
  background-color: #eff6ff;
  color: #1e40af;
}
.role-indicator.editor::before {
  background-color: #1e40af;
}

.role-indicator.user {
  background-color: #f0fdf4;
  color: #166534;
}
.role-indicator.user::before {
  background-color: #166534;
}

.role-indicator.guest {
  background-color: var(--h-color-surface-dim);
  color: var(--h-color-text-secondary);
}
.role-indicator.guest::before {
  background-color: var(--h-color-text-muted);
}


/* ==========================================================================
   12. FORMS
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: var(--h-space-sm) var(--h-space-md);
  font-family: inherit;
  font-size: var(--h-text-base);
  color: var(--h-color-text);
  background-color: var(--h-color-surface);
  border: 1px solid var(--h-color-border);
  border-radius: var(--h-radius-md);
  transition: border-color var(--h-transition-fast),
              box-shadow var(--h-transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--h-color-primary);
  box-shadow: 0 0 0 3px rgba(61, 90, 91, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--h-color-text-muted);
}

label {
  display: block;
  font-size: var(--h-text-sm);
  font-weight: var(--h-weight-medium);
  color: var(--h-color-text-secondary);
  margin-bottom: var(--h-space-xs);
}

.form-group {
  margin-bottom: var(--h-space-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--h-space-md);
}


/* ==========================================================================
   13. TABLES
   ========================================================================== */

.h-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--h-text-sm);
}

.h-table th {
  background-color: var(--h-color-surface-dim);
  padding: var(--h-space-sm) var(--h-space-md);
  text-align: left;
  font-weight: var(--h-weight-semibold);
  color: var(--h-color-text-secondary);
  border-bottom: 2px solid var(--h-color-border);
}

.h-table td {
  padding: var(--h-space-sm) var(--h-space-md);
  border-bottom: 1px solid var(--h-color-border);
}

.h-table tr:hover {
  background-color: var(--h-color-surface-dim);
}


/* ==========================================================================
   14. MODALS
   ========================================================================== */

.h-modal-overlay,
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--h-z-modal);
}

.h-modal-overlay.active,
.modal.active {
  display: flex;
}

.h-modal,
.modal-content {
  background: var(--h-color-surface);
  border-radius: var(--h-radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--h-shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--h-space-lg);
  border-bottom: var(--h-border);
  font-size: var(--h-text-xl);
  font-weight: var(--h-weight-semibold);
}

.modal-body {
  padding: var(--h-space-lg);
}

.modal-actions {
  display: flex;
  gap: var(--h-space-sm);
  justify-content: flex-end;
  padding: var(--h-space-md) var(--h-space-lg);
  border-top: var(--h-border);
}


/* ==========================================================================
   15. NOTIFICATIONS
   ========================================================================== */

.h-notification,
.notification {
  position: fixed;
  bottom: var(--h-space-xl);
  right: var(--h-space-xl);
  padding: var(--h-space-md) var(--h-space-lg);
  background: var(--h-color-surface);
  border-radius: var(--h-radius-md);
  box-shadow: var(--h-shadow-lg);
  z-index: var(--h-z-tooltip);
  animation: h-slide-in 0.3s ease-out;
}

.notification.success { border-left: 4px solid var(--h-color-success); }
.notification.error   { border-left: 4px solid var(--h-color-error); }
.notification.warning { border-left: 4px solid var(--h-color-warning); }

@keyframes h-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}


/* ==========================================================================
   16. TOOLTIPS & INFO
   ========================================================================== */

.info-icon {
  cursor: pointer;
  margin-left: 5px;
  position: relative;
  opacity: 0.6;
  transition: opacity var(--h-transition-fast);
}

.info-icon:hover {
  opacity: 1;
}

.description-tooltip {
  background-color: var(--h-color-surface);
  border: var(--h-border);
  padding: var(--h-space-md);
  border-radius: var(--h-radius-lg);
  box-shadow: var(--h-shadow-lg);
  z-index: var(--h-z-tooltip);
  max-width: 400px;
  display: none;
  font-size: var(--h-text-sm);
  line-height: var(--h-leading-normal);
}

.description-tooltip.active {
  display: block;
}


/* ==========================================================================
   17. SLIDERS
   ========================================================================== */

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--h-color-border);
  outline: none;
  margin: var(--h-space-md) 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--h-color-primary);
  cursor: pointer;
  border: 3px solid var(--h-color-surface);
  box-shadow: var(--h-shadow-md);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--h-color-primary);
  cursor: pointer;
  border: 3px solid var(--h-color-surface);
  box-shadow: var(--h-shadow-md);
}


/* ==========================================================================
   18. HOMER-SPECIFIEK — Domotica componenten
   ========================================================================== */

/* Temperatuur display */
.temperature {
  font-size: 2rem;
  font-weight: var(--h-weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.temperature-unit {
  font-size: var(--h-text-base);
  font-weight: var(--h-weight-normal);
  color: var(--h-color-text-secondary);
}

/* Value display */
.value-display {
  font-size: var(--h-text-xl);
  font-weight: var(--h-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.value-unit {
  font-size: var(--h-text-sm);
  font-weight: var(--h-weight-normal);
  color: var(--h-color-text-secondary);
  margin-left: 2px;
}

.value-label {
  font-size: var(--h-text-sm);
  color: var(--h-color-text-secondary);
  margin-bottom: var(--h-space-xs);
}

/* Quick action buttons */
.quick-actions {
  display: flex;
  gap: var(--h-space-sm);
  flex-wrap: wrap;
}

.quick-action {
  padding: var(--h-space-sm) var(--h-space-md);
  font-size: var(--h-text-sm);
  font-weight: var(--h-weight-medium);
  background: var(--h-color-surface-dim);
  border: 1px solid var(--h-color-border);
  border-radius: var(--h-radius-md);
  color: var(--h-color-text);
  cursor: pointer;
  transition: all var(--h-transition-fast);
  margin-top: 0;
}

.quick-action:hover {
  background: var(--h-color-surface);
  border-color: var(--h-color-primary);
}

.quick-action.active {
  background: var(--h-color-primary);
  border-color: var(--h-color-primary);
  color: var(--h-color-text-inverse);
}


/* ==========================================================================
   19. UTILITY CLASSES
   ========================================================================== */

/* Display */
.h-flex         { display: flex; }
.h-flex-col     { display: flex; flex-direction: column; }
.h-flex-wrap    { flex-wrap: wrap; }
.h-inline-flex  { display: inline-flex; }
.h-grid         { display: grid; }
.h-hidden       { display: none; }

/* Alignment */
.h-items-center    { align-items: center; }
.h-items-start     { align-items: flex-start; }
.h-items-end       { align-items: flex-end; }
.h-justify-center  { justify-content: center; }
.h-justify-between { justify-content: space-between; }
.h-justify-end     { justify-content: flex-end; }

/* Gap */
.h-gap-xs  { gap: var(--h-space-xs); }
.h-gap-sm  { gap: var(--h-space-sm); }
.h-gap-md  { gap: var(--h-space-md); }
.h-gap-lg  { gap: var(--h-space-lg); }
.h-gap-xl  { gap: var(--h-space-xl); }

/* Padding */
.h-p-xs   { padding: var(--h-space-xs); }
.h-p-sm   { padding: var(--h-space-sm); }
.h-p-md   { padding: var(--h-space-md); }
.h-p-lg   { padding: var(--h-space-lg); }
.h-p-xl   { padding: var(--h-space-xl); }

.h-px-sm  { padding-left: var(--h-space-sm); padding-right: var(--h-space-sm); }
.h-px-md  { padding-left: var(--h-space-md); padding-right: var(--h-space-md); }
.h-px-lg  { padding-left: var(--h-space-lg); padding-right: var(--h-space-lg); }

.h-py-sm  { padding-top: var(--h-space-sm); padding-bottom: var(--h-space-sm); }
.h-py-md  { padding-top: var(--h-space-md); padding-bottom: var(--h-space-md); }
.h-py-lg  { padding-top: var(--h-space-lg); padding-bottom: var(--h-space-lg); }

/* Margin */
.h-m-0    { margin: 0; }
.h-m-sm   { margin: var(--h-space-sm); }
.h-m-md   { margin: var(--h-space-md); }
.h-m-lg   { margin: var(--h-space-lg); }

.h-mt-0   { margin-top: 0; }
.h-mt-sm  { margin-top: var(--h-space-sm); }
.h-mt-md  { margin-top: var(--h-space-md); }
.h-mt-lg  { margin-top: var(--h-space-lg); }
.h-mt-xl  { margin-top: var(--h-space-xl); }

.h-mb-0   { margin-bottom: 0; }
.h-mb-sm  { margin-bottom: var(--h-space-sm); }
.h-mb-md  { margin-bottom: var(--h-space-md); }
.h-mb-lg  { margin-bottom: var(--h-space-lg); }

/* Text */
.h-text-center    { text-align: center; }
.h-text-left      { text-align: left; }
.h-text-right     { text-align: right; }
.h-text-muted     { color: var(--h-color-text-muted); }
.h-text-secondary { color: var(--h-color-text-secondary); }
.h-text-success   { color: var(--h-color-success); }
.h-text-warning   { color: var(--h-color-warning); }
.h-text-error     { color: var(--h-color-error); }
.h-font-mono      { font-family: var(--h-font-mono); }
.h-font-bold      { font-weight: var(--h-weight-bold); }
.h-font-semibold  { font-weight: var(--h-weight-semibold); }

/* Sizing */
.h-w-full  { width: 100%; }
.h-w-auto  { width: auto; }

/* Border */
.h-border     { border: var(--h-border); }
.h-border-b   { border-bottom: var(--h-border); }
.h-border-t   { border-top: var(--h-border); }
.h-rounded    { border-radius: var(--h-radius-lg); }
.h-rounded-sm { border-radius: var(--h-radius-sm); }

/* Overflow */
.h-overflow-hidden { overflow: hidden; }
.h-overflow-auto   { overflow: auto; }

/* Cursor */
.h-cursor-pointer { cursor: pointer; }
.h-cursor-grab    { cursor: grab; }

/* Legacy compat utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--h-space-sm); }
.gap-md { gap: var(--h-space-md); }
.gap-lg { gap: var(--h-space-lg); }
.text-center { text-align: center; }
.text-muted { color: var(--h-color-text-muted); }
.text-secondary { color: var(--h-color-text-secondary); }


/* ==========================================================================
   20. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  main {
    padding: var(--h-space-md);
  }

  #main {
    grid-template-columns: 1fr;
    gap: var(--h-space-md);
    padding: var(--h-space-md);
  }

  .title-header {
    font-size: var(--h-text-xl);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--h-space-sm);
  }

  .conductor-header,
  .flex,
  .h-flex {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Mobiele navigatie */
  .hamburger {
    display: block;
    z-index: calc(var(--h-z-fixed) + 1);
  }

  .nav-menu {
    display: none;
    position: fixed;
    top: var(--h-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--h-color-primary);
    flex-direction: column;
    padding: var(--h-space-md);
    gap: var(--h-space-xs);
    overflow-y: auto;
    z-index: var(--h-z-fixed);
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-item:last-child {
    border-bottom: none;
  }

  .nav-link {
    padding: var(--h-space-md);
    font-size: var(--h-text-base);
    border-radius: var(--h-radius-lg);
  }

  /* Mobiel submenu */
  .submenu {
    display: none;
    position: static;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: none;
    border-radius: var(--h-radius-lg);
    margin: var(--h-space-xs) 0;
    padding: var(--h-space-xs);
  }

  .has-submenu.active .submenu {
    display: block;
  }

  .submenu .nav-link {
    color: var(--h-color-text-inverse);
    padding: var(--h-space-sm) var(--h-space-md);
  }

  .submenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--h-color-text-inverse);
  }

  .submenu li.active .nav-link {
    background: rgba(255, 255, 255, 0.15);
    color: var(--h-color-accent);
  }

  .has-submenu > .nav-link {
    flex-direction: column;
    align-items: flex-start;
  }

  .active-submenu-text {
    font-size: var(--h-text-sm);
    margin-top: 2px;
    color: var(--h-color-accent);
    margin-left: 0;
  }

  /* Mobiel logout */
  .logout {
    margin-left: 0;
    margin-top: auto;
    padding-top: var(--h-space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-item.logout .nav-link {
    justify-content: flex-start;
  }

  /* Mobiele containers */
  .medium-container {
    min-width: 100%;
  }

  .wide-container,
  .medium-container,
  .small-container,
  .block-container {
    margin: var(--h-space-sm) 0;
  }

  .block-container {
    width: 100%;
    margin: var(--h-space-md) 0;
  }

  .button-container {
    flex-direction: column;
    width: 100%;
  }

  .button-container button {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .h-modal-content {
        width: 95%;
        padding: var(--h-space-lg, 1.5rem);
    }
    
    .h-modal-footer {
        flex-direction: column;
    }
    
    .h-modal-footer button {
        width: 100%;
    }
}

@media (max-width: 480px) {
  header {
    padding: 0 var(--h-space-md);
  }

  .container,
  .container-content,
  .h-card-body {
    padding: var(--h-space-md);
  }

  .container-header,
  .h-section-header {
    padding: var(--h-space-sm) var(--h-space-md);
  }

  .title-header {
    font-size: var(--h-text-lg);
    padding-bottom: var(--h-space-sm);
    margin: var(--h-space-md) 0;
  }

  .h-modal-content {
        width: 98%;
        padding: var(--h-space-md, 1rem);
        max-height: 95vh;
    }
    
    .h-modal-header h3 {
        font-size: var(--h-text-lg, 1.25rem);
    }
}   

/* ========================================
   MODAL SYSTEM
   ========================================
   Universele modal styling voor hele Homer systeem
   Gebruik: Voeg dit toe aan homer.css
   ======================================== */

/* Modal Overlay */
.h-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    animation: h-modal-fade-in 0.2s ease-out;
}

.h-modal-overlay.active {
    display: flex;
}

/* Modal Content Container */
.h-modal-content {
    background: var(--h-color-surface, white);
    padding: var(--h-space-xl, 2rem);
    border-radius: var(--h-radius-lg, 12px);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--h-shadow-lg, 0 8px 32px rgba(0,0,0,0.3));
    position: relative;
    animation: h-modal-slide-up 0.3s ease-out;
}

.h-modal-content.h-modal-wide {
    max-width: 800px;
}

.h-modal-content.h-modal-narrow {
    max-width: 400px;
}

/* Modal Header */
.h-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--h-space-lg, 1.5rem);
    padding-bottom: var(--h-space-md, 1rem);
    border-bottom: 2px solid var(--h-color-border, #e9ecef);
}

.h-modal-header h3 {
    margin: 0;
    color: var(--h-color-text, #333);
    font-size: var(--h-text-xl, 1.5rem);
    font-weight: 600;
}

/* Modal Close Button */
.h-modal-close {
    cursor: pointer;
    font-size: 1.8rem;
    color: var(--h-color-text-muted, #666);
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.h-modal-close:hover {
    background: var(--h-color-surface-hover, #f8f9fa);
    color: var(--h-color-text, #333);
}

/* Modal Body */
.h-modal-body {
    margin-bottom: var(--h-space-lg, 1.5rem);
}

/* Modal Footer */
.h-modal-footer {
    display: flex;
    gap: var(--h-space-md, 1rem);
    justify-content: flex-end;
    margin-top: var(--h-space-xl, 2rem);
    padding-top: var(--h-space-md, 1rem);
    border-top: 2px solid var(--h-color-border, #e9ecef);
}

/* Form Groups in Modals */
.h-modal-form-group {
    margin-bottom: var(--h-space-lg, 1.25rem);
}

.h-modal-form-group label {
    display: block;
    margin-bottom: var(--h-space-sm, 0.5rem);
    font-weight: 600;
    color: var(--h-color-text, #333);
    font-size: var(--h-text-base, 0.95rem);
}

.h-modal-form-group label .required {
    color: var(--h-color-danger, red);
}

.h-modal-form-group input[type="text"],
.h-modal-form-group input[type="number"],
.h-modal-form-group input[type="email"],
.h-modal-form-group input[type="password"],
.h-modal-form-group textarea,
.h-modal-form-group select {
    width: 100%;
    padding: var(--h-space-sm, 0.75rem);
    border: 1px solid var(--h-color-border, #ccc);
    border-radius: var(--h-radius-md, 6px);
    font-size: var(--h-text-base, 1rem);
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.h-modal-form-group input:focus,
.h-modal-form-group textarea:focus,
.h-modal-form-group select:focus {
    outline: none;
    border-color: var(--h-color-primary, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.h-modal-form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.h-modal-form-group input[readonly] {
    background: var(--h-color-surface-secondary, #f8f9fa);
    font-family: monospace;
}

/* Checkbox Group in Modal */
.h-modal-checkbox-group {
    padding: var(--h-space-md, 1rem);
    background: var(--h-color-surface-secondary, #f8f9fa);
    border-radius: var(--h-radius-md, 6px);
    border: 1px solid var(--h-color-border, #e9ecef);
}

.h-modal-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--h-space-sm, 0.75rem);
    margin-bottom: var(--h-space-sm, 0.5rem);
    cursor: pointer;
    padding: var(--h-space-xs, 0.5rem);
    border-radius: var(--h-radius-sm, 4px);
    transition: background 0.2s ease;
}

.h-modal-checkbox-label:last-child {
    margin-bottom: 0;
}

.h-modal-checkbox-label:hover {
    background: var(--h-color-surface-hover, #e9ecef);
}

.h-modal-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Info/Success Blocks in Modals */
.h-modal-info {
    padding: var(--h-space-md, 1rem);
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: var(--h-radius-md, 6px);
    margin-bottom: var(--h-space-lg, 1.5rem);
}

.h-modal-success {
    padding: var(--h-space-md, 1rem);
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: var(--h-radius-md, 6px);
    margin-bottom: var(--h-space-lg, 1.5rem);
}

.h-modal-warning {
    padding: var(--h-space-md, 1rem);
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--h-radius-md, 6px);
    margin-bottom: var(--h-space-lg, 1.5rem);
}

/* Code Block in Modal */
.h-modal-code {
    display: block;
    padding: var(--h-space-sm, 0.75rem);
    background: var(--h-color-surface, white);
    border-radius: var(--h-radius-sm, 4px);
    font-size: var(--h-text-sm, 0.85rem);
    font-family: monospace;
    overflow-x: auto;
    white-space: pre;
    border: 1px solid var(--h-color-border, #e9ecef);
}

/* Input with Button (for copy actions) */
.h-modal-input-group {
    display: flex;
    gap: var(--h-space-sm, 0.5rem);
}

.h-modal-input-group input {
    flex: 1;
}

.h-modal-input-group button {
    white-space: nowrap;
}

/* Animations */
@keyframes h-modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes h-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
