/* OFC Sotiria – Fanaktionen Dashboard */

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

:root {
  --bg: #0d0d0d;
  --bg-alt: #111111;
  --bg-card: #141414;
  --border: #2a2a2a;
  --border-soft: #1e1e1e;
  --text: #e0e0e0;
  --text-dim: #999999;
  --text-faint: #666666;
  --white: #ffffff;
  --red: #ff4444;
  --red-dark: #660000;
  --red-bg: #1a0000;
  --green: #66cc66;
  --green-bg: #002a00;
  --yellow: #cccc44;
  --yellow-bg: #2a2a00;
  --blue: #6699cc;
  --blue-bg: #001a2a;
  --purple: #cc88ff;
  --purple-bg: #1a0030;
  --radius: 8px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

h1 { font-size: 22px; color: var(--white); }
h2 { font-size: 17px; color: #cccccc; margin: 0 0 14px; border-left: 3px solid var(--red-dark); padding-left: 10px; }
h3 { font-size: 13px; color: #bbbbbb; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }

/* ── Login ── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1a1a1a 0%, #0d0d0d 60%);
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box .subtitle { text-align: center; color: var(--text-faint); font-size: 12px; margin-bottom: 24px; }
.login-box label { display: block; font-size: 12px; color: var(--text-dim); margin: 14px 0 5px; text-transform: uppercase; letter-spacing: .04em; }
.login-box input { width: 100%; }
.login-box .btn-block { width: 100%; margin-top: 22px; }

/* ── Layout ── */
.topbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  min-height: 58px;
}
.brand { font-weight: 700; color: var(--white); white-space: nowrap; }
.brand-sub { color: var(--text-faint); font-weight: 400; font-size: 12px; margin-left: 4px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tab {
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
}
.tab:hover { background: #1c1c1c; text-decoration: none; color: var(--text); }
.tab.active { background: var(--red-bg); color: var(--red); font-weight: 600; }
.user-menu { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; white-space: nowrap; }

.mobile-menu { display: contents; }
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
}
.nav-toggle:hover { background: #1c1c1c; }

.content { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.footer { text-align: center; color: var(--text-faint); font-size: 11px; padding: 24px; border-top: 1px solid var(--border-soft); margin-top: 40px; }

.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ── Forms ── */
input[type=text], input[type=password], input[type=number], input[type=file],
textarea, select {
  background: #0a0a0a;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--red-dark); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-field label { display: block; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.form-field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.btn {
  display: inline-block;
  background: #1c1c1c;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #262626; text-decoration: none; }
.btn-primary { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-primary:hover { background: #7a0000; }
.btn-danger { background: #2a0000; border-color: #440000; color: #ff8888; }
.btn-danger:hover { background: #3a0000; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Cards / boxes ── */
.section-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.new-form-box { border-style: dashed; }

.card-list { display: flex; flex-direction: column; gap: 12px; }
.item-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.item-card summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.item-card summary::-webkit-details-marker { display: none; }
.item-card summary .chev { color: var(--text-faint); margin-left: auto; font-size: 12px; }
.item-title { font-weight: 600; color: var(--white); flex: 1; min-width: 160px; }
.item-meta { color: var(--text-faint); font-size: 12px; }
.item-body { padding: 0 16px 16px; border-top: 1px solid var(--border-soft); }
.item-body-inner { padding-top: 14px; }
.item-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; white-space: pre-wrap; }
.item-notes { color: var(--text-faint); font-size: 12px; font-style: italic; margin-bottom: 10px; white-space: pre-wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-red { background: var(--red-bg); color: #ff6666; }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-grey { background: #1c1c1c; color: var(--text-dim); }

/* ── Tables (KLR) ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 4px; }
.table-scroll table { margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
th { background: #1a1a1a; color: #aaaaaa; padding: 8px 10px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-size: 13px; }
tr:hover td { background: #171717; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-row td { background: var(--red-bg); color: #ff6666; font-weight: bold; border-top: 2px solid var(--red-dark); }
.subtotal-row td { background: #111; color: #cccccc; font-weight: 600; }
.row-actions { white-space: nowrap; }

.info-row { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; flex: 1; min-width: 140px; }
.info-card .val { font-size: 24px; font-weight: bold; color: #fff; }
.info-card .lbl { font-size: 11px; color: var(--text-faint); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Vorlagen ── */
.vorlagen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.vorlage-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vorlage-preview { height: 150px; background: #060606; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vorlage-preview img, .vorlage-preview object { max-width: 100%; max-height: 100%; }
.vorlage-preview .icon { font-size: 40px; color: var(--text-faint); }
.vorlage-info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.vorlage-title { font-weight: 600; color: var(--white); font-size: 13px; }
.vorlage-desc { color: var(--text-faint); font-size: 12px; flex: 1; }
.vorlage-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border-soft); }

/* ── Kommentare ── */
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.comment { background: #0f0f0f; border: 1px solid var(--border-soft); border-radius: 6px; padding: 10px 12px; }
.comment-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-author { color: var(--purple); font-weight: 600; }
.comment-date { color: var(--text-faint); }
.comment-text { color: var(--text); font-size: 13px; white-space: pre-wrap; }
.comment-tag { font-size: 11px; color: var(--text-faint); }
.comment-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.comment-form .form-field { flex: 1; min-width: 160px; }
.comment-form textarea { min-height: 40px; }

.empty-state { color: var(--text-faint); font-size: 13px; padding: 20px 0; text-align: center; }

.note { font-size: 12px; color: var(--text-faint); margin-top: 8px; font-style: italic; }

/* ── Alerts ── */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 18px; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #0a3a0a; }
.alert-error { background: var(--red-bg); color: #ff8888; border: 1px solid #440000; }

/* ── Mobil ── */
@media (max-width: 780px) {
  .topbar-inner { gap: 10px; padding: 10px 16px; flex-wrap: wrap; }
  .brand-sub { display: none; }

  .nav-toggle { display: block; }

  .mobile-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }
  .mobile-menu.open { display: flex; }
  .tabs { flex-direction: column; gap: 2px; width: 100%; }
  .tab { padding: 12px 14px; width: 100%; }
  .user-menu { justify-content: space-between; width: 100%; padding-bottom: 6px; }

  .content { padding: 16px 14px 48px; }

  h1 { font-size: 19px; }
  h2 { font-size: 16px; }

  .login-box { padding: 24px 20px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; text-align: center; }

  .item-card summary { padding: 12px; gap: 8px; }
  .item-title { min-width: 100%; order: -1; font-size: 15px; }

  table { font-size: 12px; }
  th, td { padding: 7px 8px; }
  .vorlagen-grid { grid-template-columns: 1fr 1fr; }

  /* Die "⋯"-Bearbeiten-Popover (position:absolute) sind auf schmalen Screens
     unbrauchbar (Tabellenspalten lassen sich nicht per position:static aufweiten) ->
     auf Mobil als zentriertes Overlay einblenden statt in der Zelle schweben lassen. */
  .row-actions details > div {
    position: fixed !important;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
  }
  .row-actions .section-box {
    position: static !important;
    min-width: 0 !important;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
  }

  .comment-form .form-field { min-width: 0; flex-basis: 100%; }
  .comment-form input[type=text] { max-width: 100% !important; }
  .comment-form .btn { width: 100%; }
}

@media (max-width: 480px) {
  .vorlagen-grid { grid-template-columns: 1fr; }
  .info-card { min-width: 100%; }
}
