/* ============================================================
   style.css – Fristomat | itkoordinator.de
   ============================================================ */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  --navy-deep:  #0c2340;
  --navy-mid:   #1a3a6e;
  --orange:     #e8640a;
  --orange-hover: #c8520a;
  --border:     #dce5f2;
  --bg:         #f6f9fe;
  --text:       #1f2a44;
  --text-light: #6b7a99;
  --white:      #ffffff;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
  --sidebar-w:  220px;
  --topnav-h:   52px;
  --radius:     6px;
  --shadow:     0 2px 8px rgba(12,35,64,.12);
  --shadow-card:0 4px 16px rgba(12,35,64,.15);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--navy-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: .3em; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--navy-deep); }

/* ── Top-Navigation ───────────────────────────────────────── */
.topnav {
  background: var(--navy-deep);
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.topnav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white) !important;
  letter-spacing: -.01em;
  text-decoration: none;
}

.topnav-logo em {
  font-style: normal;
  color: var(--orange);
}

.topnav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.topnav-links a {
  color: rgba(255,255,255,.82);
  font-size: .88rem;
  letter-spacing: .02em;
  transition: color .15s;
  text-decoration: none;
}

.topnav-links a:hover { color: var(--orange); text-decoration: none; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 1rem;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: .2s;
}

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topnav-h));
}

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy-deep);
  color: var(--white);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 2rem;
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.6rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.02em;
  margin-bottom: .15rem;
}

.sidebar-subtitle {
  font-size: .78rem;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sidebar-nav {
  list-style: none;
  padding: .6rem 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li { margin: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1.2rem;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  transition: background .15s, color .15s;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(232,100,10,.18);
  color: var(--white);
  border-left-color: var(--orange);
  font-weight: 600;
}

.sidebar-nav .nav-icon {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  background: var(--bg);
}

.tab-section { display: none; }
.tab-section.active { display: block; }

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy-deep);
  margin-bottom: 1.5rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}

.section-title small {
  font-size: .8rem;
  font-weight: 400;
  color: var(--text-light);
  margin-left: .5rem;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group.two-col {
  grid-column: span 2;
}

label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--navy-mid);
  letter-spacing: .01em;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: .45rem .7rem;
  font-family: var(--font);
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  appearance: auto;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(26,58,110,.12);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-top: .2rem;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  accent-color: var(--navy-mid);
}

.checkbox-row label {
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}

.inline-group {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.inline-group input[type="number"] {
  max-width: 90px;
}

.form-hint {
  font-size: .78rem;
  color: var(--text-light);
  margin-top: .15rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, transform .08s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

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

.btn-secondary {
  background: var(--navy-mid);
  color: var(--white);
}
.btn-secondary:hover { background: var(--navy-deep); }

.btn-outline {
  background: transparent;
  color: var(--navy-mid);
  border: 1.5px solid var(--navy-mid);
}
.btn-outline:hover {
  background: var(--navy-mid);
  color: var(--white);
}

.btn-danger {
  background: #c0392b;
  color: var(--white);
}
.btn-danger:hover { background: #a93226; }

.btn-sm {
  padding: .28rem .65rem;
  font-size: .8rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.25rem;
}

/* ── Fehlermeldungen ──────────────────────────────────────── */
.form-message {
  display: none;
  padding: .6rem .9rem;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 1rem;
}

.form-message-error {
  background: #fdf0ee;
  color: #9b2a1a;
  border: 1px solid #f4c0bb;
}

.form-message-success {
  background: #edf7ed;
  color: #1e6e1e;
  border: 1px solid #b8ddb8;
}

/* ── Ergebnis-Card ────────────────────────────────────────── */
.result-card {
  display: none;
  background: var(--white);
  border: 2px solid var(--navy-mid);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow-card);
}

.result-row {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child { border-bottom: none; }

.result-label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-light);
  min-width: 130px;
  flex-shrink: 0;
}

.result-value { color: var(--text); font-size: .95rem; }

.result-deadline { padding: .7rem 0; }

.result-big {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy-deep);
}

.result-hint {
  background: #fffbee;
  border: 1px solid #f0e080;
  border-radius: 4px;
  padding: .5rem .75rem;
  margin: .5rem 0;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .88rem;
  color: #6b4a00;
  border-bottom: none;
}

.result-icon { font-size: 1rem; flex-shrink: 0; }

.result-summary-text {
  margin-top: 1rem;
}

.result-summary-text label {
  display: block;
  margin-bottom: .3rem;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text-light);
}

.result-summary-text textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  border-color: var(--border);
  font-size: .85rem;
  line-height: 1.5;
}

/* ── Fristenliste ─────────────────────────────────────────── */
.list-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.list-controls input[type="text"] {
  max-width: 280px;
  flex: 1 1 200px;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

thead { background: var(--navy-mid); color: var(--white); }

th {
  padding: .6rem .75rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .03em;
  white-space: nowrap;
}

td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(26,58,110,.04); }

/* Farbmarkierungen */
tr.row-overdue td { background: #fff0ee; }
tr.row-today    td { background: #fff8f0; }
tr.row-soon3    td { background: #fffbee; }
tr.row-soon7    td { background: #f0f8ff; }

.list-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: .9rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.2rem;
  margin-top: .75rem;
  font-size: .78rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.12);
}

/* ── Einstellungen ────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem 1.5rem;
}

/* ── Hilfe ────────────────────────────────────────────────── */
.help-section {
  max-width: 720px;
}

.help-section h3 {
  font-size: 1.05rem;
  color: var(--navy-mid);
  margin: 1.5rem 0 .6rem;
}

.help-section h3:first-child { margin-top: 0; }

.help-section p {
  line-height: 1.65;
  color: var(--text);
  font-size: .92rem;
  margin-bottom: .6rem;
}

.help-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.disclaimer-box {
  background: #fffbee;
  border: 1px solid #e8d060;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  font-size: .88rem;
  line-height: 1.6;
  color: #5a4200;
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: .5rem;
}

.example-table th {
  background: var(--navy-mid);
  color: var(--white);
  padding: .45rem .65rem;
  text-align: left;
  font-size: .78rem;
}

.example-table td {
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--border);
}

.example-table tr:last-child td { border-bottom: none; }
.example-table tbody tr:nth-child(even) { background: var(--bg); }

/* ── Trennlinien ──────────────────────────────────────────── */
hr.form-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.subsection-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy-mid);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .topnav-links { display: none; }

  #sidebar {
    position: fixed;
    top: var(--topnav-h);
    left: -100%;
    height: calc(100vh - var(--topnav-h));
    z-index: 90;
    transition: left .25s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.3);
  }

  #sidebar.open { left: 0; }

  .main-content {
    padding: 1.25rem 1rem;
  }

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

  .form-group.two-col {
    grid-column: span 1;
  }

  .result-label {
    min-width: 100px;
  }

  .result-big { font-size: 1.1rem; }

  .btn-group { gap: .4rem; }
  .btn { padding: .45rem .85rem; font-size: .84rem; }

  .list-controls { flex-direction: column; align-items: stretch; }
  .list-controls input[type="text"] { max-width: none; }
}

@media (max-width: 480px) {
  .topnav { padding: 0 .75rem; }
  .main-content { padding: 1rem .75rem; }
  .section-title { font-size: 1.2rem; }
  .form-card { padding: 1rem; }
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  .topnav,
  #sidebar,
  .btn-group,
  .btn,
  .form-card,
  .list-controls,
  .hamburger {
    display: none !important;
  }

  body { background: white; color: black; font-size: 11pt; }

  .app-shell { display: block; }

  .main-content {
    padding: 0;
    background: white;
  }

  .tab-section { display: none !important; }
  .tab-section.active { display: block !important; }

  .result-card {
    display: block !important;
    border: 1px solid #999;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .result-big { font-size: 14pt; }

  table { font-size: 9pt; }
  thead { background: #eee !important; color: black !important; }
  th { color: black !important; }

  tr.row-overdue td { background: #fff0ee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr.row-today    td { background: #fff8f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr.row-soon3    td { background: #fffbee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr.row-soon7    td { background: #f0f8ff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .table-wrapper { border: 1px solid #ccc; box-shadow: none; }

  a[href]::after { content: none; }
}
