/* gyk.dk Component Styles
   Matches docs/design-system.md section 7+ */

/* ---- Top App Bar ---- */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(247, 249, 251, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

[data-theme="dark"] .app-header {
  background: rgba(18, 20, 22, 0.8);
}

.app-header__brand {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--primary);
  text-decoration: none;
}

.app-header__brand:hover {
  opacity: 1;
}

.app-header__nav {
  display: none;
  align-items: center;
  gap: 32px;
}

@media (min-width: 768px) {
  .app-header__nav {
    display: flex;
  }
}

.app-header__nav-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--outline-variant);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.app-header__nav-link:hover,
.app-header__nav-link--active {
  color: var(--primary);
  opacity: 1;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-primary-container);
  font-size: 14px;
  font-weight: 600;
}

/* ---- Header Icon Buttons (theme, language) ---- */

.app-header__icon-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.app-header__icon-btn:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.app-header__icon-btn .material-symbols-outlined {
  font-size: 20px;
}

.app-header__lang-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Language dropdown */
.app-header__lang-menu {
  position: relative;
}

.app-header__lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  flex-direction: column;
}

.app-header__lang-dropdown.is-open {
  display: flex;
}

.app-header__lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--on-surface);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition-fast);
}

.app-header__lang-option:hover {
  background: var(--surface-container-low);
}

.app-header__lang-option--active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
}

/* Dashboard link in header actions — hidden on mobile, shown on desktop */
.app-header__dashboard-link {
  display: none;
}

@media (min-width: 768px) {
  .app-header__dashboard-link {
    display: inline;
  }
}

/* User avatar dropdown menu */
.app-header__user-menu {
  position: relative;
}

.app-header__avatar {
  cursor: pointer;
  border: none;
  background: var(--primary-container);
}

.app-header__user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  flex-direction: column;
}

.app-header__user-dropdown.is-open {
  display: flex;
}

.app-header__user-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--on-surface);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.app-header__user-option:hover {
  background: var(--surface-container-low);
}

.app-header__user-option--danger {
  color: var(--error);
}

.app-header__user-option--danger:hover {
  background: rgba(186, 26, 26, 0.08);
}

.app-header__user-divider {
  border: none;
  border-top: 1px solid rgba(169, 180, 185, 0.2);
  margin: 4px 8px;
}

.app-header__logout-form {
  display: contents;
}

/* Hide lang/theme on very small screens if needed */
@media (max-width: 360px) {
  .app-header__lang-code {
    display: none;
  }
}

/* ---- Bottom Navigation ---- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-bottom-nav);
}

[data-theme="dark"] .bottom-nav {
  background: rgba(26, 28, 30, 0.9);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--outline-variant);
  transition:
    color var(--transition-fast),
    transform var(--transition-fast);
}

.bottom-nav__item--active {
  color: var(--primary);
  transform: scale(1.1);
}

.bottom-nav__item--active .material-symbols-outlined {
  font-variation-settings:
    "FILL" 1,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}

.bottom-nav__label {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Header CTA & Sign-In (desktop only) ---- */

.app-header__sign-in {
  display: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.app-header__sign-in:hover {
  color: var(--primary);
  opacity: 1;
}

.app-header__cta {
  display: none;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-xl);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.app-header__cta:hover {
  opacity: 0.9;
}

@media (min-width: 768px) {
  .app-header__sign-in {
    display: inline-block;
  }
  .app-header__cta {
    display: inline-block;
  }
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  /* A button label must never wrap to a second line. English fits on one line;
     Danish and Ukrainian labels are longer ("Create Short Link" ->
     "Створити коротке посилання") and were wrapping inside full-width CTAs.
     Keeping them on one line is the design intent in every language. */
  white-space: nowrap;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.btn:active {
  transform: scale(0.95);
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-xl);
}

.btn--primary:hover {
  opacity: 0.9;
}

.btn--outlined {
  background: var(--surface-container-lowest);
  color: var(--primary);
  border: var(--ghost-border);
  border-radius: var(--radius-xl);
}

.btn--outlined:hover {
  background: var(--surface-container-low);
}

.btn--outlined-strong {
  background: var(--surface-container-lowest);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius-xl);
}

.btn--outlined-strong:hover {
  background: var(--primary);
  color: var(--on-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--primary);
  border-radius: var(--radius-xl);
}

.btn--ghost:hover {
  opacity: 0.8;
}

.btn--cta {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  border-radius: var(--radius-xl);
}

.btn--cta:hover {
  opacity: 0.9;
}

.btn--destructive {
  background: transparent;
  color: var(--error);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-xl);
}

.btn--destructive:hover {
  opacity: 0.8;
}

.btn--sm {
  padding: 8px 16px;
  font-size: 12px;
}
.btn--md {
  padding: 12px 24px;
  font-size: 14px;
}
.btn--lg {
  padding: 16px 32px;
  font-size: 16px;
}
.btn--full {
  width: 100%;
}

/* ---- Inputs ---- */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group__label {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--outline);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--outline);
  pointer-events: none;
}

.input-field {
  width: 100%;
  background: var(--surface-container-lowest);
  border: var(--ghost-border);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition:
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.input-field:focus-visible {
  box-shadow: 0 0 0 2px var(--tertiary);
  outline: none;
}

.input-field::placeholder {
  color: var(--outline-variant);
}

.input-field--with-icon {
  padding-left: 44px;
}

.input-field--ghost-border {
  border: var(--ghost-border);
}

.select-field {
  width: 100%;
  background: var(--surface-container-lowest);
  border: var(--ghost-border);
  border-radius: var(--radius-xl);
  padding: 12px 16px;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  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 fill='%23717c82' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

.select-field:focus-visible {
  box-shadow: 0 0 0 2px var(--tertiary);
}

[data-theme="dark"] .select-field {
  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 fill='%23899499' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .select-field {
    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 fill='%23899499' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
  }
}

/* ---- Cards ---- */

.card {
  border-radius: var(--radius-xl);
}

.card--standard {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.card--bento {
  background: var(--surface-container-low);
  border-radius: var(--radius-3xl);
  padding: 40px;
}

.card--link-item {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: 16px;
  border: 1px solid rgba(169, 180, 185, 0.05);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow var(--transition-normal);
}

.card--link-item:hover {
  box-shadow: var(--shadow-card);
}

.card--glass {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

[data-theme="dark"] .card--glass {
  background: rgba(30, 33, 36, 0.7);
}

/* ---- Badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--active {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  border-radius: var(--radius-md);
  font-size: 10px;
  padding: 2px 8px;
}

.badge--expired {
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
  border-radius: var(--radius-md);
  font-size: 10px;
  padding: 2px 8px;
}

.badge--popular {
  background: var(--tertiary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 4px 12px;
}

.badge--plan {
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  border-radius: var(--radius-xl);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  border: 1px solid rgba(169, 180, 185, 0.1);
}

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--secondary);
  flex-shrink: 0;
}

/* ---- KPI Cards ---- */

.kpi-card {
  background: var(--surface-container-lowest);
  padding: 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(169, 180, 185, 0.1);
}

.kpi-card__label {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--outline);
  margin-bottom: 4px;
}

.kpi-card__value {
  font-family: var(--font-headline);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.kpi-card__trend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.kpi-card__trend--up {
  color: var(--secondary);
}
.kpi-card__trend--down {
  color: var(--error);
}

/* ---- Link Item (reusable for dashboard + manage links) ---- */

.link-item {
  background: var(--surface-container-lowest);
  padding: 16px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(169, 180, 185, 0.05);
  box-shadow: var(--shadow-subtle);
  transition: box-shadow var(--transition-normal);
  text-decoration: none;
  color: inherit;
}

.link-item:hover {
  box-shadow: var(--shadow-card);
}

.link-item__info {
  min-width: 0;
  flex: 1;
}

.link-item__short-url {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 2px;
}

.link-item__destination {
  font-size: 12px;
  color: var(--outline);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

@media (min-width: 640px) {
  .link-item__destination {
    max-width: 300px;
  }
}

.link-item__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.link-item__stat {
  text-align: right;
}

.link-item__stat-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}

.link-item__stat-label {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--outline);
}

.link-item__qr-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: var(--surface-container-low);
  color: var(--primary-dim);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.link-item__qr-btn:hover {
  background: var(--primary);
  color: var(--on-primary);
}

.link-item__link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.link-item__btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 12px;
}

.link-item__icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--on-surface-variant);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.link-item__icon-btn:hover {
  background: var(--surface-container-high);
  color: var(--primary);
  opacity: 1;
}

/* ---- Footer ---- */

.site-footer {
  background: var(--surface-container-low);
  padding: 80px 24px;
}

.site-footer__inner {
  max-width: 1152px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

@media (min-width: 768px) {
  .site-footer__inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.site-footer__brand {
  max-width: 280px;
}

.site-footer__brand-mark {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--primary);
  text-decoration: none;
  display: block;
  margin-bottom: 12px;
}

.site-footer__tagline {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.6;
}

.site-footer__links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px;
}

@media (min-width: 768px) {
  .site-footer__links {
    grid-template-columns: repeat(3, 1fr);
  }
}

.site-footer__col-title {
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface);
  margin-bottom: 16px;
}

.site-footer__col-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer__link {
  font-size: 14px;
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-footer__link:hover {
  color: var(--primary);
  opacity: 1;
}

.site-footer__bottom {
  border-top: 1px solid rgba(169, 180, 185, 0.1);
  padding-top: 32px;
  margin-top: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--outline);
  max-width: 1152px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Cookie Consent Banner ---- */

.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface-container-lowest);
  border-top: 1px solid rgba(169, 180, 185, 0.2);
  box-shadow: 0 -4px 24px rgba(42, 52, 57, 0.08);
  padding: 16px;
  animation: cookie-slide-up 0.3s ease-out;
}

@keyframes cookie-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.cookie-consent__inner {
  max-width: 1152px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cookie-consent__text p {
  font-size: 0.875rem;
  color: var(--on-surface);
  line-height: 1.5;
  margin: 0;
}

.cookie-consent__link {
  font-size: 0.8125rem;
  color: var(--secondary);
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.cookie-consent__link:hover {
  text-decoration: underline;
}

.cookie-consent__actions {
  display: flex;
  gap: 8px;
}

.cookie-consent__btn {
  padding: 8px 20px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition:
    background 0.15s,
    opacity 0.15s;
}

.cookie-consent__btn--accept {
  background: var(--secondary);
  color: var(--on-secondary);
}

.cookie-consent__btn--accept:hover {
  opacity: 0.9;
}

.cookie-consent__btn--reject {
  background: var(--surface-container-high);
  color: var(--on-surface);
}

.cookie-consent__btn--reject:hover {
  background: var(--surface-container-highest);
}

@media (min-width: 768px) {
  .cookie-consent__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .cookie-consent__actions {
    flex-shrink: 0;
  }
}

/* Scroll-aware floating create button (scroll-fab.js). The button animates out
   while the create field is on screen and back in once it scrolls away. */
.dash-fab,
.landing-mobile-cta {
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.dash-fab.fab-hidden,
.landing-mobile-cta.fab-hidden {
  opacity: 0;
  transform: translateY(16px);
  visibility: hidden;
  pointer-events: none;
}
