/* ============================================================
   glass.css — GymBI by Statvo
   PURPOSE: Liquid glass component library — cards, modals,
   buttons, inputs, badges, toasts. Apple visionOS / iOS 26
   inspired frosted glass aesthetic.
   ============================================================ */

/* ------------------------------------------------------------
   GLASS CARD
   Base frosted glass surface. Used for all content panels,
   KPI cards, member cards, etc.
   ------------------------------------------------------------ */
.card {
  background: var(--glass-2);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-inset);
  padding: var(--sp-6);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

/* Subtle inner highlight at top edge — gives 3D lift */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}

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

/* Smaller compact card variant */
.card-sm {
  padding: var(--sp-4);
  border-radius: var(--radius-md);
}

/* Card with accent glow border — for active/featured items */
.card-accent {
  border-color: rgba(0, 200, 150, 0.3);
  box-shadow: var(--shadow-md), var(--shadow-inset), 0 0 0 1px rgba(0, 200, 150, 0.1);
}

/* Card header section */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--glass-border);
}

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

/* ------------------------------------------------------------
   BUTTONS
   Three variants: primary (accent fill), ghost (transparent),
   danger (red fill). All pill-shaped by default.
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on button hover */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}
.btn:hover::after { transform: translateX(100%); }

/* Primary — accent color fill */
.btn-primary {
  background: var(--accent);
  color: #000;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, white);
  box-shadow: 0 6px 30px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Ghost — transparent with border */
.btn-ghost {
  background: var(--glass-1);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-border-bright);
  color: var(--text-primary);
}
.btn-ghost:hover {
  background: var(--glass-2);
  border-color: rgba(255,255,255,0.2);
}

/* Danger — red fill */
.btn-danger {
  background: rgba(255, 77, 109, 0.15);
  border: 1px solid rgba(255, 77, 109, 0.3);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(255, 77, 109, 0.25);
}

/* Icon-only button (square) */
.btn-icon {
  padding: var(--sp-3);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
}

/* Small button variant */
.btn-sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
}

/* Full-width button */
.btn-block { width: 100%; }

/* Disabled state */
.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner inside button */
.btn.loading .btn-text { opacity: 0; }
.btn.loading::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ------------------------------------------------------------
   FORM INPUTS
   Glass-style input fields, labels, and select dropdowns.
   ------------------------------------------------------------ */

/* Input wrapper — stacks label above input */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.input-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* The actual input field */
.input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--glass-1);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Textarea variant */
.input-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* Select dropdown */
.input-select {
  appearance: none;
  -webkit-appearance: none;
  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='%238A97B0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
  cursor: pointer;
}

/* Input with icon on left */
.input-with-icon {
  position: relative;
}
.input-with-icon .input { padding-left: var(--sp-10); }
.input-with-icon .input-icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Error state */
.input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.15);
}
.input-error-msg {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: 2px;
}

/* ------------------------------------------------------------
   MODAL / BOTTOM SHEET
   Full-screen overlay with glass panel. On desktop = centered
   dialog. On mobile = slides up from bottom.
   ------------------------------------------------------------ */

/* Dark overlay behind modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: var(--blur-sm);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* The modal panel */
.modal {
  background: var(--glass-3);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition-base);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--glass-3);
  backdrop-filter: var(--blur-lg);
  z-index: 1;
}

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

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--glass-2); color: var(--text-primary); }

.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* Mobile: bottom sheet slide-up */
@media (max-width: 640px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
}

/* ------------------------------------------------------------
   BADGES / STATUS PILLS
   Small colored labels for member status, plan types, etc.
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Dot indicator before badge text */
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.badge-active {
  background: rgba(0, 200, 150, 0.15);
  color: var(--status-active);
  border: 1px solid rgba(0, 200, 150, 0.25);
}
.badge-expired {
  background: rgba(255, 77, 109, 0.12);
  color: var(--status-expired);
  border: 1px solid rgba(255, 77, 109, 0.2);
}
.badge-paused {
  background: rgba(255, 179, 71, 0.12);
  color: var(--status-paused);
  border: 1px solid rgba(255, 179, 71, 0.2);
}
.badge-info {
  background: rgba(77, 166, 255, 0.12);
  color: var(--status-info);
  border: 1px solid rgba(77, 166, 255, 0.2);
}
.badge-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}

/* ------------------------------------------------------------
   TOASTS / NOTIFICATIONS
   Slide in from top-right. Auto-dismiss after 3–4s.
   ------------------------------------------------------------ */
#toast-container {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--glass-3);
  backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: toast-in 0.3s ease forwards;
}

.toast.removing { animation: toast-out 0.25s ease forwards; }

.toast-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { background: rgba(0,200,150,0.2); color: var(--success); }

.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { background: rgba(255,77,109,0.2); color: var(--danger); }

.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { background: rgba(77,166,255,0.2); color: var(--info); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { background: rgba(255,179,71,0.2); color: var(--warning); }

/* Toast dismiss button */
.toast-dismiss {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
}
.toast-dismiss:hover { color: var(--text-primary); }

/* ------------------------------------------------------------
   AVATAR / MEMBER PHOTO
   Circle photo or initials fallback.
   ------------------------------------------------------------ */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-3);
  border: 2px solid var(--glass-border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: var(--text-md); }
.avatar-xl { width: 88px; height: 88px; font-size: var(--text-xl); }

/* Accent ring on avatar for active members */
.avatar-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ------------------------------------------------------------
   SEARCH BAR
   Used in member list, payment lookup, etc.
   ------------------------------------------------------------ */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  transition: border-color var(--transition-fast);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-bar input {
  flex: 1;
  font-size: var(--text-base);
}
.search-bar .search-icon { color: var(--text-muted); }

/* ------------------------------------------------------------
   TABS
   Horizontal pill tabs for switching views/filters.
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-1);
  background: var(--glass-1);
  border-radius: var(--radius-full);
  width: fit-content;
}

.tab {
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  background: var(--glass-3);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------
   EMPTY STATE
   Shown when a list has no items.
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}
.empty-state-icon {
  font-size: 48px;
  opacity: 0.3;
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
}
.empty-state-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 280px;
}

/* ------------------------------------------------------------
   LOADING STATES
   Skeleton shimmer and full-page spinner.
   ------------------------------------------------------------ */

/* Skeleton loading block */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* Full screen loading overlay (used during auth check) */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  z-index: var(--z-top);
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ------------------------------------------------------------
   DIVIDER WITH LABEL
   e.g. "— OR —" between sections
   ------------------------------------------------------------ */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ------------------------------------------------------------
   KEYFRAME ANIMATIONS
   ------------------------------------------------------------ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Apply fade-in to content panels when they appear */
.panel-enter { animation: fade-in 0.25s ease forwards; }
