/* ============================================================
   FliFlo – Stylesheet  |  CSS Nesting mit vollem Selektor
   ============================================================ */

/* --- Design Tokens ---------------------------------------- */
:root {
  --color-sky: #3a8fd4;
  --color-sky-hover: #2670b0;
  --color-sky-light: #e8f4fd;
  --color-peak: #1a3a5c;
  --color-wing: #e8640a;
  --color-wing-hover: #c44f06;
  --color-wing-light: #fdf0e8;
  --color-bg: #f5f3ef;
  --color-surface: #ffffff;
  --color-surface-2: #f9f8f5;
  --color-border: oklch(from #1e2a35 l c h / 0.12);
  --color-divider: oklch(from #1e2a35 l c h / 0.07);
  --color-text: #1e2a35;
  --color-text-muted: #5a6a77;
  --color-text-faint: #9aabba;
  --color-text-inverse: #ffffff;
  --color-success: #2e7d32;
  --color-success-bg: #e8f5e9;
  --color-error: #c62828;
  --color-error-bg: #fdecea;
  --color-warning: #e65100;



  /* Himmel – klares Alpinblau statt Navy */
  --color-sky: #0ea5e9;
  --color-sky-hover: #0284c7;
  --color-sky-light: #e0f4fe;

  /* Peak (Header) – tiefes Bergblau, wärmer */
  --color-peak: #0c4a7a;

  /* Wing – sonniges Goldorange statt Dunkelorange */
  --color-wing: #f59e0b;
  --color-wing-hover: #d97706;
  --color-wing-light: #fffbeb;

  /* Hintergrund – ganz leicht himmelblau getönt */
  --color-bg: #f0f9ff;
  --color-surface: #ffffff;
  --color-surface-2: #f7fafd;
  --color-border: oklch(from #0c4a7a l c h / 0.12);
  --color-divider: oklch(from #0c4a7a l c h / 0.06);

  /* Text – kühl-neutral statt warm-braun */
  --color-text: #0f2942;
  --color-text-muted: #4a6880;
  --color-text-faint: #93b4cc;
  --color-text-inverse: #ffffff;

  /* Status */
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-error: #dc2626;
  --color-error-bg: #fee2e2;
  --color-warning: #ea580c;


  --font-display: 'Arial', 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  --font-body: 'Arial', 'Satoshi', 'Inter', system-ui, sans-serif;
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2rem);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px oklch(0.2 0.02 230 / 0.08);
  --shadow-md: 0 4px 16px oklch(0.2 0.02 230 / 0.10);
  --shadow-lg: 0 12px 32px oklch(0.2 0.02 230 / 0.14);
  --content-default: 960px;
  --content-narrow: 640px;
  --header-height: 64px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --color-bg: #0a1929;
  --color-surface: #0f2236;
  --color-surface-2: #132b42;
  --color-border: oklch(from #93b4cc l c h / 0.12);
  --color-divider: oklch(from #93b4cc l c h / 0.07);
  --color-text: #d0e8f5;
  --color-text-muted: #6a9ab8;
  --color-text-faint: #3a6a8a;
  --color-sky: #38bdf8;
  --color-sky-hover: #7dd3fc;
  --color-sky-light: #082030;
  --color-peak: #7ab8e0;
  --color-wing: #fbbf24;
  --color-wing-hover: #fcd34d;
  --color-wing-light: #1c1400;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0a1929;
    --color-surface: #0f2236;
    --color-surface-2: #132b42;
    --color-border: oklch(from #93b4cc l c h / 0.12);
    --color-divider: oklch(from #93b4cc l c h / 0.07);
    --color-text: #d0e8f5;
    --color-text-muted: #6a9ab8;
    --color-text-faint: #3a6a8a;
    --color-sky: #38bdf8;
    --color-sky-hover: #7dd3fc;
    --color-sky-light: #082030;
    --color-peak: #7ab8e0;
    --color-wing: #fbbf24;
    --color-wing-hover: #fcd34d;
    --color-wing-light: #1c1400;
    --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.3);
    --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
}

img,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  line-height: 1.2;
  font-family: var(--font-display);
}

h1 {
  padding-bottom: 20px;
}

ul {
  margin: 0 0 20px 20px;
}

p,
li {
  text-wrap: pretty;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--color-sky);
}

:focus-visible {
  outline: 2px solid var(--color-sky);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Layout ----------------------------------------------- */
.container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-4);

  @media (min-width: 768px) {
    padding-inline: var(--space-8);
  }
}

/* --- Header ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-peak);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);

  @media (max-width: 580px) {
    height: auto;
  }

  .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);

    @media (max-width: 580px) {
      display: block;
      padding: 6px 10px;
    }
  }
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text-inverse);

  .site-logo__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }

  .site-logo__brand {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 800;
  }

  .site-logo__sub {
    font-size: var(--text-xs);
    opacity: .6;
  }

  img {
    height: 55px;
    width: auto;
  }

  @media (max-width: 580px) {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-bottom: 10px;
  }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);

  .site-nav__club {
    font-size: var(--text-sm);
    opacity: .8;

    @media (max-width: 560px) {
      display: none;
    }
  }
}

/* --- Main + Footer ---------------------------------------- */
.site-main {
  flex: 1;
  padding-block: var(--space-8) var(--space-16);
}

.site-footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);

  a.home {
    color: var(--color-text);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }
}

/* --- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid transparent;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), box-shadow var(--transition), transform var(--transition);

  &:active {
    transform: scale(.97);
  }

  &.btn--primary {
    background: var(--color-wing);
    color: #fff;
    border-color: var(--color-wing);

    &:hover {
      background: var(--color-wing-hover);
      border-color: var(--color-wing-hover);
    }
  }

  &.btn--ghost {
    background: var(--color-sky-light);
    color: var(--color-text-muted);
    border-color: var(--color-border);

    &:hover {
      background: var(--color-surface-2);
      color: var(--color-text);
    }
  }

  &.btn--danger {
    background: var(--color-error);
    color: #fff;
    border-color: var(--color-error);

    &:hover {
      filter: brightness(1.1);
    }
  }

  &.btn--icon {
    padding: var(--space-2);
    color: var(--color-text-inverse);
    opacity: .75;

    &:hover {
      opacity: 1;
      background: oklch(from #fff l c h / 0.12);
    }
  }

  &.btn--sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  &.btn--full {
    width: 100%;
    justify-content: center;
  }
}

/* --- Alerts ----------------------------------------------- */
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);

  &.alert--success {
    background: var(--color-success-bg);
    color: var(--color-success);
  }

  &.alert--error {
    background: var(--color-error-bg);
    color: var(--color-error);
  }
}

/* --- Seitenüberschrift ------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--space-8);

  h1 {
    font-size: var(--text-xl);
    color: var(--color-peak);
  }
}

/* --- Artikelgrid ------------------------------------------ */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-6);
}

.item-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);

  &:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);

    .item-card__image img {
      transform: scale(1.04);
    }
  }

  .item-card__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-surface-2);

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform var(--transition);
    }
  }

  .item-card__body {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
  }

  .item-card__title {
    font-size: var(--text-base);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-peak);
  }

  .item-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    flex-wrap: wrap;
  }

  .item-card__price {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-wing);
  }

  .item-card__club {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-surface-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
  }

  .item-card__date,
  .item-card__location,
  .item-card__seller {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    margin-top: auto;
  }
}

/* --- Empty State ------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
  gap: var(--space-4);

  svg {
    color: var(--color-text-faint);
  }

  h3 {
    font-size: var(--text-lg);
    color: var(--color-text);
  }

  p {
    max-width: 36ch;
  }
}

/* --- Formular --------------------------------------------- */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  max-width: var(--content-narrow);

  @media (max-width: 600px) {
    padding: var(--space-5);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);

  label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
  }

  input,
  textarea,
  select {
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--text-base);
    transition: border-color var(--transition), box-shadow var(--transition);

    &::placeholder {
      color: var(--color-text-faint);
    }

    &:focus {
      outline: none;
      border-color: var(--color-sky);
      box-shadow: 0 0 0 3px oklch(from var(--color-sky) l c h / 0.18);
    }
  }

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

  &.form-group--error {

    input,
    textarea {
      border-color: var(--color-error);
    }
  }
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  font-weight: 500;
}

.required {
  color: var(--color-wing);
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

/* --- Bildvorschau Upload ---------------------------------- */
.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);

  img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
  }
}

/* --- Bilder Edit ------------------------------------------ */
.edit-images {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.edit-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);

  img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
  }

  .edit-image__delete {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-error);
    cursor: pointer;
    user-select: none;

    input {
      accent-color: var(--color-error);
    }
  }
}

/* --- Detailseite ------------------------------------------ */
.item-detail {
  .item-detail__nav {
    margin-bottom: var(--space-6);
  }

  .item-detail__content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    margin-top: var(--space-8);

    @media (min-width: 768px) {
      grid-template-columns: 1fr 380px;
    }
  }

  .item-detail__title {
    font-size: var(--text-xl);
    color: var(--color-peak);
    margin-bottom: var(--space-3);
  }

  .item-detail__price {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-wing);
    margin-bottom: var(--space-3);
  }

  .item-detail__meta {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
  }

  .item-detail__description {
    font-size: var(--text-base);
    line-height: 1.75;
    max-width: 65ch;
  }

  .item-detail__contact {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    height: fit-content;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));

    h2 {
      font-size: var(--text-lg);
      margin-bottom: var(--space-5);
      color: var(--color-peak);
    }
  }
}

/* --- Galerie ---------------------------------------------- */
.item-gallery {
  .item-gallery__main {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);

    img {
      width: 100%;
      max-height: 500px;
      object-fit: contain;
    }
  }

  .item-gallery__thumbs {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-3);
  }
}

.thumb-btn {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
  opacity: .65;
  transition: opacity var(--transition), border-color var(--transition);

  img {
    width: 72px;
    height: 54px;
    object-fit: cover;
    display: block;
  }

  &:hover,
  &.thumb-btn--active {
    opacity: 1;
    border-color: var(--color-sky);
  }
}

/* --- Auth-Seite ------------------------------------------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
  color: var(--color-peak);

  svg,
  img {
    margin-inline: auto;
    margin-bottom: var(--space-3);
    color: var(--color-sky);
  }

  h1 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 800;
  }

  p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
  }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* --- Confirm / Delete Box --------------------------------- */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: var(--space-8) var(--space-4);
}

.confirm-box {
  text-align: center;
  max-width: 440px;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);

  h2 {
    font-size: var(--text-lg);
  }

  p {
    color: var(--color-text-muted);
    max-width: 32ch;
  }

  svg {
    color: var(--color-sky);
  }

  &.confirm-box--success svg {
    color: var(--color-success);
  }

  &.confirm-box--warning {
    border-color: oklch(from var(--color-warning) l c h / 0.3);

    svg {
      color: var(--color-warning);
    }
  }

  .confirm-box__actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* --- Kontaktformular -------------------------------------- */
.contact-form {
  display: flex;
  flex-direction: column;
}



.preview-thumb {
  position: relative;
  cursor: grab;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  overflow: hidden;
  user-select: none;
  transition: opacity var(--transition), border-color var(--transition);

  img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    display: block;
  }

  .preview-order {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  }

  &.drag-over {
    border-color: var(--color-sky);
    opacity: .6;
  }

  &.dragging {
    opacity: .3;
    cursor: grabbing;
  }
}

.edit-image {
  cursor: grab;

  &:active {
    cursor: grabbing;
  }
}

.edit-image.drag-over {
  border-color: var(--color-sky);
  opacity: .6;
}

#img-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#img-modal.img-modal--open {
  display: flex;
}

.img-modal__backdrop {
  position: absolute;
  inset: 0;
  background: oklch(0 0 0 / 0.88);
}

.img-modal__img {
  position: relative;
  max-width: min(96vw, 1600px);
  max-height: 92dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.img-modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: oklch(1 0 0 / 0.15);
  color: #fff;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-interactive);
}

.img-modal__close:hover {
  background: oklch(1 0 0 / 0.25);
}

.box {
  p {
    padding-bottom: 16px;
  }
}

.push-label {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    cursor: pointer;
    line-height: 1;
}

.push-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--color-success);
    width: 14px;
    height: 14px;
    margin: 0;
}

.push-icon {
    font-size: 1.1rem;
    line-height: 1;
}