/* ============================================================
   Layout — Header, Pill Nav, Dropdown, Theme Toggle,
            Mobile Bottom Nav, Footer
   ============================================================ */

/* ---------- Header ---------- */
.opx-header-clean {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--opx-header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--opx-line);
}
html[data-theme="dark"] .opx-header-clean {
  border-bottom-color: rgba(59, 130, 246, 0.16);
}

.opx-header-clean .opx-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.opx-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  justify-self: start;
  min-width: 0;
}
.opx-brand-logo {
  height: 36px;
  width: auto;
}
.opx-brand-title {
  color: var(--opx-ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.opx-brand-sub {
  color: var(--opx-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

/* ---------- Pill Navbar ---------- */
.opx-header-clean .opx-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--opx-pill-bg);
  border: 1px solid var(--opx-pill-border);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(30, 58, 138, 0.06);
}

.opx-header-clean .opx-nav > a,
.opx-header-clean .opx-nav .opx-drop > a {
  color: var(--opx-ink);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.opx-header-clean .opx-nav > a:hover,
.opx-header-clean .opx-nav .opx-drop > a:hover,
.opx-header-clean .opx-nav > a.opx-active {
  background: var(--opx-sky);
  color: var(--opx-blue);
}

/* Nav dropdown */
.opx-drop { position: relative; }
.opx-drop > a { cursor: pointer; }
.opx-drop-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 8px;
  min-width: 210px;
  z-index: 60;
}
.opx-drop-menu-inner {
  background: var(--opx-surface);
  border: 1px solid var(--opx-line);
  border-radius: 12px;
  box-shadow: var(--opx-shadow);
  padding: 6px;
}
.opx-nav .opx-drop-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--opx-ink);
  text-decoration: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 500;
}
.opx-nav .opx-drop-menu a:hover { background: var(--opx-sky); color: var(--opx-blue); }
.opx-nav .opx-drop-menu a i { color: var(--opx-blue); width: 16px; text-align: center; }
.opx-drop:hover .opx-drop-menu,
.opx-drop:focus-within .opx-drop-menu { display: block; }

/* ---------- Auth Actions & Theme Toggle ---------- */
.opx-auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.opx-theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--opx-line);
  border-radius: 999px;
  background: var(--opx-pill-bg);
  color: var(--opx-ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.opx-theme-toggle:hover {
  border-color: var(--opx-blue);
  color: var(--opx-blue);
}
.opx-theme-toggle .fa-sun { display: none; }
.opx-theme-toggle .fa-moon { display: inline-block; }
html[data-theme="dark"] .opx-theme-toggle .fa-sun { display: inline-block; }
html[data-theme="dark"] .opx-theme-toggle .fa-moon { display: none; }

/* ---------- Mobile Bottom Nav ---------- */
.opx-mnav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  background: var(--opx-surface);
  border-top: 1px solid var(--opx-line);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}
.opx-mnav-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}
.opx-mnav a,
.opx-mnav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px calc(9px + env(safe-area-inset-bottom));
  color: var(--opx-muted);
  background: transparent;
  border: none;
  font-family: inherit;
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.opx-mnav a i,
.opx-mnav button i { font-size: 1.1rem; }
.opx-mnav a.opx-active { color: var(--opx-blue); }
html[data-theme="dark"] .opx-mnav a.opx-active { color: var(--opx-blue-deep); }

/* ---------- Footer ---------- */
.opx-footer-clean {
  margin-top: 56px;
  border-top: 1px solid var(--opx-line);
  background: var(--opx-surface-soft);
  color: var(--opx-muted);
}
.opx-footer-clean .opx-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 44px 24px 24px;
}
.opx-footer-clean .opx-footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.opx-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.opx-footer-brand img { height: 32px; width: auto; }
.opx-footer-brand span {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--opx-ink);
}
.opx-footer-clean h4 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--opx-ink);
  margin: 0 0 10px;
}
.opx-footer-clean p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--opx-muted);
  max-width: 300px;
  margin: 0;
}
.opx-footer-clean a {
  display: block;
  text-decoration: none;
  font-size: 0.84rem;
  color: var(--opx-muted);
  padding: 3px 0;
}
.opx-footer-clean a:hover { color: var(--opx-blue); }
.opx-footer-clean .opx-footer-bottom {
  padding-top: 18px;
  border-top: 1px solid var(--opx-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--opx-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .opx-header-clean .opx-header-inner { grid-template-columns: 1fr auto; }
  .opx-header-clean .opx-nav { display: none; }
  .opx-footer-clean .opx-footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .opx-brand-sub { display: none; }
  .opx-mnav { display: block; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .opx-footer-clean .opx-footer-grid { grid-template-columns: 1fr; }
}
