/* Global Header & Footer styles */
:root {
  --header-h: 64px;
  --footer-h: 64px;
  --glass-bg: rgba(255,255,255,0.65);
  --glass-border: rgba(0,0,0,0.06);
  --footer-bg: #0f172a; /* dark */
  --footer-fg: #e5e7eb; /* light */
}

/* Reserve space for fixed header and footer */
html, body { min-height: 100%; }
body { padding-top: var(--header-h); padding-bottom: var(--footer-h); }

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--glass-bg);
  color: #0f172a;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  box-shadow: 0 6px 24px rgba(2,6,23,0.06);
  animation: fadeSlideIn 220ms ease-out;
}
.app-header .inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left brand, center nav, right actions */
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 700;
}
.app-brand img { height: 28px; width: auto; display: block; }

.nav { display: flex; align-items: center; gap: 14px; justify-content: center; }
.nav a { position: relative; color: #0f172a; text-decoration: none; font-weight: 600; padding: 6px 4px; border-radius: 4px; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform 180ms ease; }
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); }
.nav a[style*="background"] { background: transparent !important; color: var(--accent) !important; }

/* User area (auth.js will populate #userInfo when logged in) */
.header-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.header-actions .btn-link { color: #fff; text-decoration: none; font-weight: 600; border: 1px solid rgba(255,255,255,0.25); padding: 6px 10px; border-radius: 8px; }
.header-actions .btn-link { color: #0f172a; border-color: var(--glass-border); }
.header-actions .btn-link:hover { background: rgba(2,6,23,0.06); }

/* Hamburger (mobile) */
.hamburger { display: none; background: transparent; border: 1px solid var(--glass-border); color: #0f172a; padding: 6px 10px; border-radius: 8px; }
.hamburger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Collapsible menu on mobile */
@media (max-width: 760px) {
  .nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--glass-bg);
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
  }
  .nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .hamburger { display: inline-flex; }
}

/* Footer */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-h);
  background: var(--footer-bg);
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--footer-fg);
  z-index: 900;
  animation: fadeSlideIn 260ms ease-out;
}
.app-footer .inner { height: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.app-footer .brand { display:inline-flex; align-items:center; gap:8px; color: var(--footer-fg); text-decoration: none; }
.app-footer .brand img { height: 18px; width: auto; }
.app-footer .links { text-align: center; }
.app-footer .links a { color: var(--footer-fg); text-decoration: none; font-weight: 600; margin: 0 8px; opacity: 0.9; }
.app-footer .links a:hover, .app-footer .links a:focus-visible { opacity: 1; text-decoration: underline; }
.app-footer .social { display:flex; justify-content: flex-end; gap: 10px; }
.app-footer .social a { color: var(--footer-fg); opacity: 0.85; text-decoration: none; display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius: 6px; border:1px solid rgba(255,255,255,0.08); }
.app-footer .social a:hover, .app-footer .social a:focus-visible { opacity: 1; background: rgba(255,255,255,0.06); }

/* Footer responsive stacking */
@media (max-width: 760px) {
  .app-footer .inner { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: 6px; padding: 8px 12px; }
  .app-footer .social { justify-content: center; }
}

/* Focus and animations */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* User dropdown link hover to match nav underline */
#userMenuBtn span { color: #0f172a !important; }
#userMenuBtn small { color: #6b7280 !important; }
#userMenuDropdown a {
  color: #0f172a;
  text-decoration: none;
  border-radius: 6px;
}
#userMenuDropdown a:hover,
#userMenuDropdown a:focus-visible {
  text-decoration: underline;
  background: rgba(37, 99, 235, 0.08); /* subtle accent highlight */
}

/* Unify dropdown item formatting (links and buttons) */
#userMenuDropdown a,
#userMenuDropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font: inherit;
  color: #0f172a;
  border-radius: 6px;
  cursor: pointer;
}
#userMenuDropdown button:hover,
#userMenuDropdown button:focus-visible {
  background: rgba(37, 99, 235, 0.08);
}
