/* ========================================================================
   Famly - Liquid Glass komponenty (glassmorphism)
   ======================================================================== */

/* === Base glass surface === */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  pointer-events: none;
}

[data-theme="light"] .glass::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
}

.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(60px) saturate(200%);
  -webkit-backdrop-filter: blur(60px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
}

.glass-soft {
  background: var(--glass-bg-soft);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
}

@supports not (backdrop-filter: blur(20px)) {
  .glass, .glass-strong, .glass-soft {
    background: var(--bg-elevated);
  }
}

/* === Glass card === */

.card {
  background:
    radial-gradient(130% 80% at 50% -10%, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0) 55%),
    var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-2xl);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform var(--t-base) var(--ease-spring), box-shadow var(--t-base) var(--ease-out);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  pointer-events: none;
}

.card.interactive { cursor: pointer; }
.card.interactive:hover { box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255,255,255,0.07); }
.card.interactive:active { transform: scale(0.985); }

.card.card-accent {
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 50%),
    var(--section-grad);
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-lg), 0 0 40px var(--section-glow), inset 0 1px 0 rgba(255,255,255,0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.card-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.card-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient-soft);
  color: var(--brand-primary-light);
}

/* === Glass nav (bottom tab bar) === */

.bottom-nav {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(60px) saturate(200%);
  -webkit-backdrop-filter: blur(60px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-xl);
}

.bottom-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  pointer-events: none;
}

/* === Modal (sklenena spodni "sheet") === */

.modal-sheet {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(80px) saturate(200%);
  -webkit-backdrop-filter: blur(80px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow-xl);
}

/* === Toast - skleneny === */

.toast {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border-strong);
}

/* === Sticky header s glass blurem (pri scrollu) === */

.app-header.scrolled {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
}

/* === Glass input === */

.glass-input {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
}

/* === Profile picker === */

.profile-picker {
  display: flex;
  gap: var(--sp-4);
  justify-content: center;
  padding: var(--sp-6) 0;
}

.profile-card {
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-2xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-spring), border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
  min-width: 130px;
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  pointer-events: none;
}

.profile-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.profile-card:active { transform: scale(0.96); }

.profile-card.selected {
  border-color: var(--brand-primary);
  background: var(--brand-gradient-soft);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.profile-card .avatar {
  width: 72px;
  height: 72px;
  font-size: var(--fs-xl);
}

.profile-card .profile-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
}

/* === Donut chart wrapper === */

.donut-chart {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}

.donut-label {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* === Stats row === */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--glass-bg-soft);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2);
}

.stat-value {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-align: center;
}

/* === Macro ring === */

.macro-rings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.macro-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.macro-ring .macro-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.macro-ring .macro-value {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}

/* === Floating glass overlay === */

.glass-popover {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(60px) saturate(200%);
  -webkit-backdrop-filter: blur(60px) saturate(200%);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
  box-shadow: var(--shadow-lg);
  position: absolute;
  z-index: var(--z-modal);
  min-width: 180px;
}

.glass-popover .menu-item {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out);
}

.glass-popover .menu-item:hover { background: var(--state-hover); }
.glass-popover .menu-item.danger { color: var(--color-danger); }