/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: .9rem;
  font-weight: 500;
  border: none;
  background: var(--c-primary);
  color: #fff;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover   { background: var(--c-primary-h); box-shadow: var(--shadow-sm); }
.btn:active  { transform: scale(.97); }
.btn.ghost   { background: transparent; color: var(--c-primary); border: 1.5px solid var(--c-primary); }
.btn.ghost:hover { background: #eef2ff; }
.btn.danger  { background: var(--c-danger); }
.btn.danger:hover { background: #dc2626; }
.btn.sm      { padding: 5px 12px; font-size: .8rem; }
.btn.icon-btn {
  padding: 6px;
  background: transparent;
  color: var(--c-muted);
  border-radius: var(--r-sm);
  font-size: 1rem;
}
.btn.icon-btn:hover { background: var(--c-bg); color: var(--c-text); }

/* ─── Form Elements ─────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--c-muted);
}
input[type=text],
input[type=password],
input[type=number],
input[type=email],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .15s ease;
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 16px; }
}
.modal-card {
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px 20px 28px;
  animation: slideUp .2s ease;
}
@media (min-width: 480px) {
  .modal-card { border-radius: var(--r-xl); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Toast ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(56px + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
@media (min-width: 768px) { #toast-container { bottom: 20px; } }
.toast {
  background: #1e293b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .88rem;
  box-shadow: var(--shadow-md);
  animation: slideUp .2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.success { background: var(--c-success); }
.toast.error   { background: var(--c-danger); }

/* ─── Badges / Tags ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #eef2ff;
  color: var(--c-primary);
}
.badge.admin { background: #fef3c7; color: #92400e; }

/* ─── Stars ─────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; }
.star { font-size: 1.1rem; cursor: pointer; transition: transform var(--transition); }
.star:hover { transform: scale(1.2); }
.star.filled { color: var(--c-warn); }
.star.empty  { color: var(--c-border); }

/* ─── Checkbox ──────────────────────────────────────────── */
.check-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.check-wrap input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--c-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Chip Group (module tabs) ───────────────────────────── */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  color: var(--c-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.chip.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

/* ─── Color Dot ─────────────────────────────────────────── */
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--c-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: .9rem; }

/* ─── Toggle Switch ─────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--c-border);
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--c-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Animations ────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin     { to { transform: rotate(360deg); } }

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
