/* tradepost – FAU design */
:root {
  --fau-blue: #04316a;
  --fau-blue-dark: #03234c;
  --fau-red: #c50f3c;
  --fau-amber: #fdb735;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-muted: #46505c;
  --border: #cdd5de;
  --focus: #c50f3c;
  --error-bg: #fdecef;
  --error-border: #c50f3c;
  --success-bg: #e6f2e6;
  --success-border: #2e7d32;
  --info-bg: #e8eef6;
  --info-border: #04316a;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }

.container {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

/* ---------- accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fau-blue);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 4px solid var(--fau-blue);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.brand img { height: 44px; width: auto; }
.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fau-blue);
  display: block;
  line-height: 1.1;
}
.brand-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-nav {
  border-top: 1px solid var(--border);
  padding: 0.15rem 0;
}
.site-nav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: 4px;
  color: var(--fau-blue);
  font-weight: 600;
  text-decoration: none;
}
.site-nav a:hover { background: var(--info-bg); text-decoration: underline; }
.nav-dropdown { position: relative; }
.nav-dropdown > a::after {
  content: "";
  display: inline-block;
  margin-left: 0.35rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentcolor;
}
.site-nav .nav-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 14rem;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0.25rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(3, 35, 76, 0.15);
  z-index: 50;
}
.nav-dropdown:hover > .nav-submenu,
.nav-dropdown:focus-within > .nav-submenu { display: block; }
.nav-submenu a {
  color: var(--text);
  font-weight: 400;
  white-space: nowrap;
}
.nav-submenu a:hover { background: var(--info-bg); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lang-switch {
  font-weight: 700;
  display: flex;
  gap: 0.15rem;
  align-items: center;
}
.lang-switch a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
}
.lang-switch a.active {
  color: var(--fau-blue);
  background: var(--info-bg);
  text-decoration: none;
}
.user-chip {
  font-weight: 600;
  color: var(--text-muted);
}
.inline-form { display: inline; margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  background: var(--fau-blue);
  color: #fff;
  border: 2px solid var(--fau-blue);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--fau-blue-dark); border-color: var(--fau-blue-dark); }
.btn-outline {
  background: transparent;
  color: var(--fau-blue);
}
.btn-outline:hover { background: var(--info-bg); }
.btn-danger {
  background: var(--fau-red);
  border-color: var(--fau-red);
}
.btn-danger:hover { background: #9d0c30; border-color: #9d0c30; }
.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.9rem; }
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- main / content ---------- */
.main-content {
  flex: 1;
  padding: 1.5rem 0 2.5rem;
}
.page-title {
  color: var(--fau-blue);
  margin: 0 0 1rem;
  font-size: 1.6rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

/* ---------- flash ---------- */
.flash-container { padding-top: 1rem; }
.flash {
  padding: 0.65rem 1rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  border-left: 5px solid;
}
.flash-error { background: var(--error-bg); border-color: var(--error-border); }
.flash-success { background: var(--success-bg); border-color: var(--success-border); }
.flash-info { background: var(--info-bg); border-color: var(--info-border); }

/* ---------- catalog ---------- */
.view-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.view-switch .label { font-weight: 600; color: var(--text-muted); }
.view-switch a {
  text-decoration: none;
  color: var(--fau-blue);
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border: 2px solid var(--fau-blue);
  border-radius: 4px;
}
.view-switch a[aria-current="true"] {
  background: var(--fau-blue);
  color: #fff;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-card .thumb {
  aspect-ratio: 4 / 3;
  background: #e9edf2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.product-card h3 { margin: 0; font-size: 1.05rem; }
.product-card h3 a {
  color: var(--fau-blue);
  text-decoration: none;
}
.product-card h3 a:hover { text-decoration: underline; }
.product-card .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}
.product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.product-list li { border-bottom: 1px solid var(--border); }
.product-list li:last-child { border-bottom: none; }
.product-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  color: var(--fau-blue);
  font-weight: 600;
  text-decoration: none;
}
.product-list a:hover { background: var(--info-bg); text-decoration: underline; }
.product-list .meta { color: var(--text-muted); font-weight: 400; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-reserved { background: var(--fau-amber); color: #3a2a00; }
.badge-hidden { background: #dfe3e8; color: var(--text); }
.badge-deleted { background: var(--error-bg); color: #7a0a26; }
.badge-new { background: var(--success-bg); color: #1b5e20; }

/* ---------- product detail ---------- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .detail-layout { grid-template-columns: 1fr; }
}
.detail-image {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.detail-image img { width: 100%; display: block; }
.detail-image .placeholder {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.product-description { max-width: 70ch; }
.product-description h1 { color: var(--fau-blue); margin-top: 0; }
.product-description .meta { color: var(--text-muted); }
.gallery {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.gallery img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid var(--border);
}
.gallery a[aria-current="true"] img { border-color: var(--fau-red); }
.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.preview-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}
.preview-item img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
}
.preview-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}
.preview-controls .btn {
  padding: 0.1rem 0.4rem;
  font-size: 0.85rem;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.92);
}
.contact-box {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--info-bg);
  border-left: 5px solid var(--fau-blue);
  border-radius: 4px;
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: #eef1f5;
  font-size: 0.9rem;
  color: var(--fau-blue);
}
table.data a.sort {
  color: var(--fau-blue);
  font-weight: 700;
  text-decoration: none;
}
table.data a.sort:hover { text-decoration: underline; }
table.data .actions { white-space: nowrap; }
table.data .actions form { display: inline; margin: 0 0.25rem 0 0; }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="email"],
.field textarea,
.field select {
  width: 100%;
  max-width: 40rem;
  padding: 0.5rem 0.65rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--fau-blue);
}
.field .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
.field .errorlist {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  color: var(--fau-red);
  font-weight: 600;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.checkline input { width: 1.2rem; height: 1.2rem; }
.checkline label { margin: 0; font-weight: 600; }
fieldset.group-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 0 1.25rem;
  padding: 0.75rem 1.25rem 1rem;
  background: var(--surface);
}
fieldset.group-box legend {
  font-weight: 700;
  color: var(--fau-blue);
  padding: 0 0.4rem;
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ---------- contacts ---------- */
.thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  max-width: 46rem;
}
.message .meta {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.message.mine {
  background: var(--info-bg);
  align-self: flex-end;
  border-left: 5px solid var(--fau-blue);
}
.message.new-message { border-left: 5px solid var(--fau-red); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--fau-blue);
  color: #fff;
  padding: 1.75rem 0;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-brand { display: flex; gap: 1rem; align-items: center; }
.footer-brand p { margin: 0; font-weight: 600; }
.site-footer ul {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-footer a {
  color: #fff;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-footer a:hover { border-bottom-color: var(--fau-amber); }

/* ---------- misc ---------- */
.empty-state {
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
}
.muted { color: var(--text-muted); }
.confirm { color: var(--fau-red); font-weight: 600; }
.login-box {
  max-width: 26rem;
  margin: 2rem auto;
}
.oidc-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  margin: 1rem 0;
}
.oidc-divider::before, .oidc-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
  flex: 1;
}
.static-page { max-width: 70ch; }
.static-page h1 { color: var(--fau-blue); }
