/* Buttons (push them gently, they have feelings) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
  font-weight: 500;
  border-radius: var(--radius-pill);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    border-color var(--transition-fast);
  cursor: pointer;
  border: none;
  min-height: var(--touch-target);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: white;
  box-shadow: 0 2px 8px rgba(67, 205, 128, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(67, 205, 128, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--brand-500);
}

.btn-outline {
  background: transparent;
  color: var(--brand-600);
  border: 2px solid var(--brand-500);
}

.btn-outline:hover {
  background: var(--brand-500);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-subtle);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
  min-height: 52px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

:where(.card-header, .modal-header, .list-item) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: 0 4px 12px var(--shadow-color);
}

.card-header {
  margin-bottom: var(--space-3);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-strong);
}

.card-body {
  color: var(--text);
}

/* Product Card */
.product-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px var(--shadow-color);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--surface-subtle);
}

.product-card .meta {
  padding: var(--space-4);
}

.product-card h3 {
  font-size: var(--font-size-base);
  margin: var(--space-2) 0;
}

.product-card .price-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.product-card .price {
  font-size: var(--font-size-lg);
  color: var(--brand-600);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-strong);
}

.form-input,
.form-select,
.form-textarea {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(67, 205, 128, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--error);
}

/* Search Bar */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 600px;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--font-size-sm);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: var(--muted);
  pointer-events: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--brand-500);
  color: white;
}

.badge-outline {
  background: transparent;
  color: var(--brand-600);
  border: 1px solid var(--brand-500);
}

.badge-secondary {
  background: var(--surface-subtle);
  color: var(--text);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text);
}

/* Banner */
.banner {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.banner:hover {
  transform: scale(1.02);
}

.banner-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.banner-subtitle {
  font-size: var(--font-size-base);
  opacity: 0.9;
}

/* Categories */
.category-strip {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding: var(--space-4) 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition-fast);
  min-width: 80px;
}

.category-item:hover {
  background: var(--surface-subtle);
}

.category-item.active {
  background: var(--brand-500);
  color: white;
}

.category-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-subtle);
}

.category-item.active .category-icon {
  background: rgba(255, 255, 255, 0.2);
}

.category-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Icon Button */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.icon-btn:hover {
  background: var(--surface-subtle);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px var(--shadow-color);
  z-index: var(--z-overlay);
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--surface-subtle);
}

.dropdown-item:active,
.dropdown-item.active {
  background: var(--brand-500);
  color: white;
}

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-item {
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.list-item:hover {
  background: var(--surface-subtle);
}

/* Wallet Banner */
.wallet-banner {
  background: linear-gradient(135deg, #FCD34D, #F59E0B);
  color: #78350F;
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.wallet-amount {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-subtle);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-8);
}

/* Toast */
.toast {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  max-width: 400px;
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px var(--shadow-color);
  z-index: var(--z-toast);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--error);
}

.toast-info {
  border-left: 4px solid var(--info);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal);
}

.modal,
.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: min(500px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
}

.modal-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: var(--space-4);
}

.modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}
