/* Zeiterfassung – StempelUhr-inspiriert, Persanesth Design */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --color-bg: #f0f7fc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-primary: #20B2FF;
  --color-primary-hover: #1890d4;
  --color-primary-dark: #0d4a6b;
  --color-nav: linear-gradient(135deg, #0d4a6b 0%, #156a8f 50%, #1890d4 100%);
  --color-nav-text: rgba(255,255,255,0.95);
  --color-success: #059669;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(13,74,107,0.15), 0 4px 10px -4px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--color-bg); min-height: 100vh; color: var(--color-text); line-height: 1.6; }

/* Navbar – Persanesth-Farbverlauf */
.navbar {
  background: linear-gradient(135deg, #0d4a6b 0%, #156a8f 50%, #1890d4 100%);
  color: white;
  padding: 14px 24px;
  box-shadow: 0 2px 12px rgba(13,74,107,0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.nav-brand a { color: white; text-decoration: none; font-size: 1.35em; font-weight: 700; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-link {
  color: var(--color-nav-text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95em;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: white; }
.nav-user { display: flex; align-items: center; gap: 12px; color: var(--color-nav-text); }
.user-name { font-size: 0.9em; }
.user-menu { display: none; position: absolute; top: 100%; right: 0; background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; margin-top: 4px; min-width: 160px; z-index: 100; }
.nav-user:hover .user-menu { display: block; }
.user-menu a { display: block; padding: 8px 12px; color: var(--color-text); text-decoration: none; border-radius: 6px; font-size: 0.9em; }
.user-menu a:hover { background: var(--color-bg); }

/* Hamburger Mobile */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}
.hamburger span { width: 24px; height: 2px; background: white; border-radius: 1px; transition: 0.3s; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links { display: none; width: 100%; flex-direction: column; }
  .nav-links.mobile-open { display: flex; }
  .mobile-user-links { display: block !important; margin-top: 8px; }
  .nav-user { display: none; }
}

/* Container – volle Breite am PC, kompakt auf Handy */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 32px; }

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 6px 12px; font-size: 0.85em; }
.btn-success { background: var(--color-success); color: white; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--color-text); font-size: 0.9em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95em;
  font-family: var(--font);
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(32, 178, 255, 0.2);
}

/* Alerts */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; }

/* Clock / Stempeln */
.clock-container { text-align: center; padding: 20px 0; }
.time-display { margin-bottom: 24px; }
.current-time { font-size: 3em; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
.current-date { font-size: 1.1em; color: var(--color-text-muted); margin-top: 4px; }
.status-card {
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  margin: 20px 0;
  font-weight: 600;
  font-size: 1.1em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.status-card.clocked-out { background: linear-gradient(135deg, #fff8e6 0%, #ffefd5 100%); color: #92400e; border: 1px solid #fcd34d; }
.status-card.clocked-in { background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%); color: #006064; border: 1px solid #4dd0e1; }
.betrieb-selection { margin: 20px 0; }
.betrieb-selection label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--color-text-muted); font-size: 0.9em; }

/* Slider Stempeln */
.slider-container { margin: 28px 0; }
.slider-track {
  height: 56px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 60px;
  background: linear-gradient(135deg, #20B2FF 0%, #1890d4 100%);
  border-radius: 28px 0 0 28px;
  transition: width 0.3s ease;
}
.slider-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 48px;
  height: 48px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  color: var(--color-primary);
  transition: transform 0.3s ease;
}
.thumb-icon { font-weight: 700; }
.slider-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-weight: 600;
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

/* Today Summary – StempelUhr-Stil */
.today-summary { margin-top: 28px; padding: 24px; background: var(--color-surface); border-radius: var(--radius-xl); border: 1px solid var(--color-border); box-shadow: var(--shadow); }
.today-summary h3 { margin-bottom: 18px; font-size: 1.05em; font-weight: 600; color: var(--color-text-muted); letter-spacing: 0.02em; }
.summary-stats { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 2em; font-weight: 700; color: var(--color-primary); letter-spacing: -0.02em; }
.stat-label { font-size: 0.85em; color: var(--color-text-muted); }

/* Tagesziel-Differenz (StempelUhr-Feature) */
.tagesziel-card {
  margin-top: 20px;
  padding: 20px 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #0d4a6b 0%, #156a8f 60%, #1890d4 100%);
  color: white;
  box-shadow: 0 8px 24px rgba(13,74,107,0.2);
}
.tagesziel-card h3 { margin: 0 0 8px; font-size: 0.9em; opacity: 0.9; font-weight: 500; }
.tagesziel-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.tagesziel-soll { font-size: 1.1em; opacity: 0.95; }
.tagesziel-ist { font-size: 2em; font-weight: 700; letter-spacing: -0.02em; }
.tagesziel-diff { font-size: 1.2em; font-weight: 600; }
.tagesziel-diff.plus { color: #a5d6a7; }
.tagesziel-diff.minus { color: #ffab91; }
.tagesziel-diff.zero { opacity: 0.8; }

/* Geniesse deinen Tag (StempelUhr-Widget-Stil) */
.geniesse-tag-card {
  margin-top: 24px;
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #e8f4fc 0%, #f0f7fc 100%);
  border: 1px dashed rgba(32,178,255,0.4);
  color: var(--color-text-muted);
}
.geniesse-tag-card .icon { font-size: 2.5em; margin-bottom: 8px; opacity: 0.8; }
.geniesse-tag-card p { margin: 0; font-size: 1.1em; font-weight: 500; color: var(--color-text); }

/* Pause Slider – Persanesth-Farben */
.pause-track .slider-fill.pause-fill { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.pause-thumb { color: #d97706; }

/* Ruhezeit-Warnung §5 ArbZG (StempelUhr-Feature) */
.ruhezeit-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff8e6 0%, #ffecd2 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  font-size: 0.9em;
  color: #92400e;
}
.ruhezeit-icon { font-size: 1.3em; flex-shrink: 0; }
.ruhezeit-text { flex: 1; }

/* History */
.history-container h1 { margin-bottom: 24px; font-size: 1.6em; color: var(--color-text); }
.month-selector { margin-bottom: 24px; display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }
.day-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.day-date { font-weight: 600; color: var(--color-text); }
.day-total { font-weight: 700; color: var(--color-primary); }
.entry-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
}
.entry-item .entry-ort { flex: 1; min-width: 120px; }
.entry-times .time-separator { margin: 0 8px; color: var(--color-text-muted); }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table th { font-weight: 600; color: var(--color-text-muted); font-size: 0.8em; text-transform: uppercase; background: var(--color-bg); }
.data-table tr:hover { background: var(--color-bg); }

/* Admin */
.admin-container { max-width: 1400px; margin: 0 auto; }
.admin-header { margin-bottom: 24px; }
.admin-header h1 { font-size: 1.6em; color: var(--color-text); }

/* Badge */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.8em; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .admin-container { max-width: 100%; padding: 0; }
  .card { padding: 16px 14px; }

  /* Tabellen scrollbar */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 2-Spalten Grids → 1 Spalte */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Perioden-Rows (1fr 1fr auto) → stacked */
  .periode-row,
  [style*="grid-template-columns:1fr 1fr auto"],
  [style*="grid-template-columns: 1fr 1fr auto"] {
    grid-template-columns: 1fr 1fr !important;
  }
  .periode-row .btn { grid-column: 1 / -1; }

  /* Alle flex-Gaps wrappen */
  [style*="display:flex"][style*="gap:"],
  [style*="display: flex"][style*="gap:"] {
    flex-wrap: wrap !important;
  }

  /* margin-left:auto Elemente (Export-Buttons) → volle Breite */
  [style*="margin-left:auto"] {
    margin-left: 0 !important;
    width: 100%;
  }

  /* Monatsansicht Kalender: kleinere Zellen */
  .monat-tag { padding: 4px; min-height: 45px; }
  .monat-tag-nr { font-size: 0.8em; }
  .monat-tag-stunden { font-size: 0.9em; }

  /* Clock Display responsive */
  .current-time { font-size: 2.2em; }
  .status-card { padding: 14px 18px; font-size: 1em; }
  .slider-container { margin: 20px 0; }
  .slider-track { height: 50px; }
  .slider-thumb { width: 42px; height: 42px; }

  /* Today Summary Stats */
  .summary-stats { gap: 16px; }
  .stat-value { font-size: 1.6em; }

  /* Entry Items */
  .entry-item { gap: 8px; }
  .entry-item .btn { padding: 5px 10px; font-size: 0.8em; }

  /* Tagesziel */
  .tagesziel-ist { font-size: 1.6em; }

  /* Admin Header */
  .admin-header { flex-wrap: wrap; gap: 10px; }
  .admin-header h1 { font-size: 1.3em; }

  /* History */
  .history-container h1 { font-size: 1.3em; }
  .day-card { padding: 14px; }
}

/* Extra kleine Screens */
@media (max-width: 480px) {
  .container { padding: 12px 8px; }
  .card { padding: 12px 10px; }
  .btn { font-size: 0.85em; padding: 8px 14px; }
  .btn-small { font-size: 0.8em; padding: 5px 10px; }
  .current-time { font-size: 1.8em; }
  .monat-tag { min-height: 38px; padding: 2px; font-size: 0.85em; }
  .monat-woche { gap: 2px; }
  .monat-header-row { gap: 2px; font-size: 0.75em; }

  /* Alle min-width Constraints entfernen */
  [style*="min-width"] { min-width: 0 !important; }

  /* Statistik: Grid-Karten responsiver */
  [style*="grid-template-columns:repeat(auto-fit,minmax(140px"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}
