/*
  Y-SON Urban Lighting — Public Frontend
  File    : frontend-components.css
  Version : v1.0.0 | 2026-05-20
  Load order: 3 of 5

  All reusable UI components.
  All values via --fe- variables — no raw hex/px.
*/

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */

.fe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fe-sp-2);
  font-family: var(--fe-font-body);
  font-size: var(--fe-text-base);
  font-weight: var(--fe-weight-semibold);
  line-height: 1;
  padding: 12px 28px;
  border-radius: var(--fe-radius-full);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition:
    background-color var(--fe-ease-fast),
    border-color var(--fe-ease-fast),
    box-shadow var(--fe-ease-fast),
    color var(--fe-ease-fast);
}

.fe-btn:disabled,
.fe-btn-loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}

.fe-btn-primary {
  background-color: var(--fe-accent);
  color: var(--fe-text-inverse);
  border-color: var(--fe-accent);
  box-shadow: 0 2px 8px var(--fe-accent-shadow);
}

.fe-btn-primary:hover {
  background-color: var(--fe-accent-dark);
  border-color: var(--fe-accent-dark);
  box-shadow: 0 4px 16px var(--fe-accent-shadow-hover);
}

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

.fe-btn-secondary:hover {
  background-color: var(--fe-surface-3);
  border-color: var(--fe-text-3);
}

.fe-btn-outline {
  background-color: transparent;
  color: var(--fe-accent);
  border-color: var(--fe-accent);
}

.fe-btn-outline:hover {
  background-color: var(--fe-accent-dim);
}

.fe-btn-outline-inverse {
  background-color: transparent;
  color: var(--fe-text-inverse);
  border-color: rgba(255, 255, 255, 0.6);
}

.fe-btn-outline-inverse:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: var(--fe-text-inverse);
}

.fe-btn-ghost {
  background-color: transparent;
  color: var(--fe-text-2);
  border-color: transparent;
  border-radius: var(--fe-radius-sm);
  padding: 10px 16px;
}

.fe-btn-ghost:hover {
  background-color: var(--fe-surface-3);
}

.fe-btn-danger {
  background-color: var(--fe-danger);
  color: var(--fe-text-inverse);
  border-color: var(--fe-danger);
}

.fe-btn-danger:hover {
  background-color: #991b1b;
  border-color: #991b1b;
}

.fe-btn-sm {
  font-size: var(--fe-text-sm);
  padding: 8px 18px;
}

.fe-btn-lg {
  font-size: var(--fe-text-lg);
  padding: 14px 36px;
}

.fe-btn-icon {
  padding: 10px;
  border-radius: var(--fe-radius-md);
  aspect-ratio: 1;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════ */

.fe-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--fe-sp-2);
}

.fe-form-label {
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-medium);
  color: var(--fe-text-2);
}

.fe-form-label .fe-required {
  color: var(--fe-danger);
  margin-left: 2px;
}

.fe-form-input,
.fe-form-select,
.fe-form-textarea {
  width: 100%;
  background-color: var(--fe-surface);
  border: 1.5px solid var(--fe-border);
  border-radius: var(--fe-radius-sm);
  color: var(--fe-text-1);
  font-size: var(--fe-text-base);
  padding: var(--fe-sp-3) var(--fe-sp-4);
  transition: border-color var(--fe-ease-fast), box-shadow var(--fe-ease-fast);
}

.fe-form-input::placeholder,
.fe-form-textarea::placeholder {
  color: var(--fe-text-3);
}

.fe-form-input:focus,
.fe-form-select:focus,
.fe-form-textarea:focus {
  border-color: var(--fe-accent);
  box-shadow: 0 0 0 3px var(--fe-accent-dim);
}

.fe-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238a92a0'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: var(--fe-sp-10);
  cursor: pointer;
}

.fe-form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--fe-leading-base);
}

.fe-form-checkbox,
.fe-form-radio {
  display: flex;
  align-items: center;
  gap: var(--fe-sp-2);
  cursor: pointer;
  font-size: var(--fe-text-sm);
  color: var(--fe-text-2);
}

.fe-form-checkbox input[type="checkbox"],
.fe-form-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--fe-accent);
  cursor: pointer;
  flex-shrink: 0;
}

.fe-form-range {
  width: 100%;
  accent-color: var(--fe-accent);
  cursor: pointer;
}

.fe-form-hint {
  font-size: var(--fe-text-xs);
  color: var(--fe-text-3);
}

.fe-form-error {
  font-size: var(--fe-text-xs);
  color: var(--fe-danger);
}

.fe-form-success {
  font-size: var(--fe-text-xs);
  color: var(--fe-success);
}

.fe-form-input.is-error,
.fe-form-select.is-error,
.fe-form-textarea.is-error {
  border-color: var(--fe-danger);
}

.fe-form-input.is-success,
.fe-form-select.is-success,
.fe-form-textarea.is-success {
  border-color: var(--fe-success);
}

/* ═══════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════ */

.fe-card {
  background-color: var(--fe-surface);
  border: 1px solid var(--fe-border-light);
  border-radius: var(--fe-radius-lg);
  box-shadow: var(--fe-shadow-card);
  transition: box-shadow var(--fe-ease-base), transform var(--fe-ease-base);
  overflow: hidden;
}

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

.fe-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.fe-card-body {
  padding: var(--fe-sp-4) var(--fe-sp-5);
}

.fe-card-title {
  font-family: var(--fe-font-heading);
  font-size: var(--fe-text-lg);
  font-weight: var(--fe-weight-semibold);
  color: var(--fe-text-1);
  margin-bottom: var(--fe-sp-2);
  line-height: var(--fe-leading-snug);
}

.fe-card-meta {
  font-size: var(--fe-text-sm);
  color: var(--fe-text-3);
  margin-bottom: var(--fe-sp-3);
}

.fe-card-footer {
  padding: var(--fe-sp-3) var(--fe-sp-5);
  border-top: 1px solid var(--fe-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fe-sp-2);
}

.fe-card-badge {
  position: absolute;
  top: var(--fe-sp-3);
  left: var(--fe-sp-3);
}

.fe-card-product {
  cursor: pointer;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════ */

.fe-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--fe-text-xs);
  font-weight: var(--fe-weight-medium);
  padding: 2px 8px;
  border-radius: var(--fe-radius-sm);
  line-height: 1.5;
  white-space: nowrap;
}

.fe-badge-primary {
  background-color: var(--fe-accent-dim);
  color: var(--fe-accent-dark);
}

.fe-badge-success {
  background-color: var(--fe-success-bg);
  color: var(--fe-success);
}

.fe-badge-warning {
  background-color: var(--fe-warning-bg);
  color: var(--fe-warning);
}

.fe-badge-danger {
  background-color: var(--fe-danger-bg);
  color: var(--fe-danger);
}

.fe-badge-gray {
  background-color: var(--fe-surface-3);
  color: var(--fe-text-2);
}

/* ═══════════════════════════════════════════════════════════
   STARS
═══════════════════════════════════════════════════════════ */

.fe-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: var(--fe-text-sm);
}

.fe-star-filled {
  color: var(--fe-accent);
}

.fe-star-half {
  color: var(--fe-accent);
  opacity: 0.6;
}

.fe-star-empty {
  color: var(--fe-border-dark);
}

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */

.fe-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--fe-sp-4);
  z-index: var(--fe-z-modal);
  animation: feOverlayIn var(--fe-ease-base) forwards;
}

.fe-modal-overlay.fe-hidden {
  display: none;
}

.fe-modal {
  background-color: var(--fe-surface);
  border-radius: var(--fe-radius-xl);
  box-shadow: var(--fe-shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: feModalIn var(--fe-ease-spring) forwards;
}

.fe-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fe-sp-5) var(--fe-sp-6);
  border-bottom: 1px solid var(--fe-border-light);
  font-family: var(--fe-font-heading);
  font-size: var(--fe-text-xl);
  font-weight: var(--fe-weight-semibold);
  color: var(--fe-text-1);
}

.fe-modal-body {
  padding: var(--fe-sp-6);
}

.fe-modal-footer {
  padding: var(--fe-sp-4) var(--fe-sp-6);
  border-top: 1px solid var(--fe-border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--fe-sp-3);
}

/* ═══════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════ */

.fe-toast-container {
  position: fixed;
  bottom: var(--fe-sp-6);
  right: var(--fe-sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--fe-sp-3);
  z-index: var(--fe-z-toast);
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - var(--fe-sp-12));
}

.fe-toast {
  padding: var(--fe-sp-3) var(--fe-sp-4);
  border-radius: var(--fe-radius-md);
  box-shadow: var(--fe-shadow-lg);
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-medium);
  line-height: var(--fe-leading-base);
  pointer-events: all;
  animation: feToastIn var(--fe-ease-spring) forwards;
  border-left: 3px solid transparent;
}

.fe-toast-success {
  background-color: var(--fe-success-bg);
  color: var(--fe-success);
  border-left-color: var(--fe-success);
}

.fe-toast-error {
  background-color: var(--fe-danger-bg);
  color: var(--fe-danger);
  border-left-color: var(--fe-danger);
}

.fe-toast-warning {
  background-color: var(--fe-warning-bg);
  color: var(--fe-warning);
  border-left-color: var(--fe-warning);
}

/* ═══════════════════════════════════════════════════════════
   SPINNER
═══════════════════════════════════════════════════════════ */

.fe-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--fe-border);
  border-top-color: var(--fe-accent);
  border-radius: 50%;
  animation: feSpin 0.7s linear infinite;
  flex-shrink: 0;
}

.fe-spinner-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(248, 247, 244, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--fe-z-overlay);
  backdrop-filter: blur(2px);
}

.fe-spinner-overlay.fe-hidden {
  display: none;
}

.fe-spinner-overlay .fe-spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */

.fe-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--fe-sp-2);
  flex-wrap: wrap;
}

.fe-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--fe-sp-3);
  border-radius: var(--fe-radius-sm);
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-medium);
  color: var(--fe-text-2);
  background-color: var(--fe-surface);
  border: 1px solid var(--fe-border);
  cursor: pointer;
  transition: all var(--fe-ease-fast);
}

.fe-pagination-btn:hover {
  background-color: var(--fe-surface-3);
  border-color: var(--fe-border-dark);
  color: var(--fe-text-1);
}

.fe-pagination-active,
.fe-pagination-active:hover {
  background-color: var(--fe-accent);
  border-color: var(--fe-accent);
  color: var(--fe-text-inverse);
}

/* ═══════════════════════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════════════════════ */

.fe-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.fe-breadcrumb-item {
  font-size: var(--fe-text-sm);
  color: var(--fe-text-3);
}

.fe-breadcrumb-item a {
  color: var(--fe-text-3);
  transition: color var(--fe-ease-fast);
}

.fe-breadcrumb-item a:hover {
  color: var(--fe-accent);
}

.fe-breadcrumb-item.is-active {
  color: var(--fe-text-2);
  font-weight: var(--fe-weight-medium);
}

.fe-breadcrumb-separator {
  color: var(--fe-border-dark);
  font-size: var(--fe-text-xs);
  margin: 0 var(--fe-sp-2);
}

/* ═══════════════════════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════════════════════ */

.fe-hidden {
  display: none !important;
}

.fe-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.fe-text-center  { text-align: center; }
.fe-text-right   { text-align: right; }

.fe-flex         { display: flex; align-items: center; }
.fe-flex-between { display: flex; align-items: center; justify-content: space-between; }
.fe-flex-center  { display: flex; align-items: center; justify-content: center; }

.fe-gap-2 { gap: var(--fe-sp-2); }
.fe-gap-4 { gap: var(--fe-sp-4); }
.fe-gap-6 { gap: var(--fe-sp-6); }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════ */

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

@keyframes feToastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes feOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes feModalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
