/* ============================================================
   Brand Variables
   ============================================================ */
.brand {
  /* Brand variables from Brandbook */
  --color-primary: #3ecfff;     /* Hoofdkleur */
  --color-sub: #e2e2e2;         /* Subkleur */
  --color-highlight: #355176;   /* Highlights */
  --radius: 12px;
  --gap: 12px;
}

:root {
  --gap: 12px;
  --radius: 12px;
}

/* ============================================================
   Global
   ============================================================ */
* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll; /* Avoid horizontal layout shifts when scrollbar appears */
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

body {
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
  background: #f7f7fb;
  color: #222;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  max-width: 100vw;
}

.wrap-scrollbar {
  min-height: 100vh;
}

.container {
  max-width: calc(100vw - 380px); /* Viewport width minus action bar and margins */
  width: 100%;
  margin: 0 auto;
  margin-right: 340px; /* Shift to the left to make room for action bar */
  padding: 24px;
  box-sizing: border-box;
}

@media (min-width: 1920px) {
  .container {
    max-width: 1800px;
    margin-right: 360px;
  }
}

@media (max-width: 1400px) {
  .container {
    max-width: calc(100vw - 360px);
    margin-right: 320px;
  }
}

@media (max-width: 1200px) {
  .container {
    max-width: calc(100vw - 340px);
    margin-right: 300px;
  }
}

h1,
h2 {
  margin: 0 0 12px;
}

/* ============================================================
   Buttons
   ============================================================ */
button {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
}

button:hover {
  background: #f2f2f2;
}

.btn-brand {
  background: var(--color-primary);
  color: #0b0b0b;
  border: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  box-shadow: 0 4px 8px rgba(56, 203, 255, 0.12);
}

.btn-outline-brand {
  background: transparent;
  color: #0b0b0b;
  border: 1px solid var(--color-sub);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.btn-ghost {
  background: white;
  border: 1px solid #eee;
}

/* View Person Button (Bekijken) */
.view-person-btn {
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
  background: white;
  transition: all 0.2s ease;
}

.view-person-btn:hover {
  background: var(--color-primary) !important;
  color: #0b0b0b !important;
  border-color: var(--color-primary) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(62, 207, 255, 0.3);
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash p {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
}

.flash .error {
  background: #ffe8e8;
  border: 1px solid #ffb3b3;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: white;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 18px rgba(53, 81, 118, 0.06);
}

.card-sm {
  padding: 12px;
}

.card-settings {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.card-settings:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-settings h2 {
  color: var(--color-highlight);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Inner settings sections */
.card-settings .card.bg-light {
  background: #f8f9fa !important;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
}

.card-settings .card.bg-light:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.card-settings .card.bg-light .h5 {
  color: var(--color-highlight);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ============================================================
   Grid Utilities
   ============================================================ */
.grid {
  display: grid;
  gap: var(--gap);
}

.grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

thead th {
  background: #fafafa;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  font-size: 12px;
}

/* Report summary badges */
.report-summary .badge {
  font-weight: 600;
  padding: 6px 10px;
  font-size: 13px;
}

.unfilled-slot {
  border-left: 4px solid #e74c3c;
  background: #fff6f6;
}

.unfilled-slot em {
  color: #c0392b;
}

/* ============================================================
   Form Inputs
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e6e6e6;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

label.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Range Slider Styling */
.form-range {
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, #e9ecef 0%, var(--color-primary) 100%);
  border-radius: 3px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.form-range::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Sidebar & Layout
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding-left: 220px;
}

.nav-tabs {
  border-bottom: none; /* remove cutting border */
}

.nav-tabs .nav-link {
  border: 1px solid #dee2e6;
  border-radius: 12px !important; /* match your --radius variable */
  margin-right: 6px;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-tabs .nav-link.active {
  background: #f8fbff;
  border-color: #dee2e6;
}

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid var(--color-sub);
  padding: 24px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar .material-icons {
  vertical-align: middle;
  font-size: 24px;
}

.sidebar .brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #355176;
  border-radius: 10px;
  text-decoration: none;
  margin-bottom: 6px;
}

.sidebar .nav-link .material-icons {
  flex-shrink: 0;
  align-self: center;
  margin-top: 2px;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  background: rgba(62, 207, 255, 0.08);
  color: var(--color-highlight);
}

.main {
  flex: 1;
  padding: 24px;
}

/* Mobile Header & Menu */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  border-bottom: 1px solid var(--color-sub);
  padding: 0 16px;
  align-items: center;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-brand {
  display: flex;
  align-items: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-menu-toggle,
.mobile-menu-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu-toggle:hover,
.mobile-menu-close:hover {
  background: rgba(62, 207, 255, 0.08);
}

.mobile-menu-toggle .material-icons,
.mobile-menu-close .material-icons {
  font-size: 28px;
  color: var(--color-highlight);
}

.mobile-menu-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-nav-overlay.active {
  opacity: 1;
}

/* ============================================================
   Personal Data
   ============================================================ */
.pd-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}

/* Ensure consistent widths between small add-worker form and main form */
.pd-grid .card form.row.g-2 {
  align-items: center;
}

.pd-grid .card form.row.g-2 .col-md-5 {
  flex: 0 0 40%;
}

.pd-grid .card form.row.g-2 .col-md-2 {
  flex: 0 0 20%;
}

.pd-form-card {
  padding: 20px;
}

.pd-side-card {
  padding: 20px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

/* ============================================================
   Availability Card
   ============================================================ */
.avail-day {
  border: 1px dashed #e6e9ef;
  border-radius: 10px;
}

/* ============================================================
   Tabs
   ============================================================ */
/* Modern Personal Data Tabs */
.personal-data-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: white;
  padding: 0.75rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(53, 81, 118, 0.08);
  border: 1px solid var(--color-sub);
  flex-wrap: wrap;
}

.pd-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--color-sub);
  background: white;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: var(--color-highlight);
  flex: 1;
  min-width: 150px;
  justify-content: center;
}

.pd-tab .material-icons {
  font-size: 20px;
}

.pd-tab:hover {
  border-color: var(--color-primary);
  background: rgba(62, 207, 255, 0.05);
  transform: translateY(-1px);
}

.pd-tab.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2bb8e8 100%);
  border-color: var(--color-primary);
  color: #0b0b0b;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(62, 207, 255, 0.3);
}

.pd-tab-content {
  position: relative;
}

.pd-tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.pd-tab-pane.active {
  display: block;
}

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

/* ============================================================
   Skills Grid
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.skill-item {
  position: relative;
}

.skill-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.skill-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-sub);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-weight: 500;
  color: var(--color-highlight);
}

.skill-icon {
  font-size: 20px;
  color: var(--color-sub);
  transition: all 0.2s ease;
}

.skill-text {
  flex: 1;
}

.skill-label:hover {
  border-color: var(--color-primary);
  background: rgba(62, 207, 255, 0.05);
  transform: translateY(-1px);
}

.skill-checkbox:checked + .skill-label {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2bb8e8 100%);
  border-color: var(--color-primary);
  color: #0b0b0b;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(62, 207, 255, 0.3);
}

.skill-checkbox:checked + .skill-label .skill-icon {
  color: #0b0b0b;
}

/* Form Check Cards */
.form-check-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 2px solid var(--color-sub);
  border-radius: var(--radius);
  background: white;
  transition: all 0.2s ease;
  height: 100%;
  cursor: pointer;
  user-select: none;
}

.form-check-card:hover {
  border-color: var(--color-primary);
  background: rgba(62, 207, 255, 0.05);
  transform: translateY(-1px);
}

.form-check-card:has(.form-check-input:checked) {
  background: rgba(62, 207, 255, 0.1);
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(62, 207, 255, 0.2);
}

.form-check-card .form-check-input {
  width: 22px;
  height: 22px;
  margin-right: 0.75rem;
  cursor: pointer;
  pointer-events: none;
  border: 2px solid var(--color-sub);
  border-radius: 6px;
  background-color: white;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.form-check-card .form-check-input:focus {
  outline: none;
  box-shadow: none;
}

.form-check-card .form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.form-check-card .form-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 500;
  color: var(--color-highlight);
  pointer-events: none;
}

.form-check-card .material-icons {
  font-size: 20px;
  color: var(--color-primary);
}

/* ============================================================
   Modal Enhancements
   ============================================================ */
.modal-content {
  border: 1px solid var(--color-sub);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(53, 81, 118, 0.15);
}

.modal-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border-bottom: 1px solid var(--color-sub);
  padding: 20px 24px;
}

.modal-title {
  color: var(--color-highlight);
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  background: #f7f7fb;
}

.modal-xl .modal-dialog {
  max-width: 1200px;
}

/* ============================================================
   Tabs & Tab Content
   ============================================================ */
.tab-fixed-height {
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.tab-fixed-height > .card,
.tab-fixed-height > .card-body {
  flex: 1;
}

.tab-content.tab-fixed-height {
  /* Allow the tab content to fill the parent card instead of being fixed 960px.
     This prevents a narrower inner white box and keeps the pane width aligned
     with the outer "Gegevens van ..." card. */
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

.tab-content.tab-fixed-height > .card,
.tab-content.tab-fixed-height > .card-body {
  width: 100%;
}

/* ============================================================
   Form Actions
   ============================================================ */
.form-actions {
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* ============================================================
   Calendar (Rooster Settings Page)
   ============================================================ */

.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calendar-week {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #f8f9fa;
  padding: 0.5rem;
}

.calendar-week-label {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.calendar-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.calendar-day {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  text-align: center;
  padding: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease-in-out;
}

.calendar-day.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.calendar-day.inactive {
  background-color: #dee2e6;
  color: #6c757d;
  border-color: #ced4da;
}

.calendar-day:hover {
  transform: scale(1.05);
}

.calendar-day.past {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
}

.day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9rem;
}

/* ============================================================
   Skills
   ============================================================ */
.tab-pane #skills-list,
.tab-pane .btn-group[aria-label="Skills"] {
  max-height: 180px;
  overflow-y: auto;
  display: block;
}

.skill-item {
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.skill-item:hover:not(.skill-disabled) {
  transform: translateY(-1px);
}

.skill-disabled {
  opacity: 0.5;
  filter: grayscale(50%);
}

.skill-disabled:hover {
  opacity: 0.6;
}

.skill-color-picker {
  cursor: pointer;
  appearance: none;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.skill-color-picker:hover {
  transform: scale(1.05);
}

.skill-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.skill-color-picker::-webkit-color-swatch,
.skill-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

/* ============================================================
   Calendar (Rooster Page)
   ============================================================ */
.calendar-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.calendar-table {
  display: flex;
  flex-direction: column;
  min-width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.calendar-header {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.time-header,
.time-column {
  width: 70px;
  background: #fafafa;
  border-right: 1px solid #eee;
}

.calendar-body {
  display: flex;
}

.function-column {
  position: relative;
  padding-top: 250px;
  flex: 1;
  min-height: 1200px;
  border-right: 2px solid rgba(0, 0, 0, 0.05);
  transition: flex 0.4s ease, width 0.4s ease, background-color 0.3s ease;
  background: color-mix(in srgb, var(--functie-color) 8%, white);
}

.function-column.expanded {
  background: color-mix(in srgb, var(--functie-color) 8%, white);
}

.function-column.collapsed {
  flex: 0.1;
  opacity: 0.9;
  overflow: hidden;
}

.event-block {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 0.75rem;
  padding: 0.4rem 0.6rem 2rem 0.9rem; /* Increased bottom padding to make room for button */
  font-size: 0.8rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.08);
  background: var(--functie-color, #e3e3e3);
  overflow: visible;
  color: #222;
  transition: box-shadow 0.2s ease;
  cursor: pointer;
  /* Overlap handling properties */
  --overlap-count: 1;
  --overlap-index: 0;
  --overlap-gap: 4px;
  width: calc((100% - 16px - (var(--overlap-gap) * (var(--overlap-count) - 1))) / var(--overlap-count));
  left: calc(8px + ((100% - 16px) / var(--overlap-count)) * var(--overlap-index) + (var(--overlap-gap) * var(--overlap-index)));
}

.event-block:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.event-change-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.75rem;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-highlight);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  opacity: 0.4;
}

.event-change-btn .material-icons {
  font-size: 14px;
}

/* Hide text for small slots */
.event-block[style*="height:"] .event-change-text {
  display: inline;
}

.event-block .event-change-btn {
  padding: 4px 8px;
}

/* For slots smaller than 60px, show only icon */
@container (max-height: 60px) {
  .event-change-text {
    display: none;
  }
  .event-change-btn {
    padding: 4px;
  }
}

/* Fallback for browsers without container queries */
.event-block {
  container-type: size;
  container-name: event-slot;
}

/* Additional fallback using height calculation */
.event-block[style*="height: 50px"] .event-change-text,
.event-block[style*="height: 40px"] .event-change-text,
.event-block[style*="height: 30px"] .event-change-text,
.event-block[style*="height: 20px"] .event-change-text {
  display: none !important;
}

.event-block[style*="height: 50px"] .event-change-btn,
.event-block[style*="height: 40px"] .event-change-btn,
.event-block[style*="height: 30px"] .event-change-btn,
.event-block[style*="height: 20px"] .event-change-btn {
  padding: 4px !important;
}

/* Reduce bottom padding for very small slots */
.event-block[style*="height: 50px"],
.event-block[style*="height: 40px"],
.event-block[style*="height: 30px"],
.event-block[style*="height: 20px"] {
  padding-bottom: 1.6rem !important;
}

.event-block:hover .event-change-btn {
  opacity: 1;
}

.event-change-btn:hover {
  background: var(--color-primary);
  color: #0b0b0b;
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(62, 207, 255, 0.3);
  opacity: 1 !important;
}

.event-block::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  background: var(--event-bar-color, rgba(0,0,0,0.08));
  border-top-left-radius: 0.75rem;
  border-bottom-left-radius: 0.75rem;
}

.event-names {
  font-weight: 600;
  color: var(--event-text-color, inherit);
}

.event-time, .text-muted.small {
  color: var(--event-text-color, inherit);
  font-size: 0.72rem;
}

/* ============================================================
   Week and Day Navigation Combined
   ============================================================ */
.week-day-navigation {
  margin-bottom: 2rem;
  background: white;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(53, 81, 118, 0.08);
  border: 1px solid var(--color-sub);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.week-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-sub);
}

.week-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  background: white;
  color: var(--color-highlight);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.week-nav-btn:hover {
  background: var(--color-primary);
  color: #0b0b0b;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(62, 207, 255, 0.3);
}

.week-nav-btn .material-icons {
  font-size: 24px;
}

.week-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 200px;
  text-align: center;
}

.week-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-highlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.week-range {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-highlight);
}

/* ============================================================
   Day Tabs
   ============================================================ */
.day-tabs-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 0.25rem 0;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.day-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.day-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  max-width: 90px;
  flex: 0 1 auto;
  height: 80px;
  background: white;
  border: 2px solid var(--color-sub);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.5rem;
  gap: 0.25rem;
}

.day-tab:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(62, 207, 255, 0.2);
}

.day-tab.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2bb8e8 100%);
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(62, 207, 255, 0.3);
  transform: translateY(-2px);
}

.day-tab.active .day-tab-weekday,
.day-tab.active .day-tab-date {
  color: #0b0b0b;
}

.day-tab.past-day {
  opacity: 0.5;
  background: #f5f5f5;
}

.day-tab.past-day:hover {
  opacity: 0.7;
}

.day-tab-weekday {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--color-highlight);
  opacity: 0.8;
}

.day-tab-date {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-highlight);
  line-height: 1;
}

.date-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.date-tab .weekday {
  font-size: 0.8rem;
  text-transform: lowercase;
  opacity: 0.7;
}

.date-tab .daynum {
  font-weight: 700;
  font-size: 1rem;
}

/* Past day styling */
.date-tab.past-day {
  opacity: 0.5;
}

.past-day-content {
  opacity: 0.7;
  position: relative;
}

.past-day-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  );
  pointer-events: none;
  z-index: 1;
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

/* ============================================================
   Calendar Accordion Behavior
   ============================================================ */

.function-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: flex 0.4s ease, width 0.4s ease;
  border-right: 1px solid #eee;
}

/* Collapsed = thin colored bar */
.function-wrapper.collapsed {
  flex: 0.08;
  overflow: hidden;
  opacity: 1;
}

.function-wrapper.collapsed .function-header {
  height: 100%;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: var(--functie-color);
  color: white;
  border: none;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Hide slots when collapsed */
.function-wrapper.collapsed .function-column {
  display: none;
}

/* Expanded style */
.function-wrapper:not(.collapsed) {
  flex: 1;
}

.function-header {
  background: #f8f9fa;
  border-top: 3px solid var(--functie-color);
  padding: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.function-header.active {
  background: rgba(62, 207, 255, 0.12);
  font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--color-primary);
}

/* ============================================================
   Action Bar - Redesigned to match mockup
   ============================================================ */
.action-bar {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  background: #f5f5f5;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(53, 81, 118, 0.12);
  padding: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 280px;
  min-height: 500px;
}

.action-bar-header {
  padding: 20px 24px;
  font-size: 1.5em;
  font-weight: 700;
  color: var(--color-highlight);
  border-bottom: none;
  background: #f5f5f5;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
  position: relative;
}

.action-bar-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 30px;
  right: 30px;
  height: 1px;
  background: var(--color-sub);
}

.action-bar-content {
  flex: 1;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #f5f5f5;
}

.action-bar-bottom {
  padding: 0;
  background: #f5f5f5;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: auto;
}

.btn-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lato', Arial, sans-serif;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.95em;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  cursor: pointer;
  outline: none;
  width: 100%;
  text-decoration: none;
  text-align: center;
}

.btn-action-bar:hover,
.btn-action-bar:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

/* Specific button colors */
.btn-action-bar.info {
  background: #ffffff;
  color: var(--color-highlight);
  border: 1px solid var(--color-sub);
}

.btn-action-bar.info:hover,
.btn-action-bar.info:focus {
  background: rgba(62, 207, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--color-highlight);
}

.btn-action-bar.reset {
  background: #ffffff;
  color: var(--color-highlight);
  border: 1px solid var(--color-sub);
}

.btn-action-bar.reset:hover,
.btn-action-bar.reset:focus {
  background: rgba(62, 207, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--color-highlight);
}

.btn-action-bar.danger {
  background: #ffffff;
  color: #ff4d4f;
  border: 1px solid var(--color-sub);
}

.btn-action-bar.danger:hover,
.btn-action-bar.danger:focus {
  background: #fff5f5;
  border-color: #ff4d4f;
}

.btn-action-bar.generate {
  background: #61FF73;
  color: #0b0b0b;
  font-size: 1.1em;
  font-weight: 700;
  border-radius: 20px 20px var(--radius) var(--radius);
  box-shadow: 0 -2px 12px rgba(97, 255, 115, 0.2);
  padding: 18px 20px;
  width: 100%;
  text-align: center;
  transition: background 0.3s, box-shadow 0.3s, transform 0.1s;
  border: none;
  margin: 0;
}

.btn-action-bar.generate:hover,
.btn-action-bar.generate:focus {
  background: #4fee5f;
  color: #0b0b0b;
  transform: translateY(0px);
  box-shadow: 0 -4px 16px rgba(97, 255, 115, 0.3);
}


/* ============================================================
   Responsive
   ============================================================ */

/* Medium screens (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: calc(100vw - 320px);
    margin-right: 280px;
  }
  
  /* Skills Grid Tablet */
  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Tablet and below (768px) */
@media (max-width: 768px) {
  .pd-grid {
    grid-template-columns: 1fr;
  }
  
  /* Reset container on mobile */
  .container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 16px !important;
  }
  
  /* Combined Week and Day Navigation Mobile */
  .week-day-navigation {
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .week-navigation {
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    max-width: 100%;
  }
  
  /* Calendar Mobile */
  .calendar-scroll-wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
  }
  
  .calendar-table {
    max-width: 100% !important;
  }
  
  /* Personal Data Tabs Mobile */
  .personal-data-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .pd-tab {
    min-width: 100%;
    justify-content: flex-start;
    padding: 0.65rem 1rem;
  }
  
  .pd-tab .material-icons {
    font-size: 18px;
  }
  
  /* Skills Grid Mobile */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  
  .skill-label {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
  }
  
  .form-check-card {
    padding: 0.85rem;
  }
  
  .week-nav-btn {
    width: 40px;
    height: 40px;
  }
  
  .week-nav-btn .material-icons {
    font-size: 20px;
  }
  
  .week-display {
    min-width: 150px;
  }
  
  .week-label {
    font-size: 0.75rem;
  }
  
  .week-range {
    font-size: 0.95rem;
  }
  
  /* Day Tabs Mobile */
  .day-tabs-scroll {
    gap: 0.5rem;
    justify-content: center;
    overflow-x: hidden;
    flex-wrap: wrap;
  }
  
  .day-tab {
    min-width: 55px;
    max-width: 65px;
    height: 70px;
    padding: 0.4rem;
    flex: 0 1 auto;
  }
  
  .day-tab-weekday {
    font-size: 0.7rem;
  }
  
  .day-tab-date {
    font-size: 1.3rem;
  }
  
  /* Show mobile header */
  .mobile-header {
    display: flex;
  }
  
  /* Hide and transform sidebar for mobile */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    width: 280px;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  /* Show close button on mobile */
  .mobile-menu-close {
    display: flex;
  }
  
  /* Show overlay when menu is open */
  .sidebar.mobile-open ~ .mobile-nav-overlay {
    display: block;
  }
  
  .mobile-nav-overlay {
    display: none;
  }
  
  .mobile-nav-overlay.active {
    display: block;
  }
  
  .app-shell {
    padding-left: 0;
    padding-top: 60px; /* Height of mobile header */
  }
  
  .main {
    padding: 16px;
  }
  
  .container {
    padding: 16px;
  }
  
  .action-bar {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    transform: none;
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    min-height: auto;
    max-height: 50vh;
    overflow-y: auto;
  }
  
  .action-bar-header {
    padding: 16px;
    font-size: 1.2em;
  }
  
  .action-bar-header::after {
    left: 20px;
    right: 20px;
  }
  
  .action-bar-content {
    padding: 20px 16px;
    gap: 12px;
  }
  
  .btn-action-bar {
    padding: 12px 16px;
    font-size: 0.9em;
  }
  
  .btn-action-bar.generate {
    font-size: 1em;
    padding: 14px 16px;
  }
  
  /* Make calendar scrollable horizontally */
  .calendar-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Stack function columns on mobile if needed */
  .function-wrapper {
    min-width: 120px;
  }
  
  /* Adjust nav tabs for mobile */
  .nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-tabs .nav-item {
    flex-shrink: 0;
  }
  
  .nav-tabs .nav-link {
    margin-right: 4px;
    padding: 8px 12px;
    font-size: 0.9em;
  }
  
  /* Grid utilities */
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
  
  /* Tables */
  table {
    font-size: 0.85em;
  }
  
  th, td {
    padding: 8px 6px;
  }
  
  /* Form columns - stack on mobile */
  .row.g-2 > [class*="col-md"] {
    width: 100%;
    margin-bottom: 8px;
  }
  
  /* Personal data form adjustments */
  .pd-form-card,
  .pd-side-card {
    padding: 16px;
  }
  
  /* Availability cards */
  .avail-day {
    padding: 12px !important;
  }
  
  .avail-day .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  
  .avail-day .btn-sm {
    font-size: 0.8em;
    padding: 6px 10px;
  }
  
  /* Time slot inputs */
  .slot-item .row {
    flex-wrap: wrap;
  }
  
  .slot-item .col-auto {
    flex: 1 1 auto;
    min-width: 100px;
  }
  
  /* Input groups - better stacking */
  .input-group {
    flex-wrap: wrap;
  }
  
  .input-group > .form-select,
  .input-group > .form-control {
    min-width: 0;
    flex: 1 1 200px;
  }
}

/* Mobile devices (576px and below) */
@media (max-width: 576px) {
  .container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 12px !important;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  .action-bar-content {
    padding: 16px 12px;
    gap: 10px;
  }
  
  .btn-action-bar {
    padding: 10px 14px;
    font-size: 0.85em;
  }
  
  .card {
    padding: 12px;
  }
  
  /* Combined Week and Day Navigation Extra Small Screens */
  .week-day-navigation {
    padding: 0.5rem;
  }
  
  .day-tabs-scroll {
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  
  .day-tab {
    min-width: 50px;
    max-width: 60px;
    height: 65px;
    flex: 0 1 auto;
  }
  
  .day-tab-weekday {
    font-size: 0.65rem;
  }
  
  .day-tab-date {
    font-size: 1.2rem;
  }
  
  /* Smaller date tabs (legacy) */
  .date-tab .weekday {
    font-size: 0.7rem;
  }
  
  .date-tab .daynum {
    font-size: 0.9rem;
  }
  
  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    padding: 8px 10px;
    font-size: 0.9em;
  }
  
  /* Event blocks */
  .event-block {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem 0.3rem 0.8rem;
  }
  
  .event-time {
    font-size: 0.65rem;
  }
}

/* Large tablets and small desktops (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 720px;
  }
  
  .sidebar {
    width: 200px;
  }
  
  .app-shell {
    padding-left: 200px;
  }
  
  .action-bar {
    width: 240px;
    right: 16px;
  }
}

/* Extra large screens (1400px and above) */
@media (min-width: 1400px) {
  .container {
    max-width: 1200px;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .action-bar,
  .nav-tabs,
  button,
  .btn,
  .form-actions {
    display: none !important;
  }
  
  .app-shell {
    padding-left: 0;
  }
  
  .container {
    max-width: 100%;
  }
  
  body {
    background: white;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .action-bar {
    max-height: 40vh;
  }
  
  .action-bar-content {
    gap: 8px;
  }
  
  .btn-action-bar {
    padding: 8px 12px;
  }
}
