/* Shared app layout + components */

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
}

a {
  color: var(--color-link);
}

a:visited {
  color: var(--color-link);
}

.muted {
  color: var(--color-text-faint);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.container {
  max-width: 900px;
  margin: 40px auto;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow-elev-1);
  padding: 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.meta-text {
  color: var(--color-text-faint);
  font-size: 0.95em;
}

h1 {
  text-align: center;
  color: var(--color-text);
}

.nav a {
  color: var(--color-link);
  text-decoration: none;
  margin-left: 16px;
  font-weight: bold;
}

/* Subscription hint (placeholder for future subscription gating) */
.subscription-hint.info-box {
  margin: 12px 0 18px 0;
  padding: 12px 16px;
  position: relative;
  overflow: hidden;
  background: transparent;
  border-left: 0;
  border: 1px solid var(--color-border-subtle);
}

.subscription-hint.info-box p {
  margin: 0;
}

.subscription-hint.info-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--info-bg);
  /* Warm-tint the existing theme background without hard-coding new colors */
  filter: sepia(0.55) saturate(1.35) hue-rotate(-10deg) brightness(1.05);
  opacity: 1;
  z-index: 0;
}

.subscription-hint.info-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  background: var(--color-surface-3);
  /* Push the bar towards a warning-like yellow */
  filter: sepia(0.95) saturate(2.2) hue-rotate(-18deg) brightness(1.25);
  z-index: 1;
}

.subscription-hint.info-box > * {
  position: relative;
  z-index: 2;
}

/* Current behavior: logged-in users count as active subscribers */
:root[data-authenticated="true"] .subscription-hint {
  display: none;
}

/* Dark mode: make the banner more visible by using a lighter surface tone */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .subscription-hint.info-box::before {
    background: var(--color-surface-3);
    filter: sepia(0.7) saturate(1.55) hue-rotate(-12deg) brightness(1.2);
  }
}

:root[data-theme="dark"] .subscription-hint.info-box::before {
  background: var(--color-surface-3);
  filter: sepia(0.7) saturate(1.55) hue-rotate(-12deg) brightness(1.2);
}

.period-selector {
  text-align: center;
  margin: 24px 0 8px 0;
}

.period-selector button {
  margin: 0 8px;
  padding: 6px 18px;
  border-radius: 4px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  cursor: pointer;
  font-size: 1em;
  color: var(--color-text);
}

.period-selector button:hover {
  background: var(--button-hover-bg);
}

.period-selector button.active {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}

.button-secondary {
  margin: 0 4px;
  padding: 6px 18px;
  border-radius: 4px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  cursor: pointer;
  font-size: 0.9em;
  color: var(--color-text);
}

.button-secondary:hover {
  background: var(--button-hover-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
}

th, td {
  padding: 12px 8px;
  text-align: left;
}

th.right, td.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

th {
  background: var(--table-header-bg);
  color: var(--color-text);
}

tr:nth-child(even) {
  background: var(--table-even-bg);
}

tr:hover {
  background: var(--table-row-hover-bg);
}

/* Mobile responsive baseline */
@media screen and (max-width: 768px) {
  .container {
    margin: 16px;
    padding: 20px;
    border-radius: 8px;
  }

  h1 {
    font-size: 1.5em;
    margin-bottom: 16px;
  }

  .period-selector {
    margin: 16px 0 4px 0;
  }

  .period-selector button {
    margin: 0 4px;
    padding: 6px 12px;
    font-size: 0.95em;
  }
}

@media screen and (max-width: 480px) {
  .container {
    margin: 8px;
    padding: 16px;
  }

  .period-selector {
    margin: 12px 0 4px 0;
  }

  .period-selector button {
    margin: 0 3px;
    padding: 5px 10px;
    font-size: 0.9em;
  }
}

/* Footer (injected by js/footer.js) */
.app-footer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.9em;
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-footer-sep {
  color: var(--color-text-faint);
}
