/* Shared UI components — buttons, cards, navbar, footer, badges */

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease-in-out),
    color var(--duration-fast) var(--ease-in-out),
    border-color var(--duration-fast) var(--ease-in-out),
    box-shadow var(--duration-fast) var(--ease-in-out),
    transform var(--duration-fast) var(--ease-in-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gradient-btn);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.btn-primary:hover {
  color: var(--white);
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.4);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  border-color: var(--color-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-bg-muted);
  color: var(--color-text);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: var(--text-xs);
}

.btn-danger,
.btn--danger {
  background: var(--color-danger);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* —— Cards —— */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

.card:not(.card--static):hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.card--premium {
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-md);
}

.card-panel--danger {
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
}

/* —— Theme toggle —— */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border, rgba(148, 163, 184, 0.28));
  border-radius: var(--radius-md);
  color: var(--color-text-secondary, var(--color-muted));
  cursor: pointer;
  transition:
    background var(--duration-fast, 150ms),
    color var(--duration-fast, 150ms),
    border-color var(--duration-fast, 150ms);
}

.theme-toggle__icon {
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

html[data-theme="dark"] .theme-toggle__icon--sun,
html:not([data-theme="light"]) .theme-toggle__icon--sun {
  display: inline-flex;
}

html[data-theme="light"] .theme-toggle__icon--moon {
  display: inline-flex;
}

.theme-toggle:hover {
  background: var(--color-bg-muted, var(--color-accent-muted));
  color: var(--color-accent, var(--color-text));
  border-color: var(--color-accent, currentColor);
}

/* —— Navbar —— */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  height: var(--navbar-height);
  background: var(--color-navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition:
    background var(--duration-base),
    border-color var(--duration-base),
    box-shadow var(--duration-base);
}

.navbar.is-scrolled {
  border-bottom-color: var(--color-navbar-border);
  box-shadow: var(--shadow-sm);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-height);
  gap: var(--space-4);
}

.navbar__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--color-text);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar__logo:hover {
  color: var(--color-text);
}

.navbar__logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--gradient-btn);
  color: var(--white);
}

.navbar__nav {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

@media (min-width: 900px) {
  .navbar__nav {
    display: flex;
  }
}

.navbar__link {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: color var(--duration-fast), background var(--duration-fast);
}

.navbar__link:hover,
.navbar__link.is-active {
  color: var(--color-text);
  background: var(--color-bg-muted);
}

.navbar__actions {
  display: none;
  align-items: center;
  gap: var(--space-2);
}

@media (min-width: 900px) {
  .navbar__actions {
    display: flex;
  }
}

.auth-inline-form {
  display: inline;
  margin: 0;
}

.navbar__mobile-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  color: var(--color-text);
}

@media (min-width: 900px) {
  .navbar__mobile-toggle {
    display: none;
  }
}

.navbar__mobile-menu {
  display: none;
  position: absolute;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  z-index: var(--z-mobile-menu);
  padding: var(--space-4) var(--space-5) var(--space-6);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}

.navbar__mobile-menu.is-open {
  display: block;
}

.navbar__mobile-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.navbar__mobile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.navbar__mobile-actions .btn {
  width: 100%;
}

.auth-navbar .navbar__actions {
  display: flex;
}

.auth-navbar .navbar__mobile-toggle {
  display: none;
}

/* —— Footer —— */
.site-footer {
  padding-block: var(--space-16) var(--space-8);
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-10);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-12);
}

@media (min-width: 640px) {
  .site-footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  }
}

.site-footer__brand p {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  max-width: 22rem;
}

.site-footer__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  text-decoration: none;
}

.site-footer__logo:hover {
  color: var(--color-text);
}

.site-footer__social {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.site-footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
}

.site-footer__social a:hover {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.site-footer__heading {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.site-footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.site-footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.site-footer__links a:hover {
  color: var(--color-accent);
}

.site-footer__bottom {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer__bottom > p:not(.performance-disclaimer),
.site-footer__bottom-row,
.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
}

.site-footer__bottom p {
  margin: 0;
  color: var(--color-text-muted);
}

.site-footer__legal {
  display: flex;
  gap: var(--space-4);
}

.site-footer__legal a {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.performance-disclaimer {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-warning-border, rgba(217, 119, 6, 0.35));
  border-radius: var(--radius-md, 0.5rem);
  background: var(--color-warning-soft, rgba(217, 119, 6, 0.08));
  color: var(--color-text-secondary);
  font-size: var(--text-xs, 0.75rem);
  line-height: 1.55;
  width: 100%;
}

.page-disclaimer {
  width: 100%;
  margin: 1.5rem 0 0;
  padding: 0;
  box-sizing: border-box;
}

.page-disclaimer .performance-disclaimer {
  max-width: none;
  margin-inline: 0;
}

/* Marketing / non-dashboard pages: keep readable width */
main > .page-disclaimer {
  max-width: 72rem;
  margin: 1.5rem auto;
  padding-inline: var(--space-md, 1rem);
}

.dashboard-footer .performance-disclaimer {
  margin-bottom: 0.25rem;
}

.dashboard-footer__inner {
  flex-direction: column;
  align-items: stretch;
}

.dashboard-footer__inner > p:not(.performance-disclaimer),
.dashboard-footer__bottom-row,
.dashboard-footer__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.dashboard-footer__bottom-row p,
.dashboard-footer__nav {
  color: var(--color-text-muted);
}

/* —— Limit modal —— */
.limit-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.limit-modal[hidden] {
  display: none !important;
}

.limit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 13, 26, 0.65);
  backdrop-filter: blur(4px);
}

.limit-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  text-align: center;
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
}

.limit-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.limit-modal__title {
  margin-bottom: var(--space-2);
}

.limit-modal__desc {
  margin-bottom: var(--space-6);
}

.limit-modal__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.limit-modal__actions .btn {
  width: 100%;
}

/* —— Badge —— */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* —— Auth inline helpers used globally —— */
.ui-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
