/*
 * Components – reusable patterns built on design tokens
 *
 * Use @layer components so Tailwind utilities can still override when needed.
 * Because we run Tailwind CDN (no build step), we write plain CSS classes
 * instead of @apply. Tailwind's config maps the same tokens, so both worlds
 * share one colour set.
 */

/* ── Cards / Sections ────────────────────────────────────────────────── */
.lm-card {
  border-radius: var(--lm-radius-lg);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface-overlay);
}

.lm-card-inner {
  border-radius: var(--lm-radius-sm);
  border: 1px solid var(--lm-border-subtle);
  overflow: hidden;
}

/*
 * News-Feed- und Markt-Aktivitäts-Zeilen — horizontales Innenpadding zentral.
 * Tokens: --lm-news-feed-row-pad-* in tokens.css
 * Partials: includes/news_feed_list_partial.php, includes/transfers_recent_activity_partial.php
 */
.lm-news-feed-row-pad--compact {
  padding-top: var(--lm-news-feed-row-pad-y-compact);
  padding-bottom: var(--lm-news-feed-row-pad-y-compact);
  padding-left: var(--lm-news-feed-row-pad-x-compact);
  padding-right: var(--lm-news-feed-row-pad-x-compact);
}

@media (min-width: 640px) {
  .lm-news-feed-row-pad--compact {
    padding-left: var(--lm-news-feed-row-pad-x-compact-sm);
    padding-right: var(--lm-news-feed-row-pad-x-compact-sm);
  }
}

.lm-news-feed-row-pad--default {
  padding-top: var(--lm-news-feed-row-pad-y);
  padding-bottom: var(--lm-news-feed-row-pad-y);
  padding-left: var(--lm-news-feed-row-pad-x);
  padding-right: var(--lm-news-feed-row-pad-x);
}

@media (min-width: 640px) {
  .lm-news-feed-row-pad--default {
    padding-left: var(--lm-news-feed-row-pad-x-sm);
    padding-right: var(--lm-news-feed-row-pad-x-sm);
  }
}

/* ── Modals / Bottom Sheets ──────────────────────────────────────────── */
.lm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--lm-backdrop);
}

.lm-modal-panel {
  border-radius: var(--lm-radius-lg);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-2xl);
}

/* ── Back navigation (page-level «Zurück …» controls) ─────────────────── */
.lm-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: var(--lm-radius-lg);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface-overlay);
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--lm-text-secondary);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.lm-back-link:hover {
  background: var(--lm-surface-hover-strong);
  color: var(--lm-text-secondary);
}
.lm-back-link:focus-visible {
  outline: 2px solid var(--lm-accent-ring);
  outline-offset: 2px;
}
.lm-back-link .material-symbols-outlined {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

/* ── Form controls ───────────────────────────────────────────────────── */
.lm-input {
  width: 100%;
  border-radius: var(--lm-radius-sm);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface-input);
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  color: var(--lm-text);
}
.lm-input::placeholder {
  color: var(--lm-text-placeholder);
}
.lm-input:focus {
  outline: 2px solid var(--lm-accent-ring);
  outline-offset: -1px;
}

.lm-select {
  width: 100%;
  border-radius: var(--lm-radius-sm);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface-input);
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  color: var(--lm-text);
}

/*
 * Remove the caret SVG that @tailwindcss/forms injects as a background-image
 * on <select>. Apply on top of Tailwind's appearance-none when we draw our
 * own caret (e.g. season / matchday dropdowns in league.php). Replaces the
 * inline `style="background-image: none;"` pattern.
 */
.lm-select-bare {
  background-image: none;
}

.lm-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--lm-text-muted);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.lm-btn-primary {
  border-radius: var(--lm-radius-sm);
  background: var(--lm-accent-bg);
  border: 1px solid var(--lm-accent-border);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--lm-accent);
  cursor: pointer;
}
.lm-btn-primary:hover {
  background: var(--lm-accent-bg-hover);
}

.lm-btn-ghost {
  border-radius: var(--lm-radius-sm);
  background: var(--lm-surface-raised);
  border: 1px solid var(--lm-border);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--lm-text-secondary);
  cursor: pointer;
}
.lm-btn-ghost:hover {
  background: var(--lm-surface-active);
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.lm-thead {
  background: var(--lm-surface-thead);
  color: var(--lm-text-muted);
}

.lm-tbody-row {
  border-top: 1px solid var(--lm-border-subtle);
}
.lm-tbody-row:hover {
  background: var(--lm-surface-thead);
}

/* ── Dropdown / Popover ──────────────────────────────────────────────── */
.lm-dropdown {
  border-radius: var(--lm-radius-sm);
  border: 1px solid var(--lm-border);
  background: var(--lm-surface);
  box-shadow: var(--lm-shadow-xl);
}

/* ── Detail modal info row ───────────────────────────────────────────── */
.lm-detail-cell {
  border-radius: var(--lm-radius-sm);
  background: var(--lm-surface-thead);
  padding: 0.5rem 0.75rem;
}
.lm-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lm-text-muted);
}
.lm-detail-value {
  margin-top: 0.125rem;
  color: var(--lm-text);
}

/* ── KPI stat cards ──────────────────────────────────────────────────── */
.lm-kpi-card {
  border-radius: var(--lm-radius-sm);
  background: var(--lm-surface-raised);
  padding: 0.75rem;
}
.lm-kpi-label {
  font-size: 0.75rem;
  color: var(--lm-text-muted);
}

/* ── Pagination links ────────────────────────────────────────────────── */
.lm-page-link {
  border-radius: 0.375rem;
  border: 1px solid var(--lm-border);
  padding: 0.25rem 0.5rem;
  color: var(--lm-text-secondary);
}
.lm-page-link:hover {
  background: var(--lm-surface-active);
}

/* ── Chip / badge ────────────────────────────────────────────────────── */
.lm-chip-starter {
  background: var(--lm-accent-bg);
  color: var(--lm-accent);
}
.lm-chip-bench {
  background: var(--lm-bench-bg);
  color: var(--lm-bench);
}
.lm-chip-none {
  background: var(--lm-surface-raised);
  color: rgba(157,185,166, 0.4); /* text-muted/40 */
}

/* ── Error / alert boxes ─────────────────────────────────────────────── */
.lm-alert-danger {
  border-radius: var(--lm-radius-sm);
  background: var(--lm-danger-bg);
  border: 1px solid var(--lm-danger-border);
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--lm-danger);
}
.lm-alert-warning {
  border-radius: var(--lm-radius-lg);
  background: var(--lm-warning-bg);
  border: 1px solid var(--lm-warning-border);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--lm-warning-text);
}

/* ── Login page hero background ──────────────────────────────────────── */
/*
 * Full-bleed decorative background on public/app/index.php.
 * The image URL is token-driven so a theme or deployment can override it
 * without editing the template. Fallback is the current Stitch/Aida mock
 * asset; replace with a local asset under public/app/assets/ when possible
 * (see docs/reviews/2026-04-new-app-code-review.md, section 4.1).
 */
:root {
  --lm-login-hero-bg-image: url('https://lh3.googleusercontent.com/aida-public/AB6AXuAy8WId8PiNa2ziiIeBgGCWYo8VmdcN2w8IWDuggcSyt_0uAS53AJXMOXfodOATzJC-uMamMU6_eQ7vHsuwzjuae4vkPrlZJogiPQ7Ib_Ddb_lczLmikXNDyVNdET_I_MJUizblKPbRQZ1L1ELnXeAsNOZ-aCP-18UKvwVJc3AD-8_lgg3oasG8EvrN-Unq06Pv2R6IKLWJ428aWbbGknPYz-pi8Ph9d8fLfo6miimJe6uGVbPafgRaD_9frbwFYpoGvQGAmO5sPFzes');
}

.lm-login-hero-bg {
  background-image: var(--lm-login-hero-bg-image);
}

/* ── Desktop inbox drawer (`<dialog id="lm-inbox-drawer">`) ─────────────── */
.lm-inbox-drawer-dialog {
  margin: 0 0 0 auto;
  padding: 0;
  width: min(28rem, 100vw);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  border: none;
  border-left: 1px solid var(--lm-border);
  background: var(--lm-bg);
  color: inherit;
}

.lm-inbox-drawer-dialog::backdrop {
  background: var(--lm-backdrop);
}

/* auction-bids.php — brief green flash after saving Erstgebot (interest phase) */
@keyframes lm-ab-interest-success-flash {
  0% {
    border-color: var(--lm-accent);
    box-shadow: 0 0 0 2px var(--lm-accent-ring);
    background-color: var(--lm-accent-bg);
  }
  100% {
    border-color: var(--lm-border);
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.03);
  }
}

.lm-ab-interest-shell.lm-ab-interest-flash-success {
  animation: lm-ab-interest-success-flash 0.95s ease-out 1 forwards;
}

/* Injury hint — first-aid tile (squad + player pill, non-blocking). */
.lm-injury-mark-icon {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
  vertical-align: middle;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  line-height: 0;
}

.lm-injury-mark-icon--md {
  width: 0.875rem;
  height: 0.875rem;
}

.lm-injury-mark-icon__svg {
  display: block;
  width: 100%;
  height: 100%;
}

.lm-injury-mark-icon__tile {
  fill: var(--lm-injury-mark-tile);
}

.lm-injury-mark-icon__cross {
  fill: none;
  stroke: var(--lm-injury-mark-disc);
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Liga-Kartenhint (Kicker-Sperren) — Kader. PHP: {@see lm_render_card_suspension_mark_icon()}. */
.lm-league-card-mark {
  box-sizing: border-box;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 0;
  width: 9px;
  height: 15px;
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px var(--lm-border-subtle);
}

.lm-league-card-mark--yellow {
  background-color: var(--lm-card-mark-yellow);
}

.lm-league-card-mark--red {
  background-color: var(--lm-card-mark-red);
}

.lm-league-card-mark--yellow_red {
  background: linear-gradient(
    135deg,
    var(--lm-card-mark-yellow) 50%,
    var(--lm-card-mark-red) 50%
  );
}

.lm-league-card-mark--md {
  width: 11px;
  height: 18px;
}

/*
 * Player header portrait (player.php) — TM headshots are portrait-shaped; rounded rect
 * (not a circle) avoids empty corner wedges. Slight top bias keeps the full head in frame.
 */
.lm-player-portrait-frame {
  display: block;
  flex-shrink: 0;
  width: 3.25rem;
  height: 4rem;
  overflow: hidden;
  border-radius: var(--lm-radius-lg);
  background-color: var(--lm-surface-overlay);
}

.lm-player-portrait-frame .lm-player-portrait {
  display: block;
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: center 18%;
}
