/* ============================================================
   SETMONA — components.css
   Buttons, cards, forms, badges, tables, modals
   ============================================================ */

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: 6px 12px; font-size: .8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15,76,129,.3);
}
.btn-primary:hover { background: #0D4070; box-shadow: 0 3px 8px rgba(15,76,129,.35); }
.btn-primary:active { background: #0B3560; transform: translateY(1px); }

.btn-accent {
  background: #20C7BC;
  color: #fff;
  box-shadow: 0 1px 3px rgba(31,184,166,.3);
}
.btn-accent:hover { background: #20C7BC; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-muted); }

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

.btn-danger {
  background: var(--brand-danger);
  color: #fff;
}
.btn-danger:hover { background: #C62828; }

.btn-link {
  color: var(--text-brand);
  padding: 0;
  font-weight: 500;
  font-size: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* Loading spinner in button */
.btn .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}
.card-sm { padding: var(--space-4); }
.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-default);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: .8125rem; color: var(--text-muted); margin-top: 2px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: var(--space-2); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 600; color: var(--text-primary); line-height: 1; }
.stat-card .stat-sub { font-size: .8125rem; color: var(--text-muted); margin-top: var(--space-1); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.form-label .required { color: var(--brand-danger); margin-left: 2px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: var(--space-1); }
.form-error { font-size: .75rem; color: var(--text-danger); margin-top: var(--space-1); }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: .9375rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(15,76,129,.1);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input.error, .select.error, .textarea.error {
  border-color: var(--brand-danger);
  box-shadow: 0 0 0 3px rgba(229,57,53,.1);
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235F5E5A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .input { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .btn { border-radius: 0 var(--radius-md) var(--radius-md) 0; flex-shrink: 0; }
.input-addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: .875rem;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-right: none;
}
.input-addon + .input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 40px; height: 22px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  transition: background var(--transition);
  flex-shrink: 0;
  position: relative;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked ~ .toggle-track { background: #20C7BC; }
.toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: .875rem; color: var(--text-primary); }

/* ============================================================
   Badges / Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
}
.badge-confirmed  { background: #E6F7F5; color: #0F6E63; }
.badge-pending    { background: var(--bg-warning); color: #92400E; }
.badge-cancelled  { background: var(--bg-danger);  color: #991B1B; }
.badge-completed  { background: #EDE9FE; color: #4C1D95; }
.badge-no-show    { background: #FEE2E2; color: #991B1B; }
.badge-free       { background: var(--bg-muted); color: var(--text-secondary); }
.badge-lifetime   { background: #E6F7F5; color: #0F6E63; border: 1px solid #9FE3DC; }
.badge-pro        { background: var(--bg-info); color: #1E40AF; }

/* Tag pill (customer tags) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: .75rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.tag-blue   { background: var(--bg-info); border-color: #BFDBFE; color: #1E40AF; }
.tag-green  { background: var(--bg-success); border-color: #A7F3D0; color: #065F46; }
.tag-amber  { background: var(--bg-warning); border-color: #FDE68A; color: #92400E; }
.tag-red    { background: var(--bg-danger); border-color: #FECACA; color: #991B1B; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-default);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-page); }
.table .col-actions { width: 80px; text-align: right; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
  opacity: .4;
}
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p { font-size: .875rem; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(8px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-body { padding: var(--space-6); }
.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(--border-default);
}

/* ============================================================
   Toast notifications
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  background: var(--text-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInToast .2s ease;
  max-width: 340px;
}
.toast.success { background: #065F46; }
.toast.error   { background: #991B1B; }
.toast.warning { background: #92400E; }
@keyframes slideInToast {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   Loading states
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--border-default) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.spinner-circle {
  width: 32px; height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ============================================================
   Alert / Notice
   ============================================================ */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  line-height: 1.5;
}
.alert-info    { background: var(--bg-info); color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-success { background: var(--bg-success); color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: var(--bg-warning); color: #92400E; border: 1px solid #FDE68A; }
.alert-danger  { background: var(--bg-danger); color: #991B1B; border: 1px solid #FECACA; }

/* Upgrade prompt */
.upgrade-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 14px 18px;
  background: linear-gradient(135deg, #EBF4FF 0%, #F0F9FF 100%);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
}
.upgrade-prompt-text { font-size: .875rem; color: #1E40AF; }
.upgrade-prompt-text strong { display: block; font-weight: 600; margin-bottom: 2px; }

/* ============================================================
   Divider with label
   ============================================================ */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: .8125rem;
  margin: var(--space-5) 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .6875rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
