/* Base */
:root, * {
  box-sizing: border-box;
}
:root{
  --bg: #0A0A0A;
  --surface: #141414; 
  --surface-soft: #1C1C1C;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --accent: #D4AF37; /* Classy Gold */
  --accent-gradient: linear-gradient(145deg, #ffde73, #c89b2c);
  --accent-soft: rgba(212, 175, 55, 0.15);
  --glass: rgba(21, 24, 33, 0.72);
  --border: rgba(255, 255, 255, 0.10);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-soft: 0 4px 20px -6px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 12px 28px -10px rgba(0, 0, 0, 0.35);
}


html,body{
  height: 100%;
  width: 100%;
  overscroll-behavior: none;
  position: fixed; /* Фиксирует вьюпорт, предотвращая любой скролл или люфт */
}

body{
  margin:0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  padding:0;
  font-size: 12px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(161, 127, 75, 0.18);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Russo One', sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

/* Smooth momentum scrolling wherever content actually scrolls (iOS Safari
   needs this explicitly - it doesn't inherit from a parent). */
.content, .schedule-container, .planner-container, #clients-list-container,
.kiosk-profile-box, .kiosk-finance-box, .modal-box, .recent-scans-list {
  -webkit-overflow-scrolling: touch;
}

.page{height: 100%; width: 100%; display:flex; align-items:center; justify-content:center; overflow: hidden;}

.hero {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg);
  z-index: 1;
}


body.is-logged-in .hero {
  background: var(--bg) !important;
}



.hero.is-blurred {
  filter: blur(28px);
  transition: filter 0.8s ease;
}


.loader{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 1000;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap: 28px;
  padding: 20px;
  overflow: hidden;
}

/* Ambient aurora glow drifting behind the emblem */
.loader-aurora{
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.loader-aurora__blob{
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.16), transparent 65%);
  filter: blur(10px);
  opacity: 0.5;
}
.loader-aurora__blob--1{ top: -22%; left: -18%; }
.loader-aurora__blob--2{
  bottom: -25%;
  right: -18%;
  background: radial-gradient(circle, rgba(255, 222, 115, 0.14), transparent 65%);
  animation-delay: -6s;
}
body.is-loading .loader-aurora__blob{ animation: auroraDrift 12s ease-in-out infinite; }

@keyframes auroraDrift{
  0%   { transform: translate3d(0,0,0) scale(1); opacity: 0.45; }
  50%  { transform: translate3d(4%, 3%, 0) scale(1.12); opacity: 0.85; }
  100% { transform: translate3d(0,0,0) scale(1); opacity: 0.45; }
}

/* Logo with a soft breathing halo behind it */
.loader-emblem{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-halo{
  position: absolute;
  width: 300px;
  height: 150px;
  background: radial-gradient(ellipse, rgba(212, 175, 55, 0.35), transparent 70%);
  filter: blur(22px);
  opacity: 0.5;
}
body.is-loading .loader-halo{ animation: haloPulse 2.6s ease-in-out infinite; }

@keyframes haloPulse{
  0%, 100% { opacity: 0.32; transform: scale(0.94); }
  50% { opacity: 0.75; transform: scale(1.06); }
}

.loader-logo{
  position: relative;
  width: clamp(150px, 42vw, 210px);
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(212, 175, 55, 0.25));
}
body.is-loading .loader-logo{ animation: logoBreathe 2.6s ease-in-out infinite; }

@keyframes logoBreathe{
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

body.light-theme .loader-logo{ filter: invert(1) drop-shadow(0 6px 14px rgba(0,0,0,0.12)); }
body.light-theme .top-bar__logo{ filter: invert(1); }
body.light-theme .kiosk-logo{ filter: invert(1); }

.loader__text{
  position: relative;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 1px;
  text-align:center;
  color: var(--fg);
  max-width: 320px;
}

.loader__text span {
  background: linear-gradient(100deg, var(--accent) 30%, #ffe9a8 50%, var(--accent) 70%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.is-loading .loader__text span{ animation: textShimmer 2.4s ease-in-out infinite; }

@keyframes textShimmer{
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Slim indeterminate progress line */
.loader-progress{
  position: relative;
  z-index: 1;
  width: 160px;
  height: 3px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}
.loader-progress__fill{
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
body.is-loading .loader-progress__fill{ animation: progressSlide 1.6s ease-in-out infinite; }

@keyframes progressSlide{
  0%   { left: -40%; }
  100% { left: 100%; }
}

@keyframes textReveal {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes loaderFade {
  from { opacity: 1; filter: blur(0); transform: scale(1); }
  to { opacity: 0; filter: blur(14px); transform: scale(1.04); visibility: hidden; }
}

@keyframes sectionFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.is-loading .loader-emblem{ animation: textReveal 900ms ease-out both; }
body.is-loading .loader__text{ animation: textReveal 900ms ease-out 150ms both; }
body.is-loading .loader-progress{ animation: textReveal 900ms ease-out 260ms both; }

body.is-ready .loader{
  animation: loaderFade 650ms cubic-bezier(0.4,0,0.2,1) forwards;
}

/* Content placeholder */
.content{
  display: none;
  opacity: 0; 
  width: 100%;
  max-width: 400px;
  z-index: 10;
  pointer-events: all;
  position: relative;
  height: 100%; /* Use full viewport height */
  padding: calc(74px + 20px) 20px calc(78px + 20px) 20px; /* Account for bars + content padding */
  overflow-y: auto;
  align-items: center;
  justify-content: flex-start;
  scrollbar-width: none;
}

body.is-ready .content{
  display: flex;
  flex-direction: column;
  /* Two separate animations: opacity keeps fill-mode forwards (needed since
     .content starts at opacity:0), but the transform half deliberately does
     NOT use forwards. A transform lingering via forwards - even one that
     resolves to an identity matrix - keeps this element registered as the
     containing block for any `position: fixed` descendant, which mispositions
     any FAB rendered inside #gym-content. Letting the transform animation end
     normally drops back to the un-animated (transform: none) state instead. */
  animation: contentFadeIn 800ms ease forwards, contentRise 800ms ease;
}

/* Top Bar & Streak */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 74px;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 2100;
  border-bottom: 1px solid var(--border);
}

.top-bar__logo {
  height: 42px;
  width: auto;
}

.top-bar__right-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trophy-btn {
  background: linear-gradient(145deg, rgba(255, 215, 0, 0.16), rgba(255, 215, 0, 0.05));
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: #FFD700;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.trophy-btn svg { width: 21px; height: 21px; }
.trophy-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .trophy-btn:hover {
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.14);
  }
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 8px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  color: var(--accent);
  box-shadow: none;
}

.streak-icon {
  width: 18px;
  height: 18px;
  fill: var(--accent);
}

.streak-count { font-size: 12px; font-weight: 700; }
.streak-label { font-size: 10px; letter-spacing: 0.5px; opacity: 0.7; font-weight: 600; }

.streak-info-btn {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  margin-left: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.streak-info-btn:hover { opacity: 1; }
.streak-info-btn svg { width: 16px; height: 16px; }

/* Admin Status Badge - same "notification" family as .custom-toast, so it
   slides in from the right in the same spot rather than dropping from the
   top-center like it used to. */
.admin-status-banner {
  position: fixed;
  top: 90px;
  right: 20px;
  left: auto;
  transform: translateX(130%);
  background: var(--accent-gradient);
  color: #111;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  z-index: 9999;
  opacity: 0;
  box-shadow: 0 14px 38px rgba(17, 24, 39, 0.1);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.5s ease;
}
.admin-status-banner.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Auth UI Styles */
.auth-container {
  width: 100%; 
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  text-align: center;
  box-shadow: none;
}

.auth-header h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--fg);
}

.auth-header p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 25px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.input-group {
  position: relative;
}

.password-toggle {
  position: absolute;
  height: 34px;
  width: 34px;
  border-radius: 12px;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  transition: color 0.3s;
}

.password-toggle.is-visible {
  color: var(--accent);
}

.input-group input {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  font-family: system-ui, sans-serif;
  font-weight: 500; /* Balanced against Russo One */
  box-sizing: border-box;
  outline: none;
  touch-action: auto;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2) inset;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 1px 2px rgba(0,0,0,0.2) inset;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #000;
  border: none;
  padding: 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  box-shadow: 0 4px 15px -5px rgba(212, 175, 55, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px -5px rgba(212, 175, 55, 0.3);
}

/* Only devices with a real pointer (mouse/trackpad) get hover feedback -
   `hover: hover` keeps this from sticking on touchscreens after a tap. */
@media (hover: hover) {
  .btn-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -8px rgba(212, 175, 55, 0.45);
  }
  .btn-link:hover {
    opacity: 0.8;
  }
}

.auth-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s var(--ease);
}

/* Button Spinner */
.btn-primary .btn-spinner {
  border: 3px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes contentFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes contentRise {
  from { transform: scale(0.98) translateY(10px); }
  to { transform: scale(1) translateY(0); }
}
