/* ============================================================
   AGI DeFi Platform — Layout Components
   Header / Footer / Bottom Navigation
   ============================================================ */


/* ============================
   GLOBAL OVERLAY
   ============================ */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: calc(var(--z-bottom-sheet) - 10); /* 140: below bottom-sheet(150) & modal(200) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}


/* ============================
   HEADER
   ============================ */

#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border-subtle);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  padding: 0 var(--page-px);
  gap: var(--sp-3);
}

/* LOGO */
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo img {
  height: 30px;
  width: auto;
}
.header-logo-text {
  font-family: var(--font-data);
  font-size: var(--text-xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* SPACER */
.header-spacer {
  flex: 1;
}

/* Desktop Nav (hidden on mobile) */
.header-nav {
  display: none;
}
@media (min-width: 1024px) {
  .header-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex: 1;
    margin-left: var(--sp-8);
  }
}

.header-nav a {
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-secondary);
  border-radius: var(--r-sm);
  transition: var(--t-fast);
  white-space: nowrap;
}
.header-nav a:hover {
  color: var(--c-text-primary);
  background: rgba(255,255,255,0.05);
}
.header-nav a.active {
  color: var(--c-primary);
}

/* HEADER ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Language button (header) */
.header-lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--c-text-secondary);
  background: transparent;
  border: 1px solid var(--c-border-subtle);
  cursor: pointer;
  transition: var(--t-fast);
  height: 34px;
}
.header-lang-btn:hover {
  color: var(--c-text-primary);
  border-color: var(--c-border);
  background: rgba(255,255,255,0.05);
}
.header-lang-btn i {
  font-size: 13px;
}

/* Connect Wallet button */
.header-wallet-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--c-primary);
  border: 1px solid var(--c-border-active);
  background: rgba(255,107,43,0.08);
  cursor: pointer;
  transition: var(--t-base);
  height: 34px;
  letter-spacing: 0.02em;
}
.header-wallet-btn:hover {
  background: rgba(255,107,43,0.16);
  box-shadow: var(--shadow-glow-xs);
  transform: translateY(-1px);
}
.header-wallet-btn.connected {
  border-color: var(--c-border-active);
  color: var(--c-primary);
}

.header-wallet-btn .wallet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-success);
  flex-shrink: 0;
}
.header-wallet-btn:not(.connected) .wallet-dot {
  background: var(--c-text-muted);
}

/* Notification dot */
.notif-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border-subtle);
  background: transparent;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: var(--t-fast);
  font-size: var(--text-md);
}
.notif-btn:hover {
  color: var(--c-text-primary);
  border-color: var(--c-border);
}
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 7px; height: 7px;
  background: var(--c-danger);
  border-radius: 50%;
}


/* ============================
   BOTTOM NAVIGATION
   ============================ */

#bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(13, 15, 22, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--c-border-subtle);
  z-index: var(--z-bottom-nav);
  align-items: stretch;
}

@media (min-width: 1024px) {
  #bottom-nav {
    display: none;
  }
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--c-text-muted);
  text-decoration: none;
  transition: var(--t-fast);
  padding-bottom: 4px;
  position: relative;
}
.nav-item:hover {
  color: var(--c-text-secondary);
}
.nav-item.active {
  color: var(--c-primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  box-shadow: var(--shadow-glow-xs);
}

/* Center BUY button */
.nav-item.nav-center {
  position: relative;
}
.nav-item.nav-center .nav-btn-circle {
  width: 46px;
  height: 46px;
  background: var(--gradient-primary);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  color: #fff;
  box-shadow: var(--shadow-glow-sm);
  margin-bottom: 2px;
  transition: var(--t-base);
}
.nav-item.nav-center:hover .nav-btn-circle {
  box-shadow: var(--shadow-glow-md);
  transform: scale(1.05);
}
.nav-item.nav-center .nav-icon { display: none; }

.nav-icon {
  font-size: 18px;
  line-height: 1;
}
.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}


/* ============================
   FOOTER
   ============================ */

#app-footer {
  background: var(--c-bg-deep);
  border-top: 1px solid var(--c-border-subtle);
  padding: var(--sp-12) var(--page-px) var(--sp-8);
  display: none;
}

@media (min-width: 1024px) {
  #app-footer {
    display: block;
  }
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 240px repeat(3, 1fr);
  gap: var(--sp-8);
  margin-bottom: var(--sp-8);
}

@media (max-width: 768px) {
  .footer-top { grid-template-columns: 1fr; }
}

.footer-brand .footer-logo-text {
  font-family: var(--font-data);
  font-size: var(--text-xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--sp-3);
}
.footer-brand p {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  line-height: 1.7;
  margin-bottom: var(--sp-4);
}

.footer-col h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-4);
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.footer-col ul li a {
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  transition: var(--t-fast);
}
.footer-col ul li a:hover {
  color: var(--c-primary);
}

.footer-bottom {
  border-top: 1px solid var(--c-border-subtle);
  padding-top: var(--sp-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.footer-copy {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
}
.footer-links {
  display: flex;
  gap: var(--sp-4);
}
.footer-links a {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  transition: var(--t-fast);
}
.footer-links a:hover { color: var(--c-primary); }


/* ============================
   PAGE WRAPPER
   ============================ */

.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--header-h) + var(--sp-5)) var(--page-px) calc(var(--bottom-nav-h) + var(--sp-5));
}

@media (min-width: 1024px) {
  .page-wrapper {
    padding-bottom: var(--sp-12);
    padding-top: calc(var(--header-h) + var(--sp-8));
  }
}

/* Section title */
.section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-text-primary);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 18px;
  background: var(--gradient-primary);
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--c-border-subtle);
  margin: var(--sp-5) 0;
}

/* Wallet Options (in wallet modal) */
.wallet-option {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--t-base);
  margin-bottom: var(--sp-3);
}
.wallet-option:hover {
  border-color: var(--c-border-active);
  background: rgba(255,107,43,0.06);
  box-shadow: var(--shadow-glow-xs);
}
.wallet-option:last-child {
  margin-bottom: 0;
}
.wallet-option img {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.wallet-option .wo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--c-bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wallet-option .wo-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-text-primary);
}
.wallet-option .wo-desc {
  font-size: var(--text-xs);
  color: var(--c-text-muted);
  margin-top: 2px;
}
.wallet-option .wo-arrow {
  margin-left: auto;
  color: var(--c-text-muted);
  font-size: var(--text-sm);
}
