/* ===== MHD TRACKER - KLASSISCHES HELL-DESIGN (OHNE RUNDE KANTEN) ===== */

/* CSS RESET & GRUNDLAGEN */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important; /* Strikt keine runden Kanten */
}

:root {
  --bg-main: #f0f2f5;
  --bg-card: #ffffff;
  --bg-header: #243342;
  --bg-header-hover: #34495e;
  --bg-active-tab: #1a56db;
  --border-color: #cbd5e1;
  --border-dark: #94a3b8;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-header: #ffffff;
  
  --color-primary: #1a56db;
  --color-primary-hover: #1e429f;
  --color-success: #15803d;
  --color-warning: #b45309;
  --color-danger: #b91c1c;
  --color-expired: #7f1d1d;
  --color-chef: #6b21a8;

  --badge-ok-bg: #dcfce7;
  --badge-ok-text: #166534;
  --badge-warn-bg: #fef3c7;
  --badge-warn-text: #92400e;
  --badge-danger-bg: #fee2e2;
  --badge-danger-text: #991b1b;
  --badge-expired-bg: #f3e8ff;
  --badge-expired-text: #6b21a8;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
}

/* ===== LOCKPAGE / SPERRBILDSCHIRM ===== */
.lockscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.lockscreen.hidden {
  display: none !important;
}

.lockscreen-box {
  background: #ffffff;
  border: 2px solid #334155;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 420px;
  padding: 30px 25px;
  text-align: center;
}

.lockscreen-title {
  font-size: 24px;
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.lockscreen-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.lockscreen-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lockscreen-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  background-color: #2c3e50;
  border: 1px solid #1a252f;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.15s ease;
}

.lockscreen-btn:hover {
  background-color: #34495e;
}

.lockscreen-btn.btn-chef {
  background-color: #6b21a8;
  border-color: #581c87;
}

.lockscreen-btn.btn-chef:hover {
  background-color: #7e22ce;
}

/* Passwort Eingabebereich auf Lockpage */
.lock-password-panel {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px dashed var(--border-color);
  text-align: left;
}

.lock-password-panel.hidden {
  display: none;
}

.lock-password-label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 13px;
}

.lock-password-input-group {
  display: flex;
  gap: 8px;
}

.lock-password-input {
  flex: 1;
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--border-dark);
  outline: none;
}

.lock-password-input:focus {
  border-color: var(--color-primary);
  background-color: #f8fafc;
}

.lock-error {
  margin-top: 10px;
  padding: 8px 10px;
  background-color: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
  font-size: 13px;
  font-weight: bold;
  display: none;
}

.lock-error.visible {
  display: block;
}

/* ===== KOPFZEILE / NAVBAR (HORIZONTAL) ===== */
.topbar {
  background-color: var(--bg-header);
  color: var(--text-header);
  border-bottom: 2px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  flex-wrap: wrap;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.brand-title {
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 12px;
  color: #94a3b8;
  border-left: 1px solid #475569;
  padding-left: 10px;
}

/* Navigation Tabs horizontal nebeneinander */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-tab-btn {
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  transition: background-color 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-tab-btn:hover {
  background-color: var(--bg-header-hover);
  color: #ffffff;
}

.nav-tab-btn.active {
  background-color: #1e293b;
  color: #ffffff;
  border-bottom: 3px solid #38bdf8;
}

/* Benutzerbereich rechts */
.user-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.user-badge {
  background: #334155;
  color: #f1f5f9;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  border: 1px solid #475569;
}

.user-badge.badge-chef {
  background: #6b21a8;
  border-color: #9333ea;
  color: #ffffff;
}

.btn-logout {
  padding: 6px 12px;
  background: #b91c1c;
  color: #ffffff;
  border: 1px solid #7f1d1d;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.btn-logout:hover {
  background: #dc2626;
}

/* ===== HAUPTINHALT ===== */
.main-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 15px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* Karten & Boxen */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title {
  font-size: 18px;
  font-weight: bold;
  color: #1e293b;
}

/* ===== BUTTONS (KLASSISCH ECKIG) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: #1e40af;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: #334155;
  border-color: var(--border-dark);
}

.btn-secondary:hover {
  background-color: #f1f5f9;
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
  border-color: #991b1b;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Button Gruppe (Woche / Monat / Jahr) */
.btn-group {
  display: inline-flex;
  border: 1px solid var(--border-dark);
}

.btn-group .btn {
  border: none;
  border-right: 1px solid var(--border-dark);
  background: #ffffff;
  color: #334155;
}

.btn-group .btn:last-child {
  border-right: none;
}

.btn-group .btn.active {
  background-color: #2c3e50;
  color: #ffffff;
}

.btn-group .btn:hover:not(.active) {
  background-color: #f1f5f9;
}

/* ===== FORMULARE & INPUTS ===== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #334155;
}

.form-input,
.form-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border-dark);
  background-color: #ffffff;
  color: #1e293b;
  outline: none;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus {
  border-color: #1a56db;
  box-shadow: inset 0 0 0 1px #1a56db;
}

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

.date-picker-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1.2fr;
  gap: 8px;
}

/* Filterleiste */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 400px;
}

/* Autocomplete Dropdown & Eingabefeld mit Button */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.input-with-button {
  position: relative;
  width: 100%;
}

.input-with-button .form-input {
  width: 100%;
  padding-right: 40px;
}

.input-with-button .input-addon-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 36px;
  background-color: transparent;
  border: none;
  border-left: 1px solid var(--border-color);
  padding: 0;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  border-radius: 0;
  transition: background-color 0.15s;
}

.input-with-button .input-addon-btn:hover {
  background-color: #e2e8f0;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #334155;
  max-height: 240px;
  overflow-y: auto;
  z-index: 5000;
  display: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.autocomplete-list.visible {
  display: block;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #e0f2fe;
}

.autocomplete-item-title {
  font-weight: bold;
  color: #1e293b;
}

.autocomplete-item-details {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== TABELLEN (KLASSISCH STRUKTURIERT) ===== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  background: #ffffff;
}

.data-table th {
  background-color: #2c3e50;
  color: #ffffff;
  padding: 10px 12px;
  font-weight: bold;
  border: 1px solid #34495e;
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  color: #1e293b;
}

.data-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.data-table tbody tr:hover {
  background-color: #e2e8f0;
}

/* Badges / Status */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid transparent;
}

.badge-ok {
  background-color: var(--badge-ok-bg);
  color: var(--badge-ok-text);
  border-color: #86efac;
}

.badge-warn {
  background-color: var(--badge-warn-bg);
  color: var(--badge-warn-text);
  border-color: #fde047;
}

.badge-danger {
  background-color: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border-color: #fca5a5;
}

.badge-expired {
  background-color: var(--badge-expired-bg);
  color: var(--badge-expired-text);
  border-color: #d8b4fe;
}

.store-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.store-badge.store-luelsdorf {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.store-badge.store-wahn {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.store-badge.store-troisdorf {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

/* ===== STATISTIKEN LEISTE ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.stat-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 12px;
  text-align: center;
  border-left: 4px solid #64748b;
}

.stat-box.stat-ok { border-left-color: var(--color-success); }
.stat-box.stat-warn { border-left-color: var(--color-warning); }
.stat-box.stat-danger { border-left-color: var(--color-danger); }
.stat-box.stat-expired { border-left-color: var(--color-expired); }

.stat-num {
  font-size: 20px;
  font-weight: bold;
  color: #1e293b;
}

.stat-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: bold;
}

/* ===== KALENDER ===== */
.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
  background: #e2e8f0;
  padding: 10px 12px;
  border: 1px solid var(--border-dark);
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-title-btn {
  font-size: 16px;
  font-weight: bold;
  color: #1e293b;
  padding: 4px 12px;
  border: 1px solid var(--border-dark);
  background: #ffffff;
  cursor: pointer;
}

.cal-title-btn:hover {
  background-color: #f8fafc;
}

/* Kalender: Monatsansicht (7 Spalten Mo-So) */
.cal-month-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  border: 1px solid var(--border-dark);
}

.cal-month-table th {
  background-color: #334155;
  color: #ffffff;
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  border: 1px solid #475569;
}

.cal-month-table td {
  height: 90px;
  vertical-align: top;
  border: 1px solid var(--border-color);
  padding: 4px;
  background-color: #ffffff;
}

.cal-month-table td.other-month {
  background-color: #f8fafc;
  color: #94a3b8;
}

.cal-month-table td.today {
  background-color: #fef9c3;
  border: 2px solid #ca8a04;
}

.cal-day-num {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
  display: block;
}

.cal-event-item {
  display: block;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 2px;
  border: 1px solid #94a3b8;
  background: #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.cal-event-item.status-ok { background: #dcfce7; border-color: #86efac; color: #166534; }
.cal-event-item.status-warn { background: #fef3c7; border-color: #fde047; color: #92400e; }
.cal-event-item.status-danger { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.cal-event-item.status-expired { background: #f3e8ff; border-color: #d8b4fe; color: #6b21a8; }

/* Kalender: WOCHENANSICHT (7 Spalten von LINKS NACH RECHTS) */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border-dark);
  background: #ffffff;
}

.cal-week-col {
  border-right: 1px solid var(--border-color);
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.cal-week-col:last-child {
  border-right: none;
}

.cal-week-header {
  background-color: #334155;
  color: #ffffff;
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1px solid #475569;
}

.cal-week-dayname {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

.cal-week-daynum {
  font-size: 16px;
  font-weight: bold;
}

.cal-week-col.today .cal-week-header {
  background-color: #1e40af;
}

.cal-week-col.today {
  background-color: #eff6ff;
}

.cal-week-content {
  padding: 6px 4px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Kalender: JAHRESANSICHT */
.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.year-month-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 10px;
}

.year-month-title {
  font-weight: bold;
  font-size: 13px;
  text-align: center;
  background: #e2e8f0;
  padding: 4px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.year-month-title:hover {
  background: #cbd5e1;
}

.year-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  text-align: center;
}

.year-mini-table th {
  color: var(--text-muted);
  font-weight: bold;
  padding: 2px;
}

.year-mini-table td {
  padding: 3px 1px;
  border: 1px solid #f1f5f9;
}

.year-mini-table td.today {
  background-color: #2c3e50;
  color: #ffffff;
  font-weight: bold;
}

.year-mini-table td.has-mhd {
  background-color: #fef08a;
  color: #854d0e;
  font-weight: bold;
}

.year-mini-table td.has-expired {
  background-color: #fca5a5;
  color: #7f1d1d;
  font-weight: bold;
}

/* ===== MODAL DIALOGE ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 15px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-box {
  background: #ffffff;
  border: 2px solid #1e293b;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  background-color: #2c3e50;
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 15px;
  font-weight: bold;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close-btn:hover {
  color: #fca5a5;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Monatsauswahl Modal */
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.month-picker-year {
  grid-column: 1 / -1;
  font-weight: bold;
  background: #e2e8f0;
  padding: 4px 8px;
  margin-top: 6px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.month-picker-item {
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--border-dark);
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}

.month-picker-item:hover {
  background: #2c3e50;
  color: #ffffff;
}

.month-picker-item.active {
  background: #1a56db;
  color: #ffffff;
  border-color: #1e40af;
}

/* Toast Benachrichtigungen */
.toast-box {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  padding: 10px 16px;
  background: #1e293b;
  color: #ffffff;
  border-left: 4px solid #38bdf8;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
  font-size: 13px;
  font-weight: bold;
  min-width: 250px;
}

.toast-msg.success { border-left-color: #22c55e; }
.toast-msg.error { border-left-color: #ef4444; }

/* Fußzeile */
.footer-bar {
  text-align: center;
  padding: 15px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: 30px;
  background: #ffffff;
}

/* Leerzustand */
.empty-notice {
  text-align: center;
  padding: 30px 15px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== RESPONSIVE ANPASSUNGEN (MOBILE) ===== */
@media (max-width: 768px) {
  .topbar-container {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-section {
    justify-content: space-between;
  }

  .nav-tabs {
    justify-content: space-between;
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid #334155;
    padding-top: 4px;
  }

  .nav-tab-btn {
    padding: 8px 10px;
    font-size: 12px;
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .user-section {
    justify-content: space-between;
    border-top: 1px solid #334155;
    padding-top: 6px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Kalender Wochenansicht auf Mobile scrollbar machen */
  .cal-week-grid {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .cal-month-table {
    display: block;
    overflow-x: auto;
    min-width: 500px;
  }

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