/* Meca Admin UI — Component Styles v3.0 — Light Theme */

/* ===========================
   BUTTONS
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

/* Primary */
.btn-primary {
  background: var(--color-indigo);
  color: var(--color-white);
  border-color: var(--color-indigo);
}

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

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

/* Secondary */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--color-slate-700);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--color-slate-300);
}

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

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

/* Danger */
.btn-danger {
  background: var(--color-red-bg);
  color: var(--color-red-dark);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--color-red);
  color: var(--color-white);
  border-color: var(--color-red);
}

/* Gradient */
.btn-gradient {
  background: var(--gradient-primary);
  color: var(--color-white);
  border-color: transparent;
}

.btn-gradient:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-indigo);
}

/* Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-caption);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
}

/* Icon button */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}


/* ===========================
   BADGES
   =========================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

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

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

.badge-error {
  background: var(--color-red-bg);
  color: var(--color-red-dark);
}

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

.badge-neutral {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.badge-cyan {
  background: var(--color-cyan-50);
  color: var(--color-cyan-dark);
}

.badge-indigo {
  background: var(--color-indigo-50);
  color: var(--color-indigo);
}

.badge-gradient {
  background: var(--gradient-primary);
  color: var(--color-white);
}


/* ===========================
   CARDS
   =========================== */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--transition-normal);
}

.card-hoverable {
  cursor: pointer;
}

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

.card-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.card-stat .stat-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.card-stat .stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1.1;
}

.card-stat .stat-trend {
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}

.card-stat .stat-trend.up { color: var(--color-green-dark); }
.card-stat .stat-trend.down { color: var(--color-red-dark); }

.card-danger {
  background: var(--bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}


/* ===========================
   TABLES
   =========================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
}

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

.table thead th {
  background: var(--bg-hover);
  padding: 10px var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

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

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

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

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--text-primary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-default);
  gap: var(--space-4);
}

.pagination-info {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: var(--space-2);
}


/* ===========================
   FORMS
   =========================== */

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

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

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

.form-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-small);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

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

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-indigo-50);
}

.form-input.error {
  border-color: var(--color-red);
  box-shadow: 0 0 0 3px var(--color-red-bg);
}

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

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

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

select.form-input {
  cursor: pointer;
}


/* ===========================
   TOASTS
   =========================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 420px;
}

.toast-success { border-left: 4px solid var(--color-green); }
.toast-error   { border-left: 4px solid var(--color-red); }
.toast-warning { border-left: 4px solid var(--color-amber); }
.toast-info    { border-left: 4px solid var(--color-indigo); }

.toast-title {
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}


/* ===========================
   MODALS
   =========================== */

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

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  color: var(--text-secondary);
}

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


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

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-slate-200) 25%, var(--color-slate-100) 50%, var(--color-slate-200) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 20px;
  border-radius: var(--radius-sm);
}

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

.skeleton-row {
  height: 44px;
  border-radius: 0;
  border-bottom: 1px solid var(--border-light);
}


/* ===========================
   BREADCRUMBS
   =========================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.breadcrumb-item a {
  color: var(--color-indigo);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--color-indigo-hover);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-disabled);
  user-select: none;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}


/* ===========================
   SWITCH (standalone CSS)
   =========================== */

.switch {
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--color-slate-300);
  cursor: pointer;
  padding: 2px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.switch::after {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.switch.active {
  background: var(--color-indigo);
}

.switch.active::after {
  transform: translateX(20px);
}


/* ===========================
   PROGRESS BARS
   =========================== */

.progress-bar {
  height: 6px;
  background: var(--color-slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-indigo);
  transition: width var(--transition-slow);
}

.progress-fill.warning { background: var(--color-amber); }
.progress-fill.danger  { background: var(--color-red); }


/* ===========================
   EMPTY STATES
   =========================== */

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

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--color-slate-300);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: var(--space-6);
}


/* ===========================
   UTILITIES
   =========================== */

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--text-accent); }
.text-success   { color: var(--color-green-dark); }
.text-warning   { color: var(--color-amber-dark); }
.text-error     { color: var(--color-red-dark); }
.text-mono      { font-family: var(--font-mono); }
.text-xs        { font-size: var(--text-xs); }
.text-sm        { font-size: var(--text-sm); }
.text-base      { font-size: var(--text-base); }
.font-medium    { font-weight: var(--weight-medium); }
.font-semibold  { font-weight: var(--weight-semibold); }
.font-bold      { font-weight: var(--weight-bold); }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full         { width: 100%; }
