/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  gap: 0.5rem;
}

.btn:focus-visible {
  outline: 2px solid var(--studio-brand);
  outline-offset: 2px;
}

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

.btn-primary {
  background-color: var(--studio-brand);
  color: var(--text-inverse);
  text-transform: uppercase;

}

.btn-primary:hover {
  background-color: var(--studio-brand-hover);
  color: var(--text-inverse);
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--surface);
  border-color: var(--border-dark);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background-color: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-inverse);
}

.btn-danger:hover {
  background-color: #DC2626;
  color: var(--text-inverse);
  text-decoration: none;
}

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

.btn-ghost:hover {
  background-color: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

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

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-dark);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

/* ─── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-dark);
  background-color: var(--surface);
  color: var(--text);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--studio-brand);
  box-shadow: 0 0 0 3px rgba(var(--studio-brand-rgb), 0.15);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-control:disabled {
  background-color: var(--surface-2);
  color: var(--text-light);
  cursor: not-allowed;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.form-check-input {
  margin-top: 0.25rem;
  cursor: pointer;
  accent-color: var(--studio-brand);
}

/* ─── Modals ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background-color: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background-color: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
}

.toast {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 300px;
  max-width: 400px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(0);
}

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

.toast-error {
  border-left-color: var(--danger);
}

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

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

.toast-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.toast-body {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

/* ─── Badges / Chips ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
}

.badge-default {
  background-color: var(--surface-2);
  color: var(--text-muted);
}

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

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

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

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

.badge-primary {
  background-color: var(--primary-light);
  color: var(--studio-brand);
}

/* ─── Data Tables ──────────────────────────────────────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 1.5rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.table th {
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

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

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
  background-color: var(--surface-2);
}

/* ─── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background-color: var(--primary-light);
  color: var(--studio-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info {
  flex-grow: 1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ─── Loading Spinner ──────────────────────────────────────── */
.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 4px solid var(--surface-2);
  border-top-color: var(--studio-brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ─── Alert Boxes ──────────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.alert-success {
  background-color: var(--success-light);
  border-color: #A7F3D0;
  color: #065F46;
}

.alert-danger {
  background-color: var(--danger-light);
  border-color: #FCA5A5;
  color: #991B1B;
}

.alert-warning {
  background-color: var(--warning-light);
  border-color: #FDE68A;
  color: #92400E;
}

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
}

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-link {
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-link:hover {
  color: var(--text);
  text-decoration: none;
}

.tab-link.active {
  color: var(--studio-brand);
  border-bottom-color: var(--studio-brand);
}

/* ─── Premium Credit Card Checkout Modal ────────────────────── */
.credit-card-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-summary-box {
  background-color: var(--surface-2);
  padding: 1rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.card-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.card-logo-overlay {
  position: absolute;
  right: 12px;
  height: 24px;
  width: 38px;
  pointer-events: none;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: var(--transition);
  opacity: 0.4;
}

.card-logo-overlay.visa {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%231A1F71" d="M14 8.877L16.273 15h-1.897L13.1 9.4H14zm-4.722.523L8.03 14.8c-.144.477-.73.477-.822.477H3.9L3.8 15h3.42l1.62-5.6h1.538zm7.986-.523h1.493L20 15h-1.42l-.24-.95h-1.6l-.16.95h-1.39l1.076-6.123zm-7.7 0H8.388L6.877 15h1.428l1.259-6.123z"/></svg>');
  opacity: 1;
}

.card-logo-overlay.mastercard {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="8" cy="12" r="6" fill="%23EB001B" opacity="0.8"/><circle cx="16" cy="12" r="6" fill="%23F79E1B" opacity="0.8"/><path d="M12 17.2a5.95 5.95 0 0 0 2-4.2a5.95 5.95 0 0 0-2-4.2a5.95 5.95 0 0 0-2 4.2a5.95 5.95 0 0 0 2 4.2z" fill="%23FF5F00"/></svg>');
  opacity: 1;
}

/* ─── Visual Space Picker Grid ──────────────────────────────── */
.space-picker-container {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.stage-indicator {
  width: 100%;
  max-width: 480px;
  background: var(--surface-2);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.space-grid-wrapper {
  overflow-x: auto;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0.5rem;
}

.space-grid {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.space-cell {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
  user-select: none;
  border: 1px solid transparent;
}

.space-cell-available {
  background-color: var(--surface);
  border-color: var(--border-dark);
  color: var(--text);
  cursor: pointer;
}

.space-cell-available:hover {
  transform: scale(1.08);
  border-color: var(--studio-brand);
  box-shadow: var(--shadow-sm);
}

.space-cell-blocked {
  background-color: transparent;
  color: transparent;
  pointer-events: none;
}

.space-cell-booked {
  background-color: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
  cursor: not-allowed;
  position: relative;
}

.space-cell-booked::after {
  content: "✖";
  font-size: 0.625rem;
  position: absolute;
  top: 2px;
  right: 4px;
}

.space-cell-held {
  background-color: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
  cursor: not-allowed;
  animation: pulseHeld 1.5s infinite;
}

.space-cell-held-by-me {
  background-color: var(--studio-brand);
  border-color: var(--studio-brand);
  color: var(--text-inverse);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
  /* brand default color fallback */
  animation: pulseHeldMe 1.5s infinite;
}

.space-legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-dark);
}

@keyframes pulseHeld {
  0% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.7;
  }
}

@keyframes pulseHeldMe {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}