/* ============================================================
   IKS - wspolne komponenty platformy (fundament)
   Formularze, alerty, karta logowania, breadcrumb.
   Strony dokladaja wlasne style w static/css/pages/<nazwa>.css
   ============================================================ */

/* ---------- Formularze ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form p { margin: 0; display: flex; flex-direction: column; gap: 7px; }

.form label,
.field label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 13px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px var(--violet-50);
}

textarea { min-height: 130px; resize: vertical; line-height: 1.55; }

.form .helptext,
.helptext,
.form p span.helptext {
  font-size: 12.5px;
  color: var(--gray-600);
  font-weight: 500;
}

ul.errorlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #c9184a;
  font-size: 13px;
  font-weight: 600;
}

.form input[type="checkbox"],
.form input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--violet);
  vertical-align: middle;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--charcoal);
  font-weight: 500;
}
.checkbox-row label { font-weight: 500; }

/* ---------- Alerty / komunikaty (messages) ---------- */
.toast-wrap {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100% - 40px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.32s var(--ease) both;
}
.toast.hide {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.4s, transform 0.4s;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  padding: 0 2px;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }

/* ---------- Linki prawne w stopce ---------- */
.footer-legal {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-legal a {
  color: var(--gray-400);
  font-size: 13px;
}
.footer-legal a:hover { color: #fff; }

/* ---------- Informacja o koncie w checkout ---------- */
.checkout-account-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--violet-50);
  border: 1px solid var(--violet-100);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--charcoal);
}
.checkout-account-note svg {
  color: var(--violet);
  flex-shrink: 0;
  margin-top: 1px;
}
.checkout-account-note strong { color: var(--ink); }
.checkout-account-login {
  display: block;
  margin-top: 5px;
}
.checkout-account-login a {
  color: var(--violet);
  font-weight: 600;
}

/* ---------- Menu uzytkownika w naglowku (avatar + dropdown) ---------- */
.nav-user { position: relative; }

.nav-user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nav-user-toggle:hover { border-color: var(--violet); }

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-violet);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.nav-user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-chevron { color: var(--gray-400); transition: transform 0.25s; }
.nav-user-toggle[aria-expanded="true"] .nav-user-chevron { transform: rotate(180deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 234px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 200;
}
.nav-dropdown.open { opacity: 1; visibility: visible; transform: none; }

.nav-dropdown a,
.nav-dropdown-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.nav-dropdown a svg,
.nav-dropdown-logout svg { color: var(--gray-400); flex-shrink: 0; }
.nav-dropdown a:hover,
.nav-dropdown-logout:hover { background: var(--violet-50); color: var(--violet); }
.nav-dropdown a:hover svg,
.nav-dropdown-logout:hover svg { color: var(--violet); }
.nav-dropdown form { margin: 0; }
.nav-dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.nav-dropdown-logout { color: #c9184a; }
.nav-dropdown-logout:hover { background: #fff0f3; color: #c9184a; }
.nav-dropdown-logout:hover svg { color: #c9184a; }

@media (max-width: 640px) {
  .nav-user-name { display: none; }
}

/* ---------- Avatar w profilu / sidebarze ---------- */
.account-avatar { overflow: hidden; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-avatar-edit {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.account-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-violet);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
}
.account-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.account-avatar-edit .field { flex: 1; min-width: 0; }

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
}
.alert-success { background: var(--mint-50); border-color: var(--mint); color: #0a7a55; }
.alert-info { background: var(--violet-50); border-color: var(--violet-100); color: var(--violet-700); }
.alert-warning { background: #fff7e6; border-color: #ffd591; color: #ad6800; }
.alert-error,
.alert-danger { background: #fff0f3; border-color: #ffccd5; color: #c9184a; }

/* ---------- Strona logowania / rejestracji / reset ---------- */
.auth-section {
  padding: clamp(48px, 8vh, 96px) 0;
  background: var(--bg-alt);
  min-height: 72vh;
  display: flex;
  align-items: center;
}

.auth-card {
  max-width: 470px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 46px);
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: clamp(26px, 3vw, 32px);
  margin: 14px 0 8px;
}

.auth-sub {
  color: var(--gray-600);
  margin-bottom: 26px;
}

.auth-card .form button[type="submit"] {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

.auth-links {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-600);
}
.auth-links a { color: var(--violet); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}
.breadcrumb a { color: var(--gray-600); }
.breadcrumb a:hover { color: var(--violet); }
.breadcrumb .sep { opacity: 0.5; }

/* ---------- Drobne pomocnicze ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pill-violet { background: var(--violet-50); color: var(--violet-700); }
.pill-mint { background: var(--mint-50); color: #0a7a55; }

/* ---------- Koszyk w naglowku ---------- */
.nav-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.nav-cart:hover {
  background: var(--violet-50);
  color: var(--violet);
}
.nav-cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
