:root {
  --primary: #2c3e50;
  --accent: #579ff6;
  --danger: #e74c3c;
  --success: #2ecc71;
  --bg: #f4f7f6;
  --card-bg: lightgray;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  margin: 0;
  color: #333;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.container {
  padding: 20px;
  margin: 0 auto;
}

header {
  background: var(--primary);
  color: white;
  padding: 5px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.logo-header {
  height: 40px;
  width: auto;
  flex-shrink: 0;
  background-color: white;
  border-radius: 5px;
  align-self: center;
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo {
  height: 60px;
  width: auto;
}

header h2 {
  margin: 5px;
}

.leftheadergroup {
  display: flex;
}

.leftheadergroup h2 {
  font-size: small;
  align-self: anchor-center;
}

.headergroup {
  flex-direction: row;
  display: flex;
  align-items: center;
  gap: 10px;
}

@media screen and (max-width: 600px) {
  .leftheadergroup {
    flex-direction: column;
  }

  .leftheadergroup h2 {
    font-size: x-small;
  }

  .headerfulltext {
    display: none;
  }
}

#event-selector {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #ccc;
  max-width: 200px;
  background: white;
  font-size: 14px;
  cursor: pointer;
}

#event-selector:focus {
  outline: none;
  border-color: var(--accent);
}

.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  margin-top: 10px;
}

#planning-list {
  margin-bottom: 20px;
  background-color: lightgray;
  padding: 10px;
  border-radius: 10px;
}

input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.checkbox-group {
  margin: 12px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 8px 0;
  font-size: 0.95em;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

#med-ausbildung-container {
  margin: 8px 0;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

button.primary {
  background: var(--accent);
}

button.secondary {
  background: #95a5a6;
}

button.danger {
  background: var(--danger);
}

.btn-edit,
.btn-delete {
  padding: 10px 14px;
  width: initial;
  margin-bottom: 2px;
  min-height: 44px;
  min-width: 44px;
}

.btn-excel {
  padding: 10px 14px;
  width: initial;
  margin-bottom: 2px;
  background: #27ae60;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

.btn-excel:hover {
  background: #219a52;
}

.btn-excel.btn-disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-locked,
.btn-unlocked {
  padding: 10px 14px;
  width: initial;
  margin-bottom: 2px;
  border: none;
  cursor: pointer;
  font-size: 1em;
  min-height: 44px;
  min-width: 44px;
}

.btn-locked {
  background: #ffc107;
}

.btn-locked:hover {
  background: #e0a800;
}

.btn-unlocked {
  background: #28a745;
}

.btn-unlocked:hover {
  background: #218838;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

/* Tabs */
.tabs {
  background: white;
  display: flex;
  border-bottom: 1px solid #ddd;
}

.tab-link {
  background: none;
  color: var(--primary);
  width: auto;
  flex: 1;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  min-height: 44px;
}

.tab-link.active {
  border-bottom-color: var(--accent);
  font-weight: bold;
}

.tab-content {
  display: none;
  padding-top: 20px;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  margin-top: 0;
}

/* Shift Planning UI */
.shift-item {
  background: white;
  margin-bottom: 15px;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid black;
  border-left: 5px solid var(--primary);
}

.shift-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.shift-body {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.role-badge {
  padding: 10px 14px;
  border-radius: 15px;
  font-size: 0.9em;
  cursor: pointer;
  margin-bottom: 5px;
  display: inline-block;
  min-height: 36px;
}

.role-badge.responsible {
  background: #e8f8f5;
  color: #1abc9c;
  border: 1px solid #1abc9c;
}

.role-badge.planned {
  background: #eaf2f8;
  color: #3498db;
  border: 1px solid #3498db;
}

.role-badge.interested {
  background: #f9f9f9;
  color: #7f8c8d;
  border: 1px solid #bdc3c7;
}

.role-badge.missing-interest {
  background: #fdeaea;
  color: #c0392b;
  border: 2px solid #e74c3c;
}

.warning-icon {
  cursor: help;
}

.confirm-btn {
  margin-left: 4px;
  margin-top: 4px;
  margin-left: 4px;
  padding: 3px 3px;
  align-content: center;
  text-align: center;
  border-radius: 4px;
  background: #27ae60;
  color: white;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  display: inline-block;
  min-height: 30px;
  min-width: 30px;
}

.confirm-btn:hover {
  background: #219a52;
  opacity: 0.9;
}


.status-link {
  margin-top: 6px;
  margin-left: 6px;
  padding: 3px 3px;
  align-content: center;
  text-align: center;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9em;
  display: inline-block;
  min-height: 30px;
  min-width: 30px;
}

.status-link:hover {
  opacity: 0.8;
}

.status-to-planned {
  background: #3498db;
  color: white;
}

.status-to-responsible {
  background: #1abc9c;
  color: white;
}

.status-to-interested {
  background: #95a5a6;
  color: white;
}

.remove-link {
  margin-left: 6px;
  color: #e74c3c;
  cursor: pointer;
  font-weight: bold;
  display: inline-block;
  min-height: 36px;
  min-width: 36px;
}

.remove-link:hover {
  color: #c0392b;
}

.add-btn {
  background: #eee;
  color: #555;
  font-weight: bold;
  margin-left: auto;
  padding: 10px 14px;
  align-content: center;
  min-height: 20px;
  min-width: 44px;
}

.log-entry {
  font-size: 0.9em;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.log-time {
  color: #888;
  font-size: 0.8em;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: white;
  margin: 15% auto;
  padding: 20px;
  width: 400px;
  max-width: 90%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--primary);
}

.modal-content p {
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95em;
}

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

.btn-primary:hover {
  background: #4a8de6;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.close {
  float: right;
  cursor: pointer;
  font-size: 24px;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Day Grid Layout */
.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.day-unit {
  display: flex;
  flex-direction: column;
}

.day-column-header {
  text-align: center;
  color: white;
  padding: 10px;
  background: var(--primary);
  border-radius: 8px 8px 0 0;
}

.day-column-header strong {
  font-size: 1.1em;
}

.day-column-header small {
  opacity: 0.9;
}

.day-column {
  background: #f9f9f9;
  border-radius: 0 0 8px 8px;
  padding: 10px;
  min-height: 100px;
  border: 1px solid black;
  border-width: 0 0 0 1px;
  flex: 1;
}

.shift-actions {
  min-width: 95px;
  max-width: 95px;
}

.shift-header div {
  width: stretch;
}

.shift-item-compact {
  background: white;
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.shift-item-compact label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.shift-item-compact input[type="checkbox"] {
  margin-bottom: 5px;
}

.shift-item-compact strong {
  color: var(--primary);
}

.shift-item-compact small {
  color: #666;
  font-size: 0.85em;
}

/* Locked Event Styles */
.event-locked-notice {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 20px;
  color: #856404;
}

.event-locked-notice strong {
  display: block;
  font-size: 1.1em;
  margin-bottom: 8px;
}

.event-locked-notice p {
  margin: 0;
  line-height: 1.5;
}

.shift-item-compact.shift-locked {
  background: #f5f5f5;
  border-color: #ccc;
  opacity: 0.8;
}

.shift-item-compact.shift-locked label {
  cursor: not-allowed;
}

.shift-item-compact.shift-locked input[type="checkbox"]:disabled {
  cursor: not-allowed;
  accent-color: #ffc107;
}

.shift-item-compact.shift-locked strong {
  color: #666;
}

.shift-item-compact.shift-locked small {
  color: #999;
}

/* Overlapping Shift Warning */
.overlap-warning {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 600;
  border: 1px solid #ffc107;
  cursor: help;
}

.shift-item.shift-overlapping {
  border-left-color: #ffc107;
  background: #fffef5;
}

.shift-overlapping .shift-header {
  border-bottom: 1px dashed #ffc107;
  padding-bottom: 8px;
}

/* Long Shift Warnings Container */
.long-shift-warnings-container {
  margin-top: 20px;
  padding: 15px;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
}

.long-shift-warning {
  color: #856404;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid #ffeeba;
}

.long-shift-warning:last-child {
  border-bottom: none;
}

/* Disabled input for locked events */
input:disabled {
  background-color: #f5f5f5;
  color: #666;
  cursor: not-allowed;
  border-color: #ccc;
}

#helferliste-container {
  overflow-x: scroll;
}

/* Wage Table */
.wage-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-size: small;
}

.wage-table thead {
  background: var(--primary);
  color: white;
}

.wage-table th {
  padding: 15px 10px;
  text-align: left;
  font-weight: 600;
}

.wage-table td {
  padding: 12px 10px;
  border-bottom: 1px solid black;
}

.wage-table tbody tr:hover {
  background: var(--accent);
}

.wage-table tbody tr:last-child td {
  border-bottom: none;
}

.wage-table tfoot {
  background: #e8e8e8;
  font-weight: 600;
}

.wage-table tfoot td {
  padding: 15px 10px;
  border-top: 2px solid var(--primary);
}

.rotatedText {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

/* Status Badges */
.status-active {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  background: #e8f8f5;
  color: #27ae60;
  border: 1px solid #27ae60;
}

.status-inactive {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  background: #fdeaea;
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toast-slide-in 0.3s ease-out;
  border-left: 4px solid var(--success);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: #ffc107;
}

.toast-icon {
  font-size: 1.3em;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.95em;
  color: #333;
}

.toast-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  font-size: 1.2em;
  line-height: 1;
}

.toast-close:hover {
  color: #666;
}

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

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast.hiding {
  animation: toast-slide-out 0.3s ease-in forwards;
}

/* Interactive Tour Styles */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-highlight {
  position: relative;
  z-index: 10001 !important;
  background: white;
  box-shadow: 0 0 0 4px var(--accent), 0 0 20px rgba(87, 159, 246, 0.5);
  border-radius: 4px;
  animation: tour-pulse 2s infinite;
}

@keyframes tour-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 4px var(--accent), 0 0 20px rgba(87, 159, 246, 0.5);
  }

  50% {
    box-shadow: 0 0 0 8px var(--accent), 0 0 30px rgba(87, 159, 246, 0.7);
  }
}

.tour-tooltip {
  position: fixed;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 380px;
  width: 90%;
  z-index: 10002;
  overflow: hidden;
}

.tour-tooltip-header {
  background: var(--primary);
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tour-tooltip-header h4 {
  margin: 0;
  font-size: 1.1em;
}

.tour-step-counter {
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.tour-tooltip p {
  padding: 20px;
  margin: 0;
  line-height: 1.6;
  color: #333;
}

.tour-tooltip-buttons {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #eee;
}

.tour-btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.tour-btn-primary:hover {
  background: #4a8de6;
}

.tour-btn-secondary {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tour-btn-secondary:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.tour-start-checkbox {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 10002;
}

.tour-start-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9em;
  color: #333;
}

.tour-start-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.tour-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95em;
  color: #555;
  margin: 15px 0;
}

.tour-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.tour-final-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.tour-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
}

.tour-final-card h2 {
  color: var(--primary);
  margin: 0 0 15px 0;
}

.tour-final-card p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 10px;
}

.tour-final-btn {
  margin-top: 15px;
  padding: 14px 40px;
  font-size: 1.1em;
}

/* Tour tooltip positioning arrows */
.tour-tooltip.tour-top::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid white;
}

.tour-tooltip.tour-bottom::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid white;
}

.tour-tooltip.tour-left::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid white;
}

.tour-tooltip.tour-right::after {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid white;
}

/* Backup Management Styles */
.backup-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

.backup-stat {
  background: #f9f9f9;
  padding: 12px 15px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.backup-stat-label {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin-bottom: 5px;
}

.backup-stat-value {
  display: block;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--primary);
}

.btn-warning {
  background: #f39c12;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 44px;
}

.btn-warning:hover {
  background: #d68910;
}

.btn-download {
  background: #27ae60;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 36px;
  min-width: 36px;
}

.btn-download:hover {
  background: #219a52;
}

#restore-file {
  padding: 10px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
}

#restore-file:hover {
  border-color: var(--accent);
}

#tab-backup .card h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--primary);
}

#tab-backup .actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}


/* Responsive */
@media (max-width: 600px) {

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

  .shift-body {
    flex-direction: column;
  }

  .day-grid {
    grid-template-columns: 1fr;
  }

  .wage-table {
    font-size: 0.85em;
  }

  .wage-table th,
  .wage-table td {
    padding: 8px 5px;
  }

  .tour-tooltip {
    max-width: 95%;
  }

  .tour-final-card {
    padding: 25px;
  }
}