/* ============================================================
   main.css – Schullaufbahnbogen
   Design: SPH-inspiriertes Portal mit Kacheln
   ============================================================ */

:root {
  --c-bg: #f0f2f5;
  --c-surface: #ffffff;
  --c-border: #d0cfc9;
  --c-text: #1a1a1a;
  --c-text-muted: #6b6b6b;
  --c-primary: #1a2d4a;
  --c-primary-h: #243d60;
  --c-accent: #c8860a;
  --c-accent-h: #a36d08;
  --c-success: #1a6e3c;
  --c-danger: #9b1c1c;
  --c-portal-org: #e87722; /* SPH-Orange */
  --font-sans: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Portal-Header (SPH-Stil) ───────────────────────────── */
.portal-header {
  background: #fff;
  border-bottom: 4px solid var(--c-portal-org);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.portal-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.portal-school {
  font-weight: 700;
  font-size: 17px;
  color: var(--c-primary);
  letter-spacing: -0.01em;
}
.portal-sub {
  font-size: 11px;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
}
.portal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.portal-user-pill {
  background: var(--c-portal-org);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 20px;
}
.portal-logout-btn {
  color: var(--c-text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}
.portal-logout-btn:hover {
  color: var(--c-danger);
}

/* ── Portal-Hauptbereich ────────────────────────────────── */
.portal-main {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}
.portal-greeting {
  margin-bottom: 2rem;
}
.portal-greeting h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: 0.2rem;
}
.portal-greeting p {
  color: var(--c-text-muted);
  font-size: 14px;
}
.portal-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--c-border);
}

/* ── Kacheln ────────────────────────────────────────────── */
.kacheln-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  max-width: 900px;
}

.kachel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  color: #fff;
  min-height: 160px;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    filter 0.1s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}
.kachel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.15s;
}
.kachel:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
.kachel:hover::after {
  background: rgba(255, 255, 255, 0.07);
}
.kachel:active {
  transform: translateY(0);
}

.kachel--blue {
  background: linear-gradient(135deg, #1a2d4a 0%, #2a4d7a 100%);
}
.kachel--green {
  background: linear-gradient(135deg, #1a5c30 0%, #2d8a50 100%);
}
.kachel--dark {
  background: linear-gradient(135deg, #2d2d2d 0%, #4a4a4a 100%);
}
.kachel--orange {
  background: linear-gradient(135deg, #c8640a 0%, #e87722 100%);
}

.kachel-icon {
  font-size: 2.5rem;
  margin-bottom: auto;
  line-height: 1;
}
.kachel-content {
  margin-top: 1rem;
  width: 100%;
}
.kachel-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.kachel-info {
  font-size: 12px;
  opacity: 0.85;
}
.kachel-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.kachel-badge--green {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.kachel-badge--orange {
  background: rgba(255, 200, 0, 0.3);
  color: #ffe;
}
.kachel-badge--gray {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}
.kachel-badge--white {
  background: rgba(255, 255, 255, 0.9);
  color: #1a5c30;
}

/* ── Login-Seite ─────────────────────────────────────────── */
.login-body {
  background: #e8edf2;
}
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  color: var(--c-text-muted);
  font-size: 13px;
  margin-bottom: 1.75rem;
}
.login-card .form-group {
  text-align: left;
}
.btn-portal {
  background: var(--c-portal-org);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.btn-portal:hover {
  background: #d06812;
}
.btn-block {
  width: 100%;
  justify-content: center;
}

/* ── Interner Header (für pages/) ───────────────────────── */
.site-header {
  background: var(--c-primary);
  color: #fff;
  border-bottom: 3px solid var(--c-portal-org);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--c-portal-org);
  color: #fff;
  padding: 3px 7px;
  border-radius: 3px;
  font-weight: 600;
}
.brand-text {
  font-weight: 600;
  font-size: 14px;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav-user {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav-role {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}
.nav-role--student {
  background: #1a4a2d;
  color: #fff;
}
.nav-role--tutor {
  background: #1a2d4a;
  color: #fff;
}
.nav-role--admin {
  background: #4a1a1a;
  color: #fff;
}
.nav-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.nav-link:hover {
  color: #fff;
}
.nav-link--logout {
  color: rgba(255, 255, 255, 0.5);
}
.nav-link--logout:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Site Main ───────────────────────────────────────────── */
.site-main {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}

/* ── Footer ─────────────────────────────────────────────── */
.portal-footer {
  background: var(--c-primary);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-family: var(--font-mono);
  text-align: center;
  padding: 0.6rem 1.5rem;
}
.site-footer {
  background: var(--c-primary);
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-family: var(--font-mono);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
}

/* ── Typografie ─────────────────────────────────────────── */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--c-primary);
}
.page-header h1 {
  margin-bottom: 0;
}

/* Info-Bar unter Seitenheader */
.info-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  background: #f8f7f4;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
}
.info-bar strong {
  color: var(--c-text);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 2px;
  font-weight: 600;
}
.badge--draft {
  background: #e8e4d8;
  color: #6b6b6b;
}
.badge--submitted {
  background: #d4edd9;
  color: var(--c-success);
}
.badge--new {
  background: #fde9cc;
  color: var(--c-accent);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--c-border);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--c-primary-h);
}
.btn-accent {
  background: var(--c-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--c-accent-h);
}
.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
}
.btn-outline:hover {
  background: var(--c-primary);
  color: #fff;
}
.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── Formulare ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.1rem;
}
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--c-primary);
}
select.form-control {
  cursor: pointer;
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 13px;
  border-left: 4px solid;
}
.alert-error {
  background: #fde8e8;
  color: var(--c-danger);
  border-color: var(--c-danger);
}
.alert-success {
  background: #d4edd9;
  color: var(--c-success);
  border-color: var(--c-success);
}
.alert-info {
  background: #dce8f5;
  color: var(--c-primary);
  border-color: var(--c-primary);
}

/* ── Tabellen ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--c-primary);
  color: #fff;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: #f8f7f4;
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* ── Laufbahnbogen-Tabelle ───────────────────────────────── */
.laufbahn-wrap {
  overflow-x: auto;
}
.laufbahn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 860px;
}
.laufbahn-table th {
  background: var(--c-primary);
  color: #fff;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}
.laufbahn-table td {
  padding: 6px 10px;
  border: 1px solid var(--c-border);
  vertical-align: middle;
}
.feld-cell {
  background: var(--c-primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  padding: 12px 8px;
  letter-spacing: 0.1em;
}
.fach-cell {
  font-weight: 500;
  min-width: 170px;
}
.pflicht-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
}
.hj-cell {
  text-align: center;
  width: 46px;
  padding: 0;
  min-width: 52px;
  width: 52px;
  height: 100%;
}

/* Stunden-Badge */
.hj-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 24px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  background: #eee;
  transition:
    background 0.12s,
    color 0.12s;
  user-select: none;
  padding: 0px;
}
.hj-display.hj-active {
  background: var(--c-primary);
  color: #fff;
}
.hj-display.hj-lk.hj-active {
  background: var(--c-portal-org);
  color: #fff;
}
.hj-display.hj-clickable {
  cursor: pointer;
}
.hj-display.hj-clickable:hover {
  background: #c8d8ec;
  color: var(--c-primary);
}

/* Prüfungsfach */
.pruef-select {
  width: 62px;
  padding: 3px 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1.5px solid var(--c-border);
  border-radius: 2px;
  background: var(--c-surface);
  text-align: center;
}

/* Einbringpflicht */
.einbring-cell {
  text-align: center;
  width: 44px;
  background: #f2f5f2;
}
.einbring-input {
  width: 34px;
  padding: 3px 2px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #b8cfc0;
  border-radius: 2px;
  background: #fff;
  color: var(--c-success);
  -moz-appearance: textfield;
}
.einbring-input::-webkit-outer-spin-button,
.einbring-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.einbring-input:focus {
  outline: none;
  border-color: var(--c-success);
}
.einbring-input[readonly] {
  opacity: 0.7;
  cursor: not-allowed;
}

.field-separator td {
  background: var(--c-bg);
  height: 4px;
  padding: 0;
  border: none;
}
.sum-row td {
  background: #f0efe9;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
}
.form-locked .pruef-select {
  pointer-events: none;
  opacity: 0.7;
}

/* Legende */
.lk-legende {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.lk-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 11px;
}
.lk-p1 {
  background: #c07008;
  color: #fff;
}
.lk-p2 {
  background: #c07008;
  color: #fff;
}
.lk-p {
  background: #b4c008;
  color: #fff;
}
.lk-gk {
  background: #0bee1e;
  color: #fff;
}

/* ── Stats ───────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-box {
  flex: 1;
  min-width: 120px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--c-primary);
  display: block;
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  margin-top: 0.35rem;
}

.student-link {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 500;
}
.student-link:hover {
  text-decoration: underline;
}

/* Freie Kurse Spalte (dunkler grün) */
.einbring-frei {
  background: #e8f2ec;
}
.einbring-frei .frei-input {
  color: #1a5c30;
  border-color: #8ac0a0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .portal-main,
  .site-main {
    padding: 1rem;
  }
  .page-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  .header-inner {
    padding: 0 1rem;
  }
  h1 {
    font-size: 1.2rem;
  }
  .kacheln-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/*BEarbeiten der Boxen*/
/* Zelle als klickbarer Block */
.hj-label {
  display: flex;
  align-items: center; /* vertikal zentriert */
  justify-content: center; /* horizontal zentriert */
  width: 100%;
  min-height: 100%;
  height: 100%;
  cursor: pointer;
}

/* Checkbox verstecken */
.hj-checkbox {
  display: none;
}

/* Span füllt die Zelle aus */
.hj-display {
  display: block;
  width: 100%;
  text-align: center; /* Text zentriert */
  user-select: none;
  padding: 3px;
}

/* Aktiver Zustand */
.hj-display.hj-active {
  font-weight: 600;
  color: #fff;
}

/* LK-Zustand */
.hj-display.hj-lk {
  color: var(--c-accent);
}

/* td selbst als flex-container */
td.hj-cell {
  /* !! */
  align-items: center;
  justify-content: center;
}

@media print {
  /* Navigation und UI ausblenden */
  .site-header,
  .site-footer,
  .page-header,
  .form-actions,
  .lk-legende,
  .alert,
  .btn {
    display: none !important;
  }

  /* Print-Button selbst auch ausblenden */
  button {
    display: none !important;
  }

  /* Layout zurücksetzen */
  body {
    background: white !important;
    color: black !important;
    font-size: 10px !important;
    display: block !important;
  }

  .site-main {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .hj-display.hj-locked {
    cursor: not-allowed;
    opacity: 0.85;
  }

  /* Info-Bar kompakt */
  .info-bar {
    border: 1px solid #ccc !important;
    background: white !important;
    padding: 4px 8px !important;
    margin-bottom: 6px !important;
    color: black !important;
  }

  /* Card ohne Deko */
  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Tabelle */
  .laufbahn-wrap {
    overflow: visible !important;
  }

  .laufbahn-table {
    width: 100% !important;
    font-size: 8px !important;
    min-width: unset !important;
  }

  .laufbahn-table th,
  .laufbahn-table td {
    padding: 2px 3px !important;
    border: 1px solid #888 !important;
    color: black !important;
    background: white !important;
  }

  /* Farbige Theader-Zellen lesbar machen */
  .laufbahn-table th {
    background: #ddd !important;
    color: black !important;
  }

  .feld-cell {
    background: #ccc !important;
    color: black !important;
  }

  .hj-display {
    background: transparent !important;
    color: black !important;
    border: 1px solid #aaa !important;
    width: 20px !important;
    height: 16px !important;
    font-size: 8px !important;
  }

  .pruef-select {
    border: none !important;
    font-size: 8px !important;
    width: auto !important;
  }

  .einbring-cell,
  .einbring-frei {
    background: #f5f5f5 !important;
  }

  .einbring-input {
    border: none !important;
    background: transparent !important;
    color: black !important;
    font-size: 8px !important;
    width: auto !important;
  }

  .field-separator {
    display: none !important;
  }

  tr {
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  @page {
    size: A4 landscape;
    margin: 1cm;
  }
}
