/**
 * Guanyiai Design System - Components
 * Buttons, Cards, Forms, Tables, Modals, Badges
 * Version: 2.0
 * Date: 2026-05-30
 */

/* ============================================
   CONTAINER
   ============================================ */

.container {
  width: 100%;
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
}

.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--lg { max-width: var(--container-lg); }
.container--xl { max-width: var(--container-xl); }
.container--2xl { max-width: var(--container-2xl); }

@media (min-width: 768px) {
  .container {
    padding-left: var(--page-padding-lg);
    padding-right: var(--page-padding-lg);
  }
}

/* ============================================
   BUTTON
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-none);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Sizes */
.btn--xs {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-2xs);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn--md {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-body-sm);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-body);
}

.btn--xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-lg);
}

/* Button Width */
.btn--block {
  display: flex;
  width: 100%;
}

/* Button Variants - Primary */
.btn--primary {
  background: var(--color-primary-600);
  color: var(--color-text-inverse);
  border-color: var(--color-primary-600);
}

.btn--primary:hover {
  background: var(--color-primary-700);
  border-color: var(--color-primary-700);
  box-shadow: var(--shadow-primary-md);
  transform: translateY(-1px);
}

.btn--primary:active {
  background: var(--color-primary-800);
  transform: translateY(0);
  box-shadow: none;
}

/* Button Variants - Secondary (Outline) */
.btn--secondary {
  background: transparent;
  color: var(--color-primary-600);
  border-color: var(--color-primary-300);
}

.btn--secondary:hover {
  background: var(--color-primary-50);
  border-color: var(--color-primary-400);
  transform: translateY(-1px);
}

.btn--secondary:active {
  background: var(--color-primary-100);
  transform: translateY(0);
}

/* Button Variants - Accent (Gold) */
.btn--accent {
  background: var(--color-secondary-500);
  color: var(--color-neutral-900);
  border-color: var(--color-secondary-500);
}

.btn--accent:hover {
  background: var(--color-secondary-600);
  border-color: var(--color-secondary-600);
  box-shadow: var(--shadow-secondary-md);
  transform: translateY(-1px);
}

.btn--accent:active {
  background: var(--color-secondary-700);
  transform: translateY(0);
  box-shadow: none;
}

/* Button Variants - Ghost */
.btn--ghost {
  background: transparent;
  color: var(--color-text-primary);
  border-color: transparent;
}

.btn--ghost:hover {
  background: var(--color-bg-secondary);
}

.btn--ghost:active {
  background: var(--color-bg-tertiary);
}

/* Button Variants - Danger */
.btn--danger {
  background: var(--color-error);
  color: var(--color-text-inverse);
  border-color: var(--color-error);
}

.btn--danger:hover {
  background: var(--color-error-dark);
  border-color: var(--color-error-dark);
  box-shadow: 0 4px 14px 0 rgb(220 38 38 / 0.3);
  transform: translateY(-1px);
}

.btn--danger:active {
  background: #991b1b;
  transform: translateY(0);
  box-shadow: none;
}

/* Button Variants - Success */
.btn--success {
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-color: var(--color-success);
}

.btn--success:hover {
  background: var(--color-success-dark);
  border-color: var(--color-success-dark);
  box-shadow: 0 4px 14px 0 rgb(22 163 74 / 0.3);
  transform: translateY(-1px);
}

/* Button Variants - Jade */
.btn--jade {
  background: var(--color-accent-500);
  color: var(--color-text-inverse);
  border-color: var(--color-accent-500);
}

.btn--jade:hover {
  background: var(--color-accent-600);
  border-color: var(--color-accent-600);
  box-shadow: var(--shadow-accent-md);
  transform: translateY(-1px);
}

/* Button with Icons */
.btn__icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

/* Icon-only Button */
.btn--icon {
  padding: var(--space-3);
  aspect-ratio: 1;
}

.btn--icon.btn--sm {
  padding: var(--space-2);
}

.btn--icon.btn--lg {
  padding: var(--space-4);
}

/* Button Loading State */
.btn--loading {
  color: transparent;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  width: 1.25em;
  height: 1.25em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  color: inherit;
}

.btn--loading.btn--primary::after,
.btn--loading.btn--accent::after,
.btn--loading.btn--danger::after,
.btn--loading.btn--success::after,
.btn--loading.btn--jade::after {
  border-color: rgba(255, 255, 255, 0.3);
  border-right-color: transparent;
}

/* ============================================
   CARD
   ============================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-all);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--color-primary-300);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

.card--featured {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg-secondary) 100%);
  border-color: var(--color-secondary-200);
}

.card--featured:hover {
  box-shadow: var(--shadow-secondary-md);
  border-color: var(--color-secondary-400);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card--flat {
  box-shadow: none;
}

.card--flat:hover {
  box-shadow: var(--shadow-md);
}

/* Card Sections */
.card__header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-4);
}

.card__body {
  flex: 1;
}

.card__footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ============================================
   NAVIGATION CARD
   ============================================ */

.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: var(--color-text-primary);
  transition: var(--transition-all);
  position: relative;
  overflow: hidden;
}

.nav-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-secondary-400));
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.nav-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary-200);
}

.nav-card:hover::before {
  opacity: 1;
}

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

.nav-card__icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
  transition: var(--transition-transform);
}

.nav-card:hover .nav-card__icon {
  transform: scale(1.1) rotate(5deg);
}

.nav-card__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  text-align: center;
}

.nav-card__description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  line-height: var(--leading-relaxed);
  max-width: 280px;
}

/* Featured Navigation Card */
.nav-card--featured {
  grid-column: span 2;
  padding: var(--space-10);
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg-secondary) 100%);
  border-color: var(--color-secondary-200);
}

.nav-card--featured:hover {
  box-shadow: var(--shadow-secondary-lg);
  border-color: var(--color-secondary-400);
}

.nav-card--featured .nav-card__icon {
  width: 88px;
  height: 88px;
  font-size: var(--text-3xl);
}

.nav-card--featured .nav-card__title {
  font-size: var(--text-xl);
}

@media (max-width: 640px) {
  .nav-card--featured {
    grid-column: span 1;
  }
}

/* ============================================
   NAVIGATION GRID
   ============================================ */

.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--grid-gap-md);
  margin-bottom: var(--space-10);
}

@media (max-width: 640px) {
  .nav-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   FORM: INPUT
   ============================================ */

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--color-bg-secondary);
}

/* Input Sizes */
.input--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.input--lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-body);
}

/* Input States */
.input--error {
  border-color: var(--color-error);
}

.input--error:focus {
  box-shadow: 0 0 0 3px var(--color-error-light);
  border-color: var(--color-error);
}

.input--success {
  border-color: var(--color-success);
}

.input--success:focus {
  box-shadow: 0 0 0 3px var(--color-success-light);
}

/* Input with Icon */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-left: var(--space-10);
}

.input-group__icon {
  position: absolute;
  left: var(--space-3);
  width: 20px;
  height: 20px;
  color: var(--color-text-tertiary);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-group__action {
  position: absolute;
  right: var(--space-2);
  display: flex;
  align-items: center;
}

/* ============================================
   FORM: TEXTAREA
   ============================================ */

.textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  resize: vertical;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.textarea:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

.textarea::placeholder {
  color: var(--color-text-tertiary);
}

/* ============================================
   FORM: SELECT
   ============================================ */

.select {
  width: 100%;
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-body-sm);
  color: var(--color-text-primary);
  background: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
}

.select:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

/* ============================================
   FORM: CHECKBOX & RADIO
   ============================================ */

.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-body-sm);
  color: var(--color-text-primary);
  user-select: none;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary-600);
  cursor: pointer;
}

/* ============================================
   FORM: LABEL & HELPER
   ============================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}

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

.form-label--required::after {
  content: ' *';
  color: var(--color-error);
}

.form-helper {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ============================================
   FORM: SEARCH
   ============================================ */

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
  width: 100%;
}

.search-box__icon {
  position: absolute;
  left: var(--space-4);
  width: 20px;
  height: 20px;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.search-box .input {
  padding-left: var(--space-12);
  padding-right: var(--space-12);
  border-radius: var(--radius-full);
}

.search-box__clear {
  position: absolute;
  right: var(--space-3);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.search-box__clear:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* ============================================
   TABLE
   ============================================ */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-sm);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color var(--duration-fast) var(--ease-default);
}

.table tbody tr:hover {
  background: var(--color-bg-secondary);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Striped Table */
.table--striped tbody tr:nth-child(even) {
  background: var(--color-bg-secondary);
}

.table--striped tbody tr:nth-child(even):hover {
  background: var(--color-bg-tertiary);
}

/* Compact Table */
.table--compact th,
.table--compact td {
  padding: var(--space-2) var(--space-3);
}

/* Bordered Table */
.table--bordered th,
.table--bordered td {
  border: 1px solid var(--color-border-subtle);
}

/* Sortable Column */
.table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.table th[data-sort]:hover {
  background: var(--color-bg-tertiary);
}

.table th[data-sort]::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: var(--space-2);
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted);
}

.table th[data-sort="asc"]::after {
  border-top: none;
  border-bottom: 5px solid var(--color-primary-500);
}

.table th[data-sort="desc"]::after {
  border-top: 5px solid var(--color-primary-500);
}

/* ============================================
   MODAL
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-default),
              visibility var(--duration-normal) var(--ease-default);
}

.modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - var(--space-12));
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition: transform var(--duration-normal) var(--ease-spring),
              opacity var(--duration-normal) var(--ease-default);
}

.modal-backdrop.is-active .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal--sm { max-width: 400px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }
.modal--full { max-width: calc(100vw - var(--space-12)); max-height: calc(100vh - var(--space-12)); }

/* Modal Header */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
}

.modal__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-tertiary);
  transition: var(--transition-colors);
}

.modal__close:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* Modal Body */
.modal__body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  color: var(--color-text-secondary);
}

/* Modal Footer */
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
}

/* Modal close on Escape / click backdrop handled via JS */
body.modal-open {
  overflow: hidden;
}

/* ============================================
   TOAST / NOTIFICATION
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-toast);
  box-shadow: var(--shadow-lg);
  animation: slideDown var(--duration-normal) var(--ease-out) forwards;
}

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

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

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

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

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast__content {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: var(--text-body-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.toast__message {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-0-5);
}

.toast__close {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: var(--transition-colors);
}

.toast__close:hover {
  color: var(--color-text-primary);
}

/* ============================================
   BADGE
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-badge);
  line-height: var(--leading-none);
  white-space: nowrap;
}

/* Badge Sizes */
.badge--sm {
  padding: var(--space-0-5) var(--space-2);
  font-size: var(--text-2xs);
}

.badge--lg {
  padding: var(--space-1-5) var(--space-4);
  font-size: var(--text-sm);
}

/* Badge Variants */
.badge--primary {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}

.badge--secondary {
  background: var(--color-secondary-100);
  color: var(--color-secondary-700);
}

.badge--accent {
  background: var(--color-accent-100);
  color: var(--color-accent-700);
}

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

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

.badge--error {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge--info {
  background: var(--color-info-light);
  color: var(--color-info);
}

/* Badge Dot */
.badge--dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}

/* Badge Pill (wider) */
.badge--pill {
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-avatar);
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--xs { width: 24px; height: 24px; font-size: var(--text-2xs); }
.avatar--sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar--md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar--xl { width: 72px; height: 72px; font-size: var(--text-xl); }

/* Avatar Group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   TOOLTIP
   ============================================ */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-inverse);
  background: var(--color-neutral-800);
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-default),
              transform var(--duration-fast) var(--ease-default);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   CHIP
   ============================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: var(--transition-colors);
  cursor: pointer;
}

.chip:hover {
  background: var(--color-bg-tertiary);
}

.chip--active {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  border-color: var(--color-primary-300);
}

.chip__close {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--duration-fast);
}

.chip__close:hover {
  opacity: 1;
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

.divider--subtle { background: var(--color-border-subtle); }
.divider--strong { background: var(--color-border-strong); }

.divider--gradient {
  background: linear-gradient(90deg,
    transparent,
    var(--color-primary-300),
    transparent
  );
}

/* Divider with Text */
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-secondary) 25%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton--text {
  height: 1em;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton--heading {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.skeleton--card {
  height: 200px;
  border-radius: var(--radius-lg);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state__title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state__description {
  font-size: var(--text-body-sm);
  color: var(--color-text-tertiary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* ============================================
   HEADER
   ============================================ */

.header {
  text-align: center;
  padding: var(--space-16) 0 var(--space-12);
}

.header__logo {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-800);
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-4);
}

.header__divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-secondary-400), transparent);
  margin: var(--space-4) auto;
}

.header__subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--color-text-secondary);
  letter-spacing: var(--tracking-widest);
  font-weight: var(--font-weight-regular);
}

/* ============================================
   THEME TOGGLE
   ============================================ */

.theme-toggle {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  transition: var(--transition-all);
  z-index: var(--z-max);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
  transform: scale(1.05);
}

.theme-toggle__icon {
  transition: transform var(--duration-normal) var(--ease-spring);
}

.theme-toggle:hover .theme-toggle__icon {
  transform: rotate(15deg);
}

/* ============================================
   TOP DECORATION
   ============================================ */

.top-decoration {
  height: 4px;
  background: linear-gradient(90deg,
    transparent,
    var(--color-primary-400),
    var(--color-secondary-400),
    var(--color-primary-400),
    transparent
  );
}
