@font-face { font-family:'Inter'; src:url('fonts/inter-400.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Inter'; src:url('fonts/inter-500.woff2') format('woff2'); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'Inter'; src:url('fonts/inter-600.woff2') format('woff2'); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:'Inter'; src:url('fonts/inter-700.woff2') format('woff2'); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:'Inter'; src:url('fonts/inter-800.woff2') format('woff2'); font-weight:800; font-style:normal; font-display:swap; }

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: #eef1f6;
    color: #1a1a1a;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
    background: linear-gradient(135deg, #1a3554 0%, #1e3a5f 60%, #1d4b7a 100%);
    color: #fff;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 54px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 rgba(255,255,255,.06) inset,
                0 4px 16px rgba(0,0,0,.18),
                0 1px 3px rgba(0,0,0,.12);
}
.header-title { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.header-info { font-size: .68rem; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.header .kuerzel-badge {
    background: rgba(255,255,255,.15);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: .8rem;
    font-weight: 600;
}
.header-links { display: flex; align-items: center; gap: 0; }
.header-links a {
    color: #fff;
    text-decoration: none;
    font-size: .82rem;
    opacity: .8;
    padding: .25rem .75rem;
    border-left: 1px solid rgba(255,255,255,.18);
    white-space: nowrap;
    transition: opacity .12s, background .12s;
}
.header-links a:first-child { border-left: none; }
.header-links a:hover { opacity: 1; background: rgba(255,255,255,.08); border-radius: 4px; }
.header a { color: #fff; text-decoration: none; font-size: .85rem; opacity: .8; }
.header a:hover { opacity: 1; }

/* ── Main layout ── */
.main { padding: 1.2rem 1.5rem; }

/* ── Flash message ── */
.flash {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    border-radius: 6px;
    padding: .5rem .9rem;
    margin-bottom: 1rem;
    font-size: .85rem;
}
.flash.error {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* ── Week navigation ── */
.woche-nav {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1rem;
}
.woche-nav a, .woche-nav button, .btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: .35rem .8rem;
    font-size: .85rem;
    cursor: pointer;
    color: #374151;
    text-decoration: none;
    transition: background .12s;
}
.woche-nav a:hover, .btn:hover { background: #f3f4f6; }
.woche-label { font-weight: 600; font-size: .95rem; min-width: 10rem; text-align: center; }

.btn-primary {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
.btn-primary:hover { background: #16304f; }

.btn-danger {
    background: #fff;
    color: #dc2626;
    border-color: #fca5a5;
}
.btn-danger:hover { background: #fee2e2; }

/* ── Calendar table ── */
.kalender-wrap { overflow-x: auto; }

.kalender {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.kalender th {
    background: #f8f9fb;
    border: 1px solid #e5e7eb;
    padding: 6px 4px;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
}
.kalender th.heute { background: #dbeafe; color: #1d4ed8; }
.kalender th:first-child { width: 3rem; }

.kalender td {
    border: 1px solid #e5e7eb;
    padding: 4px;
    height: 80px;
}

.zelle-inner {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 3px;
    height: 100%;
}
.kalender td:first-child {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: #6b7280;
    background: #f8f9fb;
    vertical-align: middle;
}
.kalender td.heute-col { background: #f0f6ff; }

/* ── Angebots-Karte (Mobile) ── */
.termin-karte {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: .75rem;
    line-height: 1.35;
    border: 1px solid rgba(0,0,0,.09);
    transition: filter .1s;
    overflow: hidden;
    gap: 2px;
}
.termin-karte:hover { filter: brightness(.94); }
.termin-karte.voll { opacity: .6; }

/* ── Karten-Inhalt (shared: desktop + mobile) ── */
.ab-top {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    width: 100%;
}
.ab-kuerzel {
    font-weight: 800;
    font-size: .92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.ab-sub {
    font-weight: 400;
    font-size: .75rem;
    opacity: .65;
}
.ab-dauer {
    font-size: .72rem;
    font-weight: 600;
    background: rgba(0,0,0,.13);
    border-radius: 999px;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ab-raum {
    font-size: .78rem;
    color: rgba(0,0,0,.6);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.angebot-block.voll .ab-raum,
.termin-karte.voll .ab-raum { color: rgba(150,0,0,.75); font-weight: 600; }

/* "+" add link */
.zelle-add {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    text-decoration: none;
    color: #d1d5db;
    font-size: 1.3rem;
    border: 1.5px dashed #e5e7eb;
    transition: all .15s;
}
.zelle-add:hover { color: #1e3a5f; border-color: #93afd4; background: #eff6ff; }

/* Kompaktes "+" neben vorhandenen Terminen */
.zelle-add.compact {
    flex: 0 0 18px;
    font-size: .85rem;
    border-style: dashed;
    color: #c4c9d4;
    border-color: #e0e3ea;
    border-radius: 4px;
}

/* ── Forms ── */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
    max-width: 480px;
}
.card h2 { font-size: 1.05rem; margin-bottom: 1.1rem; color: #1e3a5f; }

.form-row { margin-bottom: .9rem; }
.form-row label { display: block; font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: .3rem; }
.form-row input, .form-row select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: .4rem .6rem;
    font-size: .9rem;
    outline: none;
    transition: border-color .12s;
}
.form-row input:focus, .form-row select:focus { border-color: #1e3a5f; }

.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; }

/* ── Termin detail page ── */
.termin-detail {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    max-width: 520px;
}
.termin-detail h2 { font-size: 1.05rem; margin-bottom: 1rem; color: #1e3a5f; }

.detail-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,.08);
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .3rem .8rem;
    font-size: .88rem;
    margin-bottom: 1.2rem;
}
.detail-grid dt { color: #6b7280; font-weight: 600; }
.detail-grid dd { color: #1a1a1a; }

.buchungen-liste { margin-top: 1.2rem; }
.buchungen-liste h3 { font-size: .88rem; font-weight: 700; color: #374151; margin-bottom: .5rem; }
.buchung-item {
    display: flex;
    justify-content: space-between;
    padding: .3rem .6rem;
    background: #f8f9fb;
    border-radius: 5px;
    margin-bottom: .25rem;
    font-size: .82rem;
}

/* ── Login page ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    width: 320px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 16px 48px rgba(0,0,0,.1);
}
.login-logo { display: block; border-radius: 16px; margin-bottom: 1rem; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.login-contact {
    position: fixed;
    bottom: .6rem;
    right: .8rem;
    font-size: .65rem;
    color: #9ca3af;
    opacity: .45;
    text-decoration: none;
}
.login-contact:hover { opacity: 1; color: #6b7280; }
.login-box h1 { font-size: 1.2rem; color: #1e3a5f; margin-bottom: .25rem; }
.login-box .subtitle { font-size: .8rem; color: #6b7280; margin-bottom: 1.5rem; }

hr.divider { border: none; border-top: 1px solid #e5e7eb; margin: 1rem 0; }

/* ── Dankes-Box ── */
.danke-box {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-top: 1.4rem;
    background: #fff;
    border-radius: 10px;
    padding: .8rem 1.2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    font-size: .88rem;
    color: #374151;
}
.danke-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.danke-box p { margin: 0; }
.danke-box strong { color: #1e3a5f; }

/* ── CSS-Grid Kalender (Desktop) ── */
.kg-grid {
    /* 150px = Header + Woche-Nav + Abstände */
    --kalender-h: calc(100vh - 150px);
    --stunde-h:   calc(var(--kalender-h) / 8);
    display: grid;
    grid-template-columns: 36px repeat(5, 1fr);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
    overflow: hidden;
}
.kg-corner {
    background: #f8f9fb;
    border-bottom: 2px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}
.kg-day-header {
    background: #f8f9fb;
    border-bottom: 2px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    padding: 6px 4px;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
}
.kg-day-header:last-child { border-right: none; }
.kg-day-header.heute { background: #dbeafe; color: #1d4ed8; }

.kg-labels {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    background: #f8f9fb;
}
.kg-label {
    height: var(--stunde-h);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.2;
}
.kg-label-nr { }
.kg-label-zeit {
    font-size: .62rem;
    font-weight: 400;
    color: #9ca3af;
}
.kg-label:last-child { border-bottom: none; }

.kg-day-col {
    position: relative;
    height: var(--kalender-h);
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}
.kg-day-col:last-child { border-right: none; }
.kg-day-col.heute-col { background: #f0f6ff; }

.kg-line {
    position: absolute;
    left: 0; right: 0;
    height: 80px;
    border-bottom: 1px solid #e5e7eb;
    pointer-events: none;
}

/* Absolut positionierter Angebots-Block */
.angebot-block {
    position: absolute;
    border-radius: 8px;
    padding: 8px 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: .82rem;
    line-height: 1.4;
    border: 1px solid rgba(0,0,0,.07);
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 3px;
    transition: box-shadow .15s ease, filter .15s ease;
    z-index: 1;
    box-sizing: border-box;
}
/* Subtiler Glanz-Verlauf oben → unten */
.angebot-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 50%);
    border-radius: inherit;
    pointer-events: none;
}
.angebot-block:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,.15), 0 2px 4px rgba(0,0,0,.08);
    filter: brightness(.96);
    z-index: 2;
}
.angebot-block.voll { opacity: .55; }
.angebot-block.vergangen {
    opacity: .6;
    filter: grayscale(1) brightness(1.05);
}
/* Admins dürfen auch vergangene Angebote öffnen (bearbeiten/löschen) */
body:not(.is-admin) .angebot-block.vergangen {
    pointer-events: none;
}

/* Schmale Blöcke (mehrere nebeneinander) */
.angebot-block.eng { padding: 5px 6px; gap: 2px; }
.angebot-block.eng .ab-kuerzel { font-size: .72rem; }
.angebot-block.eng .ab-sub { font-size: .62rem; }
.angebot-block.eng .ab-dauer { font-size: .6rem; padding: 1px 4px; }
.angebot-block.eng .ab-raum { font-size: .65rem; }

/* "+" groß in leeren Stunden */
.kg-add {
    position: absolute;
    left: 3px; right: 3px;
    height: calc(var(--stunde-h) - 6px);
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    text-decoration: none;
    color: #d1d5db;
    font-size: 1.3rem;
    border: 1.5px dashed #e5e7eb;
    transition: all .15s;
    box-sizing: border-box;
}
.kg-add:hover { color: #1e3a5f; border-color: #93afd4; background: #eff6ff; }

/* "+" schmaler Streifen neben vorhandenen Angeboten */
.kg-add-compact {
    left: auto;
    right: 2px;
    width: 22px;
    font-size: .8rem;
}
.kg-add-compact:hover { color: #1e3a5f; border-color: #93afd4; background: #eff6ff; }

/* ── Responsive ── */
.mobile-only { display: none; }

@media (max-width: 700px) {
  .desktop-only { display: none; }
  .mobile-only  { display: block; }

  /* Header */
  .header { height: auto; padding: .5rem 1rem; flex-wrap: wrap; gap: .4rem; }
  .header h1 { font-size: 1rem; flex: 1; }
  .header-links { flex-wrap: wrap; width: 100%; padding-bottom: .2rem; }
  .header-links a:first-child { border-left: none; padding-left: 0; }

  /* Woche-nav */
  .woche-nav { gap: .4rem; }
  .woche-label { font-size: .82rem; min-width: 0; }
  .btn { padding: .3rem .55rem; font-size: .8rem; }

  /* Tag-Tabs */
  .tag-tabs {
    display: flex;
    gap: 3px;
    background: #fff;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: .75rem;
  }
  .tag-tab {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 6px;
    padding: 6px 2px;
    font-size: .75rem;
    line-height: 1.3;
    cursor: pointer;
    color: #374151;
    text-align: center;
    transition: background .12s;
    font-family: inherit;
  }
  .tag-tab:hover  { background: #f3f4f6; }
  .tag-tab.active { background: #1e3a5f; color: #fff; }
  .tag-tab small  { font-size: .65rem; display: block; opacity: .85; }

  /* Tag-Panels */
  .tag-panel { display: none; }
  .tag-panel.active { display: block; }

  /* Mobile Kalender: absolut positioniert wie Desktop */
  .m-kalender {
    /* --m-stunde-h wird per inline style aus PHP gesetzt */
    display: flex;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
  }
  .m-kg-labels {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    background: #f8f9fb;
    flex-shrink: 0;
    width: 28px;
  }
  .m-kg-label {
    height: var(--m-stunde-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
  }
  .m-kg-label:last-child { border-bottom: none; }
  .m-kg-col {
    flex: 1;
    position: relative;
    height: calc(var(--m-stunde-h) * 8);
    overflow: hidden;
  }
  .m-kg-line {
    position: absolute;
    left: 0; right: 0;
    height: var(--m-stunde-h);
    border-bottom: 1px solid #e5e7eb;
    pointer-events: none;
  }
}

/* ── Radio group als Toggle ── */
.radio-group { display: flex; flex-direction: row; gap: .5rem; margin-top: .15rem; }
.radio-option {
    flex: 1;
    cursor: pointer;
}
.radio-option input[type=radio] { display: none; }
.radio-option span {
    display: block;
    text-align: center;
    padding: .45rem .6rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 500;
    border: 1.5px solid #d1d5db;
    color: #6b7280;
    background: #f9fafb;
    transition: all .15s;
    user-select: none;
}
.radio-option input[type=radio]:checked + span {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
    font-weight: 600;
}
