/* ==========================================================================
   components.css — header, podgląd
   Wymaga: variables.css, layout.css
   ========================================================================== */

/* --- Header: logowanie / rejestracja --- */
.header-login {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-10);
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  color: var(--header-fg);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--dur-2) var(--ease-out);
}

.header-login:hover {
  opacity: 0.72;
}

.header-login:focus-visible {
  outline: none;
  border-radius: var(--radius-10);
  box-shadow: var(--focus-ring);
}

.header-register {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--space-16);
  border-radius: var(--radius-pill);
  background: #333333;
  color: #ffffff;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}

html[data-theme="dark"] .header-register {
  background: #f0f0f0;
  color: #141414;
}

.header-register:hover {
  opacity: 0.92;
}

.header-register:active {
  transform: scale(0.98);
}

.header-register:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --- Motyw (1 przycisk, 1 ikona = następny w cyklu light → dark → system) --- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #333333;
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}

html[data-theme="dark"] .theme-toggle {
  color: #ffffff;
}

.theme-toggle:hover {
  background: var(--surface-2);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-toggle__icon {
  font-size: 20px;
  line-height: 1;
}

/* --- Język --- */
.lang-switcher {
  position: relative;
}

.header-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-out);
}

.header-lang:hover {
  background: var(--surface-2);
}

.header-lang:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.header-lang__flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.lang-switcher__menu {
  position: absolute;
  top: calc(100% + var(--space-8));
  right: 0;
  z-index: calc(var(--z-header) + 5);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-width: 180px;
  margin: 0;
  padding: var(--space-8);
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
}

.lang-switcher__menu > li {
  margin: 0;
  padding: 0;
}

.lang-switcher__menu[hidden] {
  display: none;
}

.lang-switcher__option {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: 100%;
  padding: var(--space-10) var(--space-12);
  border: none;
  border-radius: var(--radius-10);
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: var(--fs-14);
  font-weight: var(--fw-500);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-out);
}

.lang-switcher__option:hover {
  background: var(--surface-2);
}

.lang-switcher__option--active {
  font-weight: var(--fw-600);
  background: var(--surface-2);
}

.lang-switcher__option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.lang-switcher__option img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* --- Podgląd (index) --- */
.preview-hero {
  margin-bottom: var(--space-24);
  padding: var(--space-24);
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}

.preview-hero__badge {
  display: inline-block;
  margin-bottom: var(--space-12);
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  font-size: var(--fs-12);
  font-weight: var(--fw-700);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-hero h1 {
  margin-bottom: var(--space-12);
}

.preview-grid {
  display: grid;
  gap: var(--space-16);
}

@media (min-width: 640px) {
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.preview-card {
  padding: var(--space-20);
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}

.preview-card__title {
  margin: 0 0 var(--space-8);
  font-size: var(--fs-18);
  font-weight: var(--fw-700);
  color: var(--fg);
}

.preview-card__meta {
  margin: 0;
  font-size: var(--fs-13);
  color: var(--muted);
}

