/* ════════════════════════════════════════════
   PRINTCRAFT – components.css
   Reusable UI components & page utilities
   ════════════════════════════════════════════ */

/* ─── Toast ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--gray-900);
  color: var(--white);
  padding: .9rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: .88rem;
  min-width: 260px;
  max-width: 360px;
  animation: toastIn .3s ease forwards;
}
.toast.success { border-left: 4px solid #52b788; }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid #74c0fc; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.out {
  animation: toastOut .3s ease forwards;
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ─── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 540px;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(20px);
  transition: transform .25s;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal__header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.modal__header h3 { font-size: 1.15rem; }
.modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--gray-600);
  transition: all var(--transition);
}
.modal__close:hover { background: var(--red); color: var(--white); }
.modal__body { padding: 1.5rem; }
.modal__footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

/* ─── Breadcrumb ─────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--gray-500);
  padding: 1rem 0;
}
.breadcrumb a { color: var(--gray-500); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb i { font-size: .65rem; }

/* ─── Tabs ───────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 2rem; }
.tab-btn {
  padding: .75rem 1.5rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-btn:hover  { color: var(--red); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Badge ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.badge--red    { background: #ffe3e3; color: var(--red-dark); }
.badge--green  { background: #d8f3dc; color: #1b4332; }
.badge--blue   { background: #dbe4ff; color: #1971c2; }
.badge--yellow { background: #fff9db; color: #e67700; }

/* ─── Rating Stars ───────────────────────────── */
.stars { display: inline-flex; gap: 2px; color: #f4a261; }
.stars--sm  { font-size: .75rem; }
.stars--lg  { font-size: 1.2rem; }

/* ─── Form Elements ──────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .87rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: var(--gray-700);
}
.form-control {
  width: 100%;
  padding: .7rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  transition: border-color var(--transition);
  background: var(--white);
}
.form-control:focus {
  outline: none;
  border-color: var(--red);
}
.form-control.error { border-color: var(--red); }
.form-hint { font-size: .78rem; color: var(--gray-500); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--red); margin-top: .3rem; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px; padding-right: 2.5rem; }

/* ─── Quantity Picker ────────────────────────── */
.qty-picker {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  font-size: 1rem;
  transition: background var(--transition);
}
.qty-btn:hover { background: var(--gray-200); }
.qty-input {
  width: 48px;
  height: 36px;
  text-align: center;
  border: none;
  outline: none;
  font-weight: 600;
}

/* ─── Progress Bar ───────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: var(--red);
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

/* ─── Skeleton Loader ────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Page Hero (inner pages) ────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  color: var(--white);
  padding: 4rem 0 3rem;
  text-align: center;
}
.page-hero h1 { margin-bottom: .5rem; }
.page-hero p   { opacity: .8; font-size: 1.05rem; }

/* ─── Alert ──────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.alert--success { background: #d8f3dc; color: #1b4332; border-left: 4px solid #52b788; }
.alert--error   { background: #ffe3e3; color: #7b1a1a; border-left: 4px solid var(--red); }
.alert--info    { background: #dbe4ff; color: #1864ab; border-left: 4px solid #74c0fc; }
.alert--warning { background: #fff9db; color: #7c5c00; border-left: 4px solid #ffd60a; }

/* ─── Sticky Add to Cart ─────────────────────── */
.sticky-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 2px solid var(--gray-200);
  padding: 1rem 0;
  z-index: 900;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  transform: translateY(100%);
  transition: transform .3s ease;
}
.sticky-cart-bar.visible { transform: translateY(0); }
.sticky-cart-bar__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
}
.sticky-cart-bar__info h4 { font-size: 1rem; }
.sticky-cart-bar__info p  { font-size: .82rem; color: var(--gray-500); }
.sticky-cart-bar__price   { font-size: 1.4rem; font-weight: 800; color: var(--red); }

/* ─── Scroll to top ──────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 800;
}
.scroll-top.visible { opacity: 1; pointer-events: all; }
.scroll-top:hover { background: var(--red-dark); transform: translateY(-2px); }

/* ─── Loading Spinner ────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: var(--radius-full);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Chip tags ──────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--gray-300);
  font-size: .8rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
}
.chip:hover, .chip.active {
  border-color: var(--red);
  background: #ffe3e3;
  color: var(--red-dark);
}

/* ─── Color Swatches ─────────────────────────── */
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  cursor: pointer;
  transition: border-color var(--transition);
}
.color-swatch.selected { border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,70,.3); }

/* ─── Comparison Check ───────────────────────── */
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .4rem 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--gray-100);
}
.feature-list li i.fa-check   { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.feature-list li i.fa-times   { color: var(--red);   flex-shrink: 0; margin-top: 2px; }

/* ─── Pagination ─────────────────────────────── */
.pagination {
  display: flex;
  gap: .4rem;
  justify-content: center;
  margin-top: 3rem;
}
.page-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  font-size: .88rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}
