/* Buttons, cards, badges, toasts, modals, states */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); font-weight: 650; font-size: var(--fs-sm);
  border: 1px solid transparent; transition: var(--transition); white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn--primary { background: var(--green-600); color: #fff; box-shadow: 0 4px 14px rgba(21,115,71,.25); }
.btn--primary:hover { background: var(--green-700); color: #fff; }
.btn--dark { background: var(--green-900); color: #fff; }
.btn--dark:hover { background: #052616; color: #fff; }
.btn--outline { border-color: var(--border-strong); background: var(--surface); color: var(--ink-800); }
.btn--outline:hover { border-color: var(--green-500); color: var(--green-700); background: var(--green-50); }
.btn--ghost { color: var(--ink-700); }
.btn--ghost:hover { background: var(--ink-100); }
.btn--danger { background: var(--danger-500); color: #fff; }
.btn--danger:hover { background: var(--danger-600); color: #fff; }
.btn--light { background: #fff; color: var(--green-800); }
.btn--light:hover { background: var(--green-50); color: var(--green-800); }
.btn--sm { padding: 7px 13px; font-size: var(--fs-xs); }
.btn--lg { padding: 14px 26px; font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }
.btn.is-loading .btn__label::after { content: '…'; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 3px solid var(--green-100); border-top-color: var(--green-600);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.card--pad { padding: var(--sp-5); }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__head h3, .card__head h2 { font-size: var(--fs-md); }
.card__body { padding: var(--sp-5); }
.card__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--ink-50); border-radius: 0 0 var(--radius) var(--radius); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 650; line-height: 1.5;
  background: var(--ink-100); color: var(--ink-700); border: 1px solid var(--border);
}
.badge--green { background: var(--ok-100); color: var(--ok-600); border-color: #bfe6cf; }
.badge--warn { background: var(--warn-100); color: var(--warn-600); border-color: #f0dfb5; }
.badge--danger { background: var(--danger-100); color: var(--danger-600); border-color: #f5cfcf; }
.badge--info { background: var(--sky-100); color: var(--sky-600); border-color: #c7e2f2; }
.badge--demo { background: #efe8fb; color: #57369b; border-color: #dcd0f5; }
.badge--verified::before { content: '✓'; font-weight: 800; }

/* Product cards */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: var(--sp-4); }
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: var(--transition);
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--green-300); }
.product-card__media { position: relative; aspect-ratio: 4/3; background: var(--ink-100); overflow: hidden; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.product-card:hover .product-card__media img { transform: scale(1.05); }
.product-card__tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.product-card__tags .badge { background: rgba(255,255,255,.95); backdrop-filter: blur(4px); }
.fav-btn {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); display: grid; place-items: center; box-shadow: var(--shadow-xs);
  font-size: 15px; color: var(--ink-600);
}
.fav-btn.is-active { color: var(--danger-500); }
.product-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card__title { font-size: var(--fs-base); font-weight: 700; color: var(--ink-900); }
.product-card__title a { color: inherit; }
.product-card__meta { font-size: var(--fs-xs); color: var(--ink-500); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.price { font-family: var(--font-display); font-weight: 800; color: var(--green-700); font-size: var(--fs-lg); }
.price small { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-500); }
.product-card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: var(--sp-3); }
.product-card__actions .btn { flex: 1; }

/* States */
.state {
  display: grid; place-items: center; text-align: center; gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4); color: var(--ink-600);
}
.state__icon { font-size: 2.6rem; }
.state h3 { font-size: var(--fs-md); color: var(--ink-800); }
.state p { max-width: 420px; font-size: var(--fs-sm); }
.state--error .state__icon { color: var(--danger-500); }
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-50) 37%, var(--ink-100) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-card { height: 300px; border-radius: var(--radius); }

/* Toasts */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--green-500);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); animation: toastIn 240ms ease;
}
.toast--error { border-left-color: var(--danger-500); }
.toast--warn { border-left-color: var(--warn-500); }
.toast--info { border-left-color: var(--sky-600); }
.toast__title { font-weight: 700; font-size: var(--fs-sm); }
.toast__msg { font-size: var(--fs-xs); color: var(--ink-600); }
.toast__close { margin-left: auto; color: var(--ink-400); font-size: 16px; line-height: 1; }
.toast.is-out { animation: toastOut 200ms ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 26, 18, .55); z-index: 200;
  display: grid; place-items: center; padding: 16px; animation: fade 160ms ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: min(560px, 100%);
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop 200ms ease;
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal__head h3 { font-size: var(--fs-lg); }
.modal__body { padding: 0 var(--sp-5) var(--sp-4); color: var(--ink-600); font-size: var(--fs-sm); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal__close { font-size: 22px; color: var(--ink-400); width: 34px; height: 34px; border-radius: 50%; }
.modal__close:hover { background: var(--ink-100); }

/* Tabs / chips / pills */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 11px 16px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-600);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--green-700); }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-600); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: var(--radius-full); border: 1px solid var(--border-strong);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-700); background: var(--surface); transition: var(--transition);
}
.chip:hover { border-color: var(--green-400); color: var(--green-700); }
.chip.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { min-width: 620px; font-size: var(--fs-sm); }
table.data th {
  text-align: left; padding: 12px 14px; background: var(--ink-50); color: var(--ink-600);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border);
}
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--green-50); }
.trend-up { color: var(--ok-600); font-weight: 700; }
.trend-down { color: var(--danger-600); font-weight: 700; }
.trend-flat { color: var(--ink-500); font-weight: 700; }

.progress { height: 8px; border-radius: var(--radius-full); background: var(--ink-100); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green-500); border-radius: inherit; transition: width 300ms ease; }
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; }
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.pagination button {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: var(--fs-sm); font-weight: 600;
}
.pagination button.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.pagination button[disabled] { opacity: .45; pointer-events: none; }
