/* assets/css/components.css - UI Components strictly conforming to UI_UX SKILL.md */

/* 1. Icon Buttons & Standard Buttons */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--hit-target);
  height: var(--hit-target);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--tr-fast);
  padding: 0;
  position: relative;
  touch-action: manipulation;
}

.icon-btn:hover {
  background-color: var(--bg-sunken);
  color: var(--text-primary);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.icon-btn:active {
  background-color: var(--border-line);
}

.icon-btn.icon-btn-primary {
  background-color: var(--primary);
  color: var(--on-primary);
}

.icon-btn.icon-btn-primary:hover {
  background-color: var(--primary-hover);
}

.icon-btn-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 4px;
}

/* Compact Text Action Button (Used only where icon alone is ambiguous or submit) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--h-input);
  min-height: var(--hit-target);
  padding-inline: var(--sp-4);
  font-size: var(--fs-small);
  font-weight: 500;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--tr-fast);
  text-decoration: none;
  touch-action: manipulation;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-accent {
  background-color: var(--accent);
  color: var(--on-accent);
}
.btn-accent:hover { background-color: var(--accent-hover); }

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-line);
  color: var(--text-primary);
}
.btn-secondary:hover { background-color: var(--bg-sunken); }

.btn-sm {
  height: 32px;
  min-height: 36px;
  padding-inline: var(--sp-3);
  font-size: var(--fs-caption);
}

/* 2. Cards */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr-fast), box-shadow var(--tr-fast);
}

/* Product Card (Marketplace) */
.product-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: box-shadow var(--tr-fast), transform var(--tr-fast);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-sunken);
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}

.product-card:hover .product-image {
  transform: scale(1.03);
}

.dietary-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dietary-tag.veg {
  background-color: rgba(22, 163, 74, 0.9);
  color: #ffffff;
}

.dietary-tag.jain {
  background-color: rgba(217, 119, 6, 0.9);
  color: #ffffff;
}

.dietary-tag.non_veg {
  background-color: rgba(220, 38, 38, 0.9);
  color: #ffffff;
}

.product-body {
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-title {
  font-size: var(--fs-section);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.product-serving {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.product-desc {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: var(--sp-3);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-2);
  margin-top: auto;
}

.product-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.product-price span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* 3. Floated Order Radar Card (Entrepreneur PWA) */
.radar-card {
  background: linear-gradient(180deg, var(--bg-surface), var(--primary-subtle));
  border: 2px solid var(--primary);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  position: relative;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
  animation: radar-glow 3s infinite alternate;
}

@keyframes radar-glow {
  0% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.2); }
  100% { box-shadow: 0 0 16px 2px rgba(13, 148, 136, 0.35); }
}

.radar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.radar-pulse-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--accent);
  border-radius: var(--r-full);
  box-shadow: 0 0 0 rgba(249, 115, 22, 0.7);
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.margin-highlight-box {
  background: var(--bg-surface);
  border: 1px dashed var(--primary);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block: var(--sp-3);
}

.margin-profit-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

/* 4. Status Chips & Badges */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-chip.floated {
  background-color: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.status-chip.assigned {
  background-color: var(--info-subtle);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.status-chip.preparing {
  background-color: var(--warning-subtle);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.status-chip.ready {
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.status-chip.delivered {
  background-color: var(--success-subtle);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* 5. Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--sp-3);
}

.form-label {
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  height: var(--h-input);
  min-height: var(--hit-target);
  padding-inline: var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-line);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-body);
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
  width: 100%;
}

.form-textarea {
  height: auto;
  min-height: 72px;
  padding-block: var(--sp-2);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-subtle);
}

/* 6. Bottom Sheet / Slide-over Drawers */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr-normal);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90dvh;
  background-color: var(--bg-surface);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  z-index: 100;
  transform: translateY(100%);
  transition: transform var(--tr-normal);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  background-color: var(--border-line);
  border-radius: var(--r-full);
  margin: var(--sp-2) auto;
  cursor: grab;
}

.sheet-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-content {
  padding: var(--sp-4);
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.sheet-footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-line);
  background-color: var(--bg-surface);
}

/* Desktop Modal adaptation for Bottom Sheet */
@media (min-width: 600px) {
  .bottom-sheet.modal-adaptive {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    width: 90%;
    max-width: 500px;
    border-radius: var(--r-lg);
    transform: translate(-50%, -45%);
    opacity: 0;
    pointer-events: none;
  }

  .bottom-sheet.modal-adaptive.open {
    transform: translate(-50%, -50%);
    opacity: 1;
    pointer-events: auto;
  }

  .sheet-drag-handle {
    display: none;
  }

  #cart-sheet {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: 440px;
    max-height: 100dvh;
    border-radius: 0;
    border-top-left-radius: var(--r-lg);
    border-bottom-left-radius: var(--r-lg);
    transform: translateX(100%);
  }

  #cart-sheet.open {
    transform: translateX(0);
  }
}

/* 7. Tables (Desktop) & Cards (Mobile) */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-line);
  border-radius: var(--r-md);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--fs-small);
}

.data-table th {
  background-color: var(--bg-sunken);
  padding: 10px var(--sp-3);
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-line);
  white-space: nowrap;
}

.data-table td {
  padding: 12px var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: var(--bg-sunken);
}

/* 8. Toast / Snackbar Feedback */
.toast-container {
  position: fixed;
  bottom: calc(var(--h-bottomnav) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: 90%;
  width: 380px;
}

@media (min-width: 600px) {
  .toast-container {
    bottom: var(--sp-6);
  }
}

.toast {
  background-color: var(--text-primary);
  color: var(--bg-surface);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-small);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 200ms ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 9. Public Website Navigation Links & Chef Badges */
.top-nav-links {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  margin-left: var(--sp-3);
}

@media (min-width: 768px) {
  .top-nav-links {
    display: flex;
  }
}

.top-nav-link {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: all var(--tr-fast);
  cursor: pointer;
  background: none;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.top-nav-link:hover, .top-nav-link.active {
  color: var(--primary);
  background: var(--primary-subtle);
}

.chef-attribution-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  padding: 3px 8px;
  border-radius: var(--r-full);
  margin-bottom: 6px;
  width: fit-content;
}

.chef-profit-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(13, 148, 136, 0.92);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-full);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 10. Public Website Responsive Footer */
.public-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-line);
  padding: var(--sp-8) var(--sp-4) var(--sp-6);
  margin-top: var(--sp-8);
}

.public-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--sp-3);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col ul li a, .footer-col ul li button {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color var(--tr-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-col ul li a:hover, .footer-col ul li button:hover {
  color: var(--primary);
}

.public-footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-muted);
}

