/*
 * Timetracker – pures CSS, kein Build-Step (Propshaft).
 * Farbwelt angelehnt an das be2morrow-Branding (Blau #186FAF, Grün #40B050, Cyan #00B0F0).
 */

:root {
  --color-bg: #f4f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #111827;
  --color-muted: #64748b;
  --color-primary: #186faf;
  --color-primary-dark: #135a8f;
  --color-primary-light: #2680c2;
  --color-green: #40b050;
  --color-green-dark: #35933f;
  --color-cyan: #00b0f0;
  --color-danger: #dc2626;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 3px rgba(15, 41, 66, 0.08), 0 1px 2px rgba(15, 41, 66, 0.04);
  --shadow-pop: 0 10px 30px rgba(15, 41, 66, 0.12);
}

* { box-sizing: border-box; }

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

h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1.25rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

/* ---------- Navigation ---------- */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(15, 41, 66, 0.05);
  padding: 0.55rem 1.25rem;
}

.brand a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-right: 0.75rem;
}
.brand a:hover { text-decoration: none; color: var(--color-text); }
.brand .brand-two { color: var(--color-green); }
.brand .brand-app {
  font-weight: 600;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-cyan));
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.main-nav a:not(.brand a) { }
.main-nav > a {
  color: var(--color-muted);
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
}
.main-nav > a:hover {
  color: var(--color-primary);
  background: #eef4fa;
  text-decoration: none;
}

.nav-spacer { flex: 1; }
.nav-user { color: var(--color-muted); font-size: 0.85rem; margin-right: 0.5rem; }

/* ---------- Flash ---------- */
.flash {
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-notice { background: #ecf8ee; color: #1f6b2c; border-color: #c8ebcd; }
.flash-alert { background: #fdecec; color: #8f1d1d; border-color: #f6caca; }

/* ---------- Kopfzeile / Wochennavigation ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; }

.week-nav { display: flex; align-items: center; gap: 0.6rem; }

/* ---------- Formulare ---------- */
.entry-form .form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.form-field { display: flex; flex-direction: column; }
.form-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}
.form-field-wide { flex: 1; min-width: 240px; }
.form-submit { justify-content: flex-end; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], select, textarea {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(24, 111, 175, 0.18);
}

input[type="submit"], button[type="submit"], .button {
  padding: 0.55rem 1.15rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

input[type="submit"]:hover, button[type="submit"]:hover, .button:hover { background: var(--color-primary-dark); }
input[type="submit"]:active, button[type="submit"]:active { transform: translateY(1px); }

.button { display: inline-block; }
a.button:hover { color: #fff; text-decoration: none; }

.button-secondary {
  padding: 0.35rem 0.8rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.button-secondary:hover { text-decoration: none; border-color: var(--color-primary); color: var(--color-primary); }

.link-button button, button.link-button, .link-button input[type="submit"] {
  background: none;
  border: none;
  color: var(--color-danger);
  padding: 0;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.link-button button:hover, .link-button input[type="submit"]:hover { background: none; text-decoration: underline; }
form.link-button { display: inline; }

.form-errors {
  background: #fdecec;
  color: #8f1d1d;
  border: 1px solid #f6caca;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  margin-bottom: 1rem;
}
.form-errors h2 { font-size: 0.95rem; margin: 0 0 0.4rem; }
.form-errors ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Karten ---------- */
.quick-entry, .chart-card, .report-filters {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.quick-entry {
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.5rem;
  border-top: 3px solid var(--color-green);
}
.quick-entry h2 { color: var(--color-text); }

/* ---------- Filterleiste ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.inline-form { display: flex; align-items: center; gap: 0.5rem; }
.inline-form label { font-weight: 600; font-size: 0.9rem; color: var(--color-muted); }

.week-total {
  font-size: 0.95rem;
  color: var(--color-muted);
}
.week-total strong {
  color: var(--color-green-dark);
  font-size: 1.05rem;
}

/* ---------- Tages-Gruppen & Tabellen ---------- */
.day-group { margin-bottom: 1.75rem; }
.day-group h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 0.6rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--color-green);
  font-weight: 700;
}
.day-total { color: var(--color-muted); font-weight: 600; font-size: 0.9rem; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  background: #f8fafc;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f2f8fd; }
td.actions { white-space: nowrap; }
td.actions > * { margin-right: 0.5rem; }

.empty-state { color: var(--color-muted); font-style: italic; }

/* ---------- Berichte ---------- */
.report-filters {
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.report-period { color: var(--color-muted); margin: 0 0 1rem; }
.report-period strong { color: var(--color-text); }

.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 800px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card { padding: 1.15rem 1.25rem; }

.bar-cell { min-width: 200px; }
.bar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-cyan));
  height: 0.9rem;
  border-radius: 4px;
  min-width: 2px;
}

.report-total td { font-weight: 700; border-top: 2px solid var(--color-border); background: #f8fafc; }

/* ---------- Kalender ---------- */
.calendar-event {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-cyan);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.85rem;
}
.calendar-event.imported { opacity: 0.65; border-left-color: var(--color-green); }
.calendar-event .event-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.event-title { font-weight: 700; }
.event-time { color: var(--color-muted); font-size: 0.9rem; }
.imported-badge {
  color: var(--color-green-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---------- Einstellungen ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border-top: 3px solid var(--color-primary);
  padding: 1.15rem 1.25rem;
}
.settings-card:nth-child(2) { border-top-color: var(--color-green); }
.settings-card:nth-child(3) { border-top-color: var(--color-cyan); }

.settings-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.settings-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border);
}
.settings-list li:last-child { border-bottom: none; }

.settings-name { font-weight: 500; }
.settings-usage {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-muted);
}
.settings-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.settings-add { margin-top: 0.25rem; }
.settings-add input[type="text"] { flex: 1; min-width: 0; }
.settings-edit-form { flex: 1; }
.settings-edit-form input[type="text"] { flex: 1; min-width: 0; }

/* ---------- Login ---------- */
.auth-page body, body.auth {
  background: var(--color-bg);
}

.auth-box {
  max-width: 400px;
  margin: 5rem auto 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 2rem 1.75rem;
  border-top: 4px solid var(--color-green);
}

.auth-brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.auth-brand .brand-two { color: var(--color-green); }
.auth-sub {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.auth-box h1 { font-size: 1.1rem; margin-bottom: 1rem; }
.auth-box input { width: 100%; margin-bottom: 0.85rem; }
.auth-box input[type="submit"] { margin-bottom: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  color: var(--color-muted);
  margin: 1.1rem 0;
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--color-border);
}
.auth-divider:empty { margin: 0.75rem 0; }

.ms-button { display: block; width: 100%; }
.ms-button input[type="submit"], .ms-button button {
  width: 100%;
  background: #24292f;
}
.ms-button input[type="submit"]:hover, .ms-button button:hover { background: #101418; }

.auth-links { margin-top: 1.1rem; font-size: 0.9rem; text-align: center; }
