/* Reusable UI components — Light Happy Theme */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-glass {
  background: var(--bg-glass);
  border: 1px solid rgba(14, 165, 233, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card-pad {
  padding: var(--space-7);
}

.card-stat {
  position: relative;
  overflow: hidden;
}
.card-stat::before {
  content: '';
  position: absolute;
  inset: 0;
  border-left: 3px solid var(--accent);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.6;
}

.card-hover {
  transition: var(--transition);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border-color: rgba(14, 165, 233, 0.25);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
  font-weight: 500;
}
.btn:hover {
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: var(--shadow-card);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(14, 165, 233, 0.2);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  border-color: rgba(14, 165, 233, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  border-color: #dc2626;
  color: #fff;
  font-weight: 700;
}
.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

.btn--loading {
  pointer-events: none;
  opacity: 0.8;
}

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

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
}

/* Form fields */
.field {
  display: grid;
  gap: 0.4rem;
}
.label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}
.textarea {
  min-height: 110px;
  resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--bg-surface);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input-group {
  position: relative;
}
.input-suffix {
  position: absolute;
  inset-inline-end: 0.65rem;
  inset-block: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.input-prefix {
  position: absolute;
  inset-inline-start: 0.75rem;
  inset-block: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  pointer-events: none;
}
.input.with-prefix {
  padding-inline-start: 2.65rem;
}
.input.with-suffix {
  padding-inline-end: 2.65rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-raised);
}
.badge-green {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
}
.badge-amber {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: #b45309;
}
.badge-red {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
.badge-blue {
  border-color: rgba(14, 165, 233, 0.3);
  background: rgba(14, 165, 233, 0.08);
  color: #0284c7;
}

.badge-dark-blue {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
  color: #003953;
}

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

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.table th,
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table th {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-raised);
}
.table tr:last-child td {
  border-bottom: none;
}
.table tr:hover td {
  background: var(--bg-raised);
}
.table td .actions {
  display: inline-flex;
  gap: 0.35rem;
}

/* Chips */
.chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.88rem;
}
.chip.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Pills */
.pill-group {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pill.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

/* Toasts */
.toasts {
  position: fixed;
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  display: grid;
  gap: 0.6rem;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 2rem));
}
.toast {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  transform: translateX(10px);
  opacity: 0;
  transition: var(--transition);
}
.toast.is-in {
  transform: translateX(0);
  opacity: 1;
}
.toast .title {
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.toast .msg {
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.toast.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: #f0fdf4;
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.35);
  background: #fff5f5;
}
.toast .x {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 8px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9998;
  opacity: 0;
  transition: var(--transition);
}
.modal-backdrop.is-in {
  opacity: 1;
}
.modal {
  width: min(560px, calc(100vw - 2rem));
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: translateY(10px);
  opacity: 0;
  transition: var(--transition);
}
.modal-backdrop.is-in .modal {
  transform: translateY(0);
  opacity: 1;
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal header h3 {
  font-size: 1.05rem;
}
.modal .body {
  padding: 1.1rem;
  color: var(--text-secondary);
}
.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

/* Skeleton */
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    #e2e8f0 0%,
    #f1f5f9 20%,
    #e2e8f0 40%,
    #e2e8f0 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1400ms ease-in-out infinite;
}
.skeleton-text {
  height: 14px;
  width: 100%;
}
.skeleton-card {
  height: 140px;
}

/* Empty state */
.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  border: 1.5px dashed rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-xl);
  background: var(--accent-soft);
  font-size: 1.5rem;
}
.empty-illus {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  border: 1.5px solid rgba(14, 165, 233, 0.25);
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(14, 165, 233, 0.15),
      transparent 55%
    ),
    var(--bg-surface);
  box-shadow: var(--shadow-glow);
  position: relative;
  margin-bottom: 1rem;
  display: grid;
  place-items: center;
  font-size: 2rem;
}

/* Tooltip */
.tooltip {
  position: absolute;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--text-primary);
  color: #fff;
  font-size: 0.8rem;
  transform: translateY(-8px);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
  white-space: nowrap;
}
.tooltip.is-in {
  opacity: 1;
  transform: translateY(-12px);
}

/* Inline error */
.inline-error {
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ═══════════════════════════════════════════════════════
   SHARED LAYOUT UTILITIES
   Used across multiple pages — defined here so every page
   gets them regardless of which page CSS is loaded.
   ═══════════════════════════════════════════════════════ */

/* ── Section ──────────────────────────────────────────────*/
.section {
  margin-top: 1.5rem;
  width: 100%;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.section-head h3 {
  font-size: 2rem;
  font-weight: 700;
}

/* ── Table wrap ───────────────────────────────────────────*/
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

/* ── Login-actions / stacked button group ─────────────────*/
/* Used in new booking form, login page, profile forms */
.login-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ── Stat value (large number) ────────────────────────────*/
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 2.2vw, 2.1rem);
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-top: 0.15rem;
  line-height: 1;
}

/* ── FAB (Floating Action Button) ─────────────────────────*/
.fab {
  position: fixed;
  inset-inline-end: 1.5rem;
  inset-block-end: 1.5rem;
  z-index: 40;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  gap: 0.5rem;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
@media (max-width: 480px) {
  .fab span {
    display: none;
  }
  .fab {
    padding: 1rem;
    border-radius: 50%;
  }
}

/* ── Actions row (inline button group in table cells) ─────*/
.actions {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* ── Pagination ───────────────────────────────────────────*/
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pager {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
}
.pager:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.pager.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.pager:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.pager svg,
.pager i {
  width: 14px;
  height: 14px;
}

/* ── Chip / filter tabs ───────────────────────────────────*/
.chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip:hover {
  color: var(--accent);
  border-color: rgba(14, 165, 233, 0.3);
  background: var(--accent-soft);
}
.chip.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ── Toolbar (search + filters bar above tables) ──────────*/
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
