:root {
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-sidebar: #0f3460;
  --accent: #00b4d8;
.navbar { position: relative; z-index: 1100; }
  --accent-green: #2ec4b6;
  --accent-red: #e63946;
  --text-muted: #8899aa;
}

body {
  background: var(--bg-dark);
  color: #e0e0e0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.sidebar {
  width: 220px;
  min-height: calc(100vh - 56px);
  background: var(--bg-sidebar) !important;
  padding-top: 1rem;
  position: sticky;
  top: 56px;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #adb5bd;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(0,180,216,0.15);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-link i { width: 20px; text-align: center; }

.main-content {
  flex: 1;
  min-width: 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1); color: #e0e0e0; }
.card-header { background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(255,255,255,0.1); }
.table { color: #e0e0e0; --bs-table-bg: transparent; --bs-table-hover-bg: rgba(255,255,255,0.03); }
.table thead th { border-bottom-color: rgba(255,255,255,0.15); color: var(--accent); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.table td { border-bottom-color: rgba(255,255,255,0.05); vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(255,255,255,0.03); }

.form-control, .form-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e0e0e0;
}
.form-control:focus, .form-select:focus {
  background: rgba(255,255,255,0.12);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(0,180,216,0.25);
}
.form-control::placeholder { color: var(--text-muted); }

.btn-accent { background: var(--accent); color: #fff; border: none; }
.btn-accent:hover { background: #0096b7; color: #fff; }

.modal-content { background: var(--bg-card); color: #e0e0e0; border: 1px solid rgba(255,255,255,0.15); }
.modal-header { border-bottom-color: rgba(255,255,255,0.1); }
.modal-footer { border-top-color: rgba(255,255,255,0.1); }
.btn-close { filter: invert(1); }

.badge-in { background: var(--accent-green); }
.badge-out { background: var(--accent-red); }
.badge-away { background: #6c757d; }

.emp-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
}

.emp-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.2s;
}
.emp-card.status-in { border-left: 4px solid var(--accent-green); }
.emp-card.status-out { border-left: 4px solid var(--accent-red); }
.emp-card.status-away { border-left: 4px solid #6c757d; }

.emp-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
}

.emp-card-initials {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 auto 0.75rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-link span { display: none; }
  .sidebar-link { justify-content: center; padding: 12px; }
  .sidebar-link i { width: auto; }
}

/* Language editor - make inputs clearly editable */
.trans-input {
  background: #1e2a45 !important;
  border: 1px solid #3a5080 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  padding: 8px 12px !important;
}
.trans-input:focus {
  background: #243050 !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 0.2rem rgba(0,180,216,0.3) !important;
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 56px;
    left: -260px;
    width: 260px;
    height: calc(100vh - 56px);
    z-index: 1050;
    transition: left 0.3s ease;
    overflow-y: auto;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100vh - 56px);
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }
  .sidebar-overlay.open { display: block; }
  .main-content { padding: 10px !important; width: 100%; }
  .stat-card { margin-bottom: 8px; }
  .table { font-size: 13px; }
  .trans-input { font-size: 16px !important; }
  .sidebar.open .sidebar-link span { display: inline !important; }

.hamburger-btn { display: inline-block !important; }
}

.sidebar.open .sidebar-link span { display: inline !important; }

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 24px;
  padding: 4px 8px;
  cursor: pointer;
}


/* Flatpickr dark theme overrides */
.flatpickr-calendar {
  background: #16213e !important;
  border-color: rgba(255,255,255,0.15) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays,
span.flatpickr-weekday {
  background: #0f3460 !important;
  color: #e0e0e0 !important;
}
.flatpickr-day {
  color: #e0e0e0 !important;
  border-color: transparent !important;
}
.flatpickr-day:hover {
  background: rgba(0,180,216,0.3) !important;
  border-color: var(--accent) !important;
}
.flatpickr-day.selected {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.flatpickr-day.today {
  border-color: var(--accent) !important;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #556677 !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  fill: #e0e0e0 !important;
  color: #e0e0e0 !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  fill: var(--accent) !important;
}
.numInputWrapper span {
  border-color: rgba(255,255,255,0.15) !important;
}
.numInputWrapper span:hover {
  background: rgba(0,180,216,0.2) !important;
}
.numInputWrapper span svg path {
  fill: #e0e0e0 !important;
}
.flatpickr-current-month input.cur-year {
  color: #e0e0e0 !important;
}

/* Date input visibility fix for mobile and desktop */
input[type="date"],
input[type="time"],
input.flatpickr-input {
  color: #e0e0e0 !important;
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
}
input[type="date"]:focus,
input[type="time"]:focus,
input.flatpickr-input:focus {
  color: #fff !important;
  background: rgba(255,255,255,0.12) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 0.2rem rgba(0,180,216,0.25) !important;
}

/* WebKit date/time input icon fix */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

/* Label visibility fix */
.form-label {
  color: #b0bec5 !important;
  font-weight: 500;
}
.form-label.small.text-muted {
  color: #b0bec5 !important;
  opacity: 1 !important;
}
label.form-label {
  color: #b0bec5 !important;
}

/* Person cards for analytics house status */
.person-card-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s;
}
.person-card-mini:hover {
  border-color: rgba(255,255,255,0.2);
}
.person-card-mini .avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 4px;
}
.person-card-mini .initials-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.person-card-mini .person-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #e0e0e0;
  line-height: 1.2;
  margin-bottom: 2px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-card-mini .badge {
  font-size: 0.6rem;
  padding: 2px 6px;
}

/* Schedule Planner Grid */
.schedule-grid-container { overflow-x: auto; }
.schedule-grid-wrapper { min-width: 600px; }
.sg-row { display: flex; }
.sg-header { border-bottom: 2px solid #2a3a4e; }
.sg-time-col { width: 60px; min-width: 60px; padding: 8px 4px; text-align: center; font-size: 0.75rem; color: #8899aa; font-weight: 600; }
.sg-day-col { flex: 1; padding: 8px 4px; text-align: center; font-size: 0.8rem; font-weight: 700; color: #e0e0e0; }
.sg-body { display: flex; min-height: 300px; }
.sg-time-axis { width: 60px; min-width: 60px; display: flex; flex-direction: column; }
.sg-time-label { flex: 1; padding: 2px 4px; text-align: right; font-size: 0.7rem; color: #667788; border-top: 1px solid #1a2535; }
.sg-columns { flex: 1; display: flex; }
.sg-column { flex: 1; position: relative; border-left: 1px solid #1a2535; }
.sg-cell { border-top: 1px solid #1a2535; height: 0; flex: 1; }
.sg-column { display: flex; flex-direction: column; }
.schedule-bar { position: absolute; left: 4px; right: 4px; border-radius: 6px; padding: 4px 6px; font-size: 0.7rem; color: white; overflow: hidden; display: flex; flex-direction: column; justify-content: center; z-index: 1; cursor: pointer; transition: opacity 0.2s; }
.schedule-bar:hover { opacity: 1 !important; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.sb-name { font-weight: 700; font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-time { font-size: 0.6rem; opacity: 0.9; }
.sb-badge { font-size: 0.6rem; margin-top: 2px; }
.coverage-badge { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; font-weight: bold; font-size: 0.85rem; }
.coverage-good { background: #2ec4b6; color: #fff; }
.coverage-warn { background: #ffc107; color: #000; }
.coverage-bad { background: #e63946; color: #fff; }

/* Fix select dropdown options to dark theme */
select option, select.form-select option, #langSwitch option {
  background: #1a1a2e !important;
  color: #e0e0e0 !important;
}
/* Fix card stat text readability */
.card h3, .card h4, .card .h3, .card .h4 {
  color: #e0e0e0;
}
/* Fix form-select dropdown in dark theme */
select.form-select {
  color-scheme: dark;
}

/* White text fix for all dark theme pages */
.login-card h4, .login-card h5 { color: #ffffff !important; }
.login-card p, .login-card span { color: #e0e0e0; }
.login-card .text-muted { color: #94a3b8 !important; }
.login-card .form-label { color: #ffffff !important; }
.login-card a { color: #00b4d8 !important; }
body { color: #e0e0e0; }
h4, h5, h6 { color: #ffffff; }


/* Clickable cards */
.clickable-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,180,216,0.2);
  border-color: rgba(0,180,216,0.4) !important;
}

/* ====================== */
/* Theme System            */
/* ====================== */

/* Theme: Dark White (better contrast) */

/* Fix dim helper text */
.text-muted, small.text-muted, .form-text {
  color: #94a3b8 !important;
}
.card-body .text-muted, .card-body small.text-muted {
  color: #94a3b8 !important;
}

/* Light theme helper text */

/* Custom theme */

/* Color picker styling */
.form-control-color {
  height: 38px;
  padding: 3px;
  cursor: pointer;
}


/* === THEMES === */

/* Theme: Black + White (default) */
body.theme-black-white {
  --bg-dark: #111111;
  --bg-card: #1a1a1a;
  --bg-sidebar: #0d0d0d;
  --accent: #ffffff;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  background: #111111 !important;
  color: #e0e0e0;
}
body.theme-black-white .sidebar { background: #0d0d0d !important; }
body.theme-black-white .navbar { background: #0d0d0d !important; }
body.theme-black-white .card { background: #1a1a1a !important; border-color: rgba(255,255,255,0.1) !important; }
body.theme-black-white .card-header { background: #141414 !important; border-color: rgba(255,255,255,0.1) !important; }
body.theme-black-white .stat-card .stat-value { color: #ffffff; }
body.theme-black-white .stat-card .stat-label { color: #999999; }
body.theme-black-white .table thead th { color: #ffffff; }
body.theme-black-white .sidebar-link { color: #b0b0b0; }
body.theme-black-white .sidebar-link:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
body.theme-black-white .sidebar-link.active { color: #ffffff; background: rgba(255,255,255,0.12); border-left-color: #ffffff; }
body.theme-black-white .btn-accent { background: #ffffff !important; color: #111111 !important; }
body.theme-black-white .form-control, body.theme-black-white .form-select { background: #111111 !important; border-color: #333 !important; color: #e0e0e0 !important; }

/* Theme: Black + Blue */
body.theme-black-blue {
  --bg-dark: #0a0a14;
  --bg-card: #0f1525;
  --bg-sidebar: #060d1a;
  --accent: #2196f3;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  background: #0a0a14 !important;
  color: #d0d8e8;
}
body.theme-black-blue .sidebar { background: #060d1a !important; }
body.theme-black-blue .navbar { background: #060d1a !important; }
body.theme-black-blue .card { background: #0f1525 !important; border-color: rgba(33,150,243,0.15) !important; }
body.theme-black-blue .card-header { background: #0c1120 !important; border-color: rgba(33,150,243,0.15) !important; }
body.theme-black-blue .stat-card .stat-value { color: #2196f3; }
body.theme-black-blue .stat-card .stat-label { color: #7da8d4; }
body.theme-black-blue .table thead th { color: #2196f3; }
body.theme-black-blue .sidebar-link { color: #7da8d4; }
body.theme-black-blue .sidebar-link:hover { color: #64b5f6; background: rgba(33,150,243,0.08); }
body.theme-black-blue .sidebar-link.active { color: #64b5f6; background: rgba(33,150,243,0.15); border-left-color: #2196f3; }
body.theme-black-blue .btn-accent { background: #2196f3 !important; color: #ffffff !important; }
body.theme-black-blue .form-control, body.theme-black-blue .form-select { background: #0a0a14 !important; border-color: #1a2a44 !important; color: #d0d8e8 !important; }

/* Theme: Black + Red */
body.theme-black-red {
  --bg-dark: #0f0808;
  --bg-card: #1a0f0f;
  --bg-sidebar: #0d0606;
  --accent: #ef4444;
  --accent-green: #10b981;
  --accent-red: #ff6b6b;
  background: #0f0808 !important;
  color: #e0d0d0;
}
body.theme-black-red .sidebar { background: #0d0606 !important; }
body.theme-black-red .navbar { background: #0d0606 !important; }
body.theme-black-red .card { background: #1a0f0f !important; border-color: rgba(239,68,68,0.15) !important; }
body.theme-black-red .card-header { background: #150c0c !important; border-color: rgba(239,68,68,0.15) !important; }
body.theme-black-red .stat-card .stat-value { color: #ef4444; }
body.theme-black-red .stat-card .stat-label { color: #d4897a; }
body.theme-black-red .table thead th { color: #ef4444; }
body.theme-black-red .sidebar-link { color: #c09090; }
body.theme-black-red .sidebar-link:hover { color: #f87171; background: rgba(239,68,68,0.08); }
body.theme-black-red .sidebar-link.active { color: #f87171; background: rgba(239,68,68,0.15); border-left-color: #ef4444; }
body.theme-black-red .btn-accent { background: #ef4444 !important; color: #ffffff !important; }
body.theme-black-red .form-control, body.theme-black-red .form-select { background: #0f0808 !important; border-color: #2a1515 !important; color: #e0d0d0 !important; }

.table td { color: #e0e0e0 !important; }
.table td .fw-bold, .table td .fw-600 { color: #ffffff !important; }
.table thead th { color: #00b4d8 !important; }

/* Lock to portrait */
@media screen and (orientation: landscape) and (max-height: 500px) {
  body::after {
    content: 'Please rotate to portrait / Drej til stående';
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #0a0a1a; color: #00e5ff;
    display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 20px; padding: 40px; z-index: 99999;
  }
}
