@font-face {
  font-family: 'Swiza';
  src: url('/fonts/swiza-medium.otf') format('opentype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --primary: #0076de;
  --primary-foreground: #ffffff;
  --muted: #f5f7fa;
  --muted-foreground: #6b7280;
  --border: #e5e7eb;
  --radius: 0.625rem;
  --destructive: #ef4444;
  --card: #ffffff;
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Swiza', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
}
main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }

/*
  Kontener jak Tailwind `container mx-auto` z css.semavo.pl:
  max-width = breakpoint (640 → 1536), wspólne paddingi px-3/4/6.
*/
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.75rem;  /* px-3 */
  padding-right: 0.75rem;
}
@media (min-width: 640px) {
  .container {
    max-width: 640px;
    padding-left: 1rem;   /* sm:px-4 */
    padding-right: 1rem;
  }
}
@media (min-width: 768px) {
  .container {
    max-width: 768px;
    padding-left: 1.5rem; /* md:px-6 */
    padding-right: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .container { max-width: 1024px; }
}
@media (min-width: 1280px) {
  .container { max-width: 1280px; }
}
@media (min-width: 1536px) {
  .container { max-width: 1536px; }
}

/* ===== Header (jak css.semavo.pl — szklany prześwit) ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border);
  /* Fallback bez backdrop-filter */
  background: rgba(255, 255, 255, 0.95);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
/* Tailwind: backdrop-blur + supports-[backdrop-filter]:bg-background/60 */
@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))) {
  .site-header {
    background: rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    backdrop-filter: saturate(180%) blur(8px);
  }
}
/* shadow-md po scrollu */
.site-header.is-scrolled {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 4rem;
}
@media (min-width: 640px) {
  .site-header-inner { gap: 1rem; }
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo img {
  height: 1.5rem;
  width: auto;
  color: #0a0a0a;
}
@media (min-width: 640px) {
  .logo img { height: 2rem; }
}

.search-desktop {
  display: none;
  flex: 1;
  max-width: 36rem;
}
@media (min-width: 768px) {
  .search-desktop { display: block; }
}
.search-mobile {
  display: block;
  border-top: 1px solid var(--border);
  padding-top: 0.625rem;   /* py-2.5 */
  padding-bottom: 0.625rem;
}
@media (min-width: 640px) {
  .search-mobile {
    padding-top: 0.75rem;  /* sm:py-3 */
    padding-bottom: 0.75rem;
  }
}
@media (min-width: 768px) {
  .search-mobile { display: none; }
}
/* Wewnętrzny .container dziedziczy poziome paddingi — wyrównanie z headerem */

.search-wrap {
  position: relative;
  width: 100%;
}
.search-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem 0.5rem 2.5rem;
  background: #fff;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(0 118 222 / 0.15);
}
.search-wrap input::placeholder { color: var(--muted-foreground); }

.header-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  transition: filter 0.15s, background 0.15s;
}
.header-cta:hover { filter: brightness(1.05); }
@media (min-width: 640px) {
  .header-cta {
    height: 2.25rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
  }
}
.header-cta .label-full { display: none; }
.header-cta .label-short { display: inline; }
@media (min-width: 640px) {
  .header-cta .label-full { display: inline; }
  .header-cta .label-short { display: none; }
}

/* ===== Main page shell (jak products-page-client) ===== */
.page-main {
  padding-top: 1.5rem;    /* py-6 */
  padding-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .page-main {
    padding-top: 2rem;    /* sm:py-8 */
    padding-bottom: 2rem;
  }
}
@media (min-width: 768px) {
  .page-main {
    padding-top: 3rem;    /* md:py-12 */
    padding-bottom: 3rem;
  }
}

/* ===== Hero ===== */
.hero {
  margin-bottom: 1.5rem;  /* mb-6 */
}
@media (min-width: 640px) {
  .hero { margin-bottom: 2rem; } /* sm:mb-8 */
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;      /* text-2xl */
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}
@media (min-width: 640px) {
  .hero h1 { font-size: 1.875rem; margin-bottom: 0.75rem; } /* sm:text-3xl */
}
@media (min-width: 768px) {
  .hero h1 { font-size: 2.25rem; } /* md:text-4xl */
}
.hero p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-wrap: pretty;
}
@media (min-width: 640px) {
  .hero p { font-size: 1rem; }
}

/* ===== Toolbar ===== */
.products-section { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 640px) {
  .products-section { gap: 1.5rem; }
}
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}
@media (min-width: 640px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.toolbar .meta {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  order: 2;
}
@media (min-width: 640px) {
  .toolbar .meta { font-size: 0.875rem; order: 1; }
}
.toolbar .sort-wrap { order: 1; width: 100%; }
@media (min-width: 640px) {
  .toolbar .sort-wrap { order: 2; width: auto; }
}
select.sort-select {
  width: 100%;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Więcej miejsca po prawej na chevron (native arrow był „przyklejony”) */
  padding: 0 2.25rem 0 0.75rem;
  color: var(--foreground);
  font-size: 0.875rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem 1rem;
  cursor: pointer;
}
select.sort-select::-ms-expand { display: none; }
@media (min-width: 640px) {
  select.sort-select { width: 180px; }
}
@media (min-width: 768px) {
  select.sort-select { width: 200px; }
}

/* ===== Product grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}
@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }
}
@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.product-card:hover { box-shadow: var(--shadow); }

.product-card .media {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgb(245 247 250 / 0.7);
}
.product-card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.product-card:hover .media img { transform: scale(1.05); }

.badge-promo {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.product-card .body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1rem;
  gap: 0;
}
.product-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  /* Stała wysokość 2 linii — ceny w rzędzie na jednej wysokości */
  min-height: calc(1.35em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: balance;
  transition: color 0.15s;
}
.product-card h3:hover { color: var(--primary); }

.prices {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: auto;
  margin-bottom: 0.25rem;
  /* Rezerwa na cenę promo + przekreśloną (2 linie) */
  min-height: 2.75rem;
}
.price-main {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--foreground);
  line-height: 1.3;
}
.price-main.is-promo { color: var(--primary); }
.price-old {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-decoration: line-through;
}

.product-card .footer {
  padding: 0 1rem 1rem;
  margin-top: auto;
}
.product-card .btn-shop {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  transition: filter 0.15s;
}
.product-card .btn-shop:hover { filter: brightness(1.05); }

/* Paginacja — jak Button size=sm + gap z product-grid.tsx */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.375rem;           /* gap-1.5 */
  margin: 0;
  padding-top: 1.5rem;     /* pt-6 */
  flex-wrap: wrap;
}
@media (min-width: 640px) {
  .pagination {
    gap: 0.5rem;           /* sm:gap-2 */
    padding-top: 2rem;     /* sm:pt-8 */
  }
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;            /* gap-1 */
}

/* Wyższa specyficzność — żeby .btn / .btn-sm nie psuły wymiarów */
.pagination .pagination-nav,
.pagination .pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 0.375rem; /* rounded-md */
  background: #fff;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}
.pagination .pagination-nav:hover:not(:disabled),
.pagination .pagination-page:hover:not(.is-active) {
  background: #f5f7fa;
}

.pagination .pagination-nav {
  gap: 0.375rem;           /* size sm: gap-1.5 */
  height: 2rem;            /* h-8 */
  padding: 0 0.5rem;       /* px-2 */
  width: auto;
  flex: 0 0 auto;
}
@media (min-width: 640px) {
  .pagination .pagination-nav {
    height: 2.25rem;       /* sm:h-9 */
    padding: 0 0.75rem;    /* sm:px-3 */
  }
}
.pagination-nav-label { display: none; }
@media (min-width: 640px) {
  .pagination-nav-label { display: inline; }
}
.pagination-chevron {
  width: 0.75rem;          /* h-3 w-3 */
  height: 0.75rem;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .pagination-chevron {
    width: 1rem;           /* sm:h-4 w-4 */
    height: 1rem;
  }
}

.pagination .pagination-page {
  width: 2rem;             /* w-8 */
  height: 2rem;            /* h-8 */
  padding: 0;
  flex: 0 0 2rem;
  font-size: 0.75rem;      /* text-xs */
}
@media (min-width: 640px) {
  .pagination .pagination-page {
    width: 2.5rem;         /* sm:w-10 */
    height: 2.25rem;       /* sm:h-9 */
    flex-basis: 2.5rem;
    font-size: 0.875rem;   /* sm:text-sm */
  }
}
.pagination .pagination-page.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: none;
}
.pagination .pagination-page.is-active:hover {
  background: var(--primary);
  filter: brightness(1.05);
}
.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
}
.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--foreground);
}
.btn-sm { height: 2.25rem; padding: 0 0.75rem; font-size: 0.875rem; }
.btn-danger { background: var(--destructive); color: #fff; }

.empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted-foreground);
}

/* ===== Footer (jak css.semavo.pl) ===== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgb(245 247 250 / 0.3); /* bg-muted/30 */
  color: var(--muted-foreground);
}
.site-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;            /* gap-3 */
  padding-top: 1.5rem;     /* py-6 */
  padding-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .site-footer-inner {
    gap: 1rem;             /* sm:gap-4 */
    padding-top: 2rem;     /* sm:py-8 */
    padding-bottom: 2rem;
  }
}
@media (min-width: 768px) {
  .site-footer-inner {
    flex-direction: row;   /* md:flex-row */
  }
}
.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;            /* gap-3 */
  font-size: 0.75rem;      /* text-xs */
}
@media (min-width: 640px) {
  .site-footer-nav {
    gap: 1rem;             /* sm:gap-4 */
    font-size: 0.875rem;   /* sm:text-sm */
  }
}
@media (min-width: 768px) {
  .site-footer-nav { gap: 1.5rem; } /* md:gap-6 */
}
.site-footer-nav a {
  color: var(--muted-foreground);
  transition: color 0.15s;
}
.site-footer-nav a:hover { color: var(--foreground); }
.site-footer-copy {
  margin: 0;
  font-size: 0.75rem;
  text-align: center;
  color: var(--muted-foreground);
}
@media (min-width: 640px) {
  .site-footer-copy { font-size: 0.875rem; }
}

.legal-content { padding: 2rem 0 3rem; max-width: 48rem; }
.legal-content h1 { margin-top: 0; }

/* ===== Admin (bez zmian funkcjonalnych) ===== */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-nav { background: #0b1220; color: #fff; padding: 1.25rem; }
.admin-nav a { display: block; color: #dbe7ff; padding: 0.45rem 0; }
.admin-nav a:hover { color: #fff; }
.admin-main { padding: 1.5rem; background: #f7f9fc; }
.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.admin-card h1, .admin-card h2 { margin-top: 0; color: var(--primary); }
.form-grid { display: grid; gap: 0.85rem; }
label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font: inherit;
  background: #fff;
}
textarea { min-height: 120px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat .value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 0.65rem; text-align: left; font-size: 0.9rem; vertical-align: top; }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-ok { background: #ecfdf5; color: #065f46; }
.alert-err { background: #fef2f2; color: #991b1b; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: #f7f9fc; }
.login-card { width: min(420px, 92vw); }

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { display: flex; flex-wrap: wrap; gap: 0.75rem; }
}
