/* =========================================================
   STYLE SKLEPU-KATALOGU DLA SENIORA (SENIOR-FRIENDLY UX)
   Duże czcionki, wysoki kontrast, intuicyjne przyciski
   ========================================================= */

:root {
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --success: #15803d;
  --success-hover: #166534;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #cbd5e1;
  --accent-badge: #dbeafe;
  --accent-badge-text: #1e40af;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 18px;
  padding-bottom: 90px;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

/* NAGŁÓWEK */
.main-header {
  background: #ffffff;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 38px;
}

.site-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.site-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

.cart-button {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.cart-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.cart-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
}

/* WYSZUKIWARKA I KATEGORIE */
.search-section {
  background: #ffffff;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-color);
}

.search-box {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #ffffff;
}

.search-icon {
  font-size: 22px;
  margin-right: 10px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
  padding: 8px 0;
  outline: none;
}

.clear-search-btn {
  background: #e2e8f0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.categories-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.cat-btn {
  background: #f1f5f9;
  border: 2px solid transparent;
  color: var(--text-main);
  font-size: 17px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  background: #e2e8f0;
}

.cat-btn.active {
  background: var(--accent-badge);
  color: var(--accent-badge-text);
  border-color: var(--primary);
}

/* GŁÓWNA ZAWARTOŚĆ */
.main-content {
  padding: 24px 0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.section-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

.results-count {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 600;
}

/* SIATKA PRODUKTÓW */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  background: #e2e8f0;
  overflow: hidden;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .card-img {
  transform: scale(1.04);
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-category {
  display: inline-block;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  align-self: flex-start;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.card-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--success);
}

.btn-card-select {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-close-modal:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.modal-image-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.modal-product-img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  cursor: zoom-in;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 4px;
  margin-top: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.gallery-thumb-img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  cursor: pointer;
  background: #f1f5f9;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.gallery-thumb-img:hover,
.gallery-thumb-img.active {
  border-color: var(--primary);
  transform: scale(1.05);
}

.img-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.badge-category {
  display: inline-block;
  background: var(--accent-badge);
  color: var(--accent-badge-text);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
}

.modal-price-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  background: #f0fdf4;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #bbf7d0;
}

.modal-source-box {
  margin-bottom: 16px;
}

.link-original-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.link-original-source:hover {
  background: #dbeafe;
  text-decoration: underline;
}

.price-label {
  font-size: 16px;
  color: var(--text-muted);
}

.modal-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--success);
}

.section-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.color-selection-box {
  margin-bottom: 18px;
}

.variant-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.variant-chip {
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 72px;
  transition: all 0.15s ease;
  position: relative;
}

.variant-chip:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.variant-chip.selected {
  border-color: var(--primary);
  background: var(--accent-badge);
  box-shadow: 0 0 0 2px var(--primary);
}

.variant-chip-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.variant-chip-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.color-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-pill {
  background: #f1f5f9;
  border: 2px solid var(--border-color);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.color-pill:hover {
  border-color: var(--primary);
}

.color-pill.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.15);
}

.size-selection-box {
  margin-bottom: 18px;
}

.size-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-pill {
  background: #f1f5f9;
  border: 2px solid var(--border-color);
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-width: 52px;
  text-align: center;
  transition: all 0.15s ease;
}

.size-pill:hover {
  border-color: var(--primary);
}

.size-pill.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.error-msg {
  color: #dc2626;
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
}

.qty-selection-box {
  margin-bottom: 18px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.qty-btn {
  background: #ffffff;
  border: none;
  font-size: 22px;
  font-weight: 800;
  width: 46px;
  height: 46px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: #e2e8f0;
}

.qty-number {
  font-size: 20px;
  font-weight: 800;
  padding: 0 16px;
  min-width: 40px;
  text-align: center;
}

.notes-box {
  margin-bottom: 22px;
}

.input-notes {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
}

.input-notes:focus {
  border-color: var(--primary);
}

.btn-primary-large {
  width: 100%;
  background: var(--success);
  color: #ffffff;
  border: none;
  font-size: 20px;
  font-weight: 800;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary-large:hover {
  background: var(--success-hover);
}

/* KOSZYK */
.cart-modal-card {
  max-width: 650px;
}

.cart-modal-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.cart-modal-header h2 {
  font-size: 26px;
  font-weight: 800;
}

.cart-modal-header p {
  color: var(--text-muted);
  font-size: 16px;
}

.cart-items-container {
  max-height: 380px;
  overflow-y: auto;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cart-item-img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.cart-item-details {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.cart-item-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--success);
  white-space: nowrap;
}

.btn-remove-item {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-remove-item:hover {
  background: #fecaca;
}

.cart-summary-section {
  border-top: 2px solid var(--border-color);
  padding-top: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  margin-bottom: 8px;
}

.summary-row.total-row {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.summary-row.total-row strong {
  color: var(--success);
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-order-large {
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-size: 20px;
  font-weight: 800;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-order-large:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-main);
  border: none;
  font-size: 16px;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

/* PŁYWAJĄCA BELKA (MOBILE) */
.floating-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #ffffff;
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 90;
}

.floating-cart-info {
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

.floating-cart-total b {
  color: var(--success);
  font-size: 18px;
}

.btn-float-open {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* MODAL SUKCESU */
.success-modal-card {
  max-width: 550px;
  text-align: center;
}

.success-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.success-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 16px;
}

.order-box {
  margin-bottom: 16px;
}

.order-textarea {
  width: 100%;
  background: #f8fafc;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-main);
  resize: none;
}

.order-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* LIGHTBOX */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-image {
  max-width: 90%;
  max-height: 85%;
  object-fit: contain;
  border-radius: 8px;
}

.btn-close-lightbox {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #ffffff;
  color: #000000;
  border: none;
  font-size: 18px;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 18px;
}
