/* ============================================================
   ROYAL TICKETS · MAIN LAYOUT CSS (FINAL)
   File: /assets/css/layout/main.css

   Production Goals:
   - Mobile-first responsive layout (phone → tablet → desktop)
   - Consistent branding (gold + black glass)
   - Accessible focus states + tap targets
   - Reliable active nav styles (desktop + mobile)
   - Stable layout: no overflow, minimal CLS
   - PWA install banner moved from inline styles → CSS classes
============================================================ */

/* ============================================================
   THEME TOKENS
============================================================ */
:root {
  --gold-light: #f5dd66;
  --gold-dark: #dab241;

  --black: #000000;
  --white: #ffffff;

  --bg-0: #000000;
  --bg-1: #0b0b0b;
  --bg-2: #1a1a1a;

  --glass-dark: rgba(0, 0, 0, 0.78);
  --glass-darker: rgba(0, 0, 0, 0.92);

  --border-gold: rgba(245, 221, 102, 0.32);

  --text-strong: rgba(255, 255, 255, 0.92);
  --text: rgba(255, 255, 255, 0.78);
  --text-dim: rgba(255, 255, 255, 0.62);

  --card: rgba(255, 255, 255, 0.06);
  --card-2: rgba(255, 255, 255, 0.08);

  --shadow-gold: 0 10px 26px rgba(245, 221, 102, 0.45);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.35);

  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --container: 1280px;
  --pad: 1rem;

  --focus: 0 0 0 3px rgba(245, 221, 102, 0.28);

  /* Safe area padding for notched devices */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ============================================================
   BASE / SAFETY
============================================================ */

/* Improve tap/scroll behavior and avoid horizontal overflow bugs */
.rt-layout-bg {
  background: linear-gradient(145deg, var(--bg-0), var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  color: var(--white);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

/* Ensure images never overflow containers */
.rt-layout-bg img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Accessible focus ring (keyboard users) */
.rt-layout-bg :where(a, button, input, select, textarea):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 10px;
}

/* Make buttons inherit font */
.rt-layout-bg button {
  font: inherit;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   NAVBAR (Mobile-first)
============================================================ */
.rt-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(0, 0, 0, 0.75);
  border-bottom: 1px solid var(--border-gold);
  padding: 0.85rem 0;
}

.rt-navbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: calc(var(--pad) + var(--safe-left));
  padding-right: calc(var(--pad) + var(--safe-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ============================================================
   BRAND
============================================================ */
.rt-navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  min-width: 0;
}

.rt-logo-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border: 1px solid rgba(245, 221, 102, 0.28);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.rt-navbar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.rt-logo-text {
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   DESKTOP NAV (Hidden by default, shown at tablet+)
============================================================ */
.rt-navbar-actions {
  display: none; /* Mobile-first */
  align-items: center;
  gap: 1.2rem;
}

.rt-nav-link {
  color: var(--text-strong);
  text-decoration: none;
  font-size: 0.95rem;
  transition: 0.22s ease;
  position: relative;
  border-radius: 10px;
}

/* Hover */
.rt-nav-link:hover {
  color: var(--gold-light);
  text-shadow: 0 0 6px rgba(245, 221, 102, 0.4);
}

/* Active state (desktop links) */
.rt-nav-link.is-active {
  color: var(--gold-light);
}
.rt-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  border-radius: 99px;
  background: rgba(245, 221, 102, 0.85);
}

/* Sell button */
.rt-sell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(
    135deg,
    var(--gold-light),
    var(--gold-dark)
  ) !important;
  color: var(--black) !important;
  transition: 0.22s ease;
  will-change: transform;
}
.rt-sell-btn:hover {
  opacity: 0.94;
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

/* Active state for sell button (rare but supported) */
.rt-sell-btn.is-active {
  box-shadow:
    0 0 0 1px rgba(245, 221, 102, 0.55),
    var(--shadow-gold);
}

/* Icon link */
.rt-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 12px;
  padding: 0.45rem;
  transition: 0.22s ease;
}
.rt-nav-icon i {
  width: 24px;
  height: 24px;
  color: var(--gold-light);
  transition: 0.22s ease;
}
.rt-nav-icon:hover i {
  color: var(--white);
  transform: translateY(-1px);
}
.rt-nav-icon.is-active {
  background: rgba(245, 221, 102, 0.12);
  box-shadow: 0 0 0 1px rgba(245, 221, 102, 0.28);
}

/* ============================================================
   MOBILE MENU BUTTON (Always visible on mobile)
============================================================ */
.rt-mobile-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(245, 221, 102, 0.22);
  color: var(--gold-light);
  padding: 0.55rem;
  border-radius: 12px;
  transition: 0.22s ease;
  min-width: 44px;
  min-height: 44px;
}
.rt-mobile-menu-btn:hover {
  background: rgba(245, 221, 102, 0.08);
  border-color: rgba(245, 221, 102, 0.35);
}
.rt-mobile-menu-btn i {
  width: 26px;
  height: 26px;
}

/* ============================================================
   MOBILE MENU PANEL (Dropdown under header)
   - Uses opacity/transform for smooth transitions
   - Uses max-height (safe for variable content)
============================================================ */
.rt-mobile-menu {
  width: 100%;
  padding: 0.9rem calc(var(--pad) + var(--safe-left)) 1rem
    calc(var(--pad) + var(--safe-right));
  background: var(--glass-darker);
  border-bottom: 1px solid var(--border-gold);

  display: block; /* stable layout */
  max-height: 0;
  overflow: hidden;

  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 0.25s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

.rt-mobile-menu.open {
  max-height: 520px; /* safe cap for more links later */
  opacity: 1;
  transform: translateY(0);
}

/* Mobile items */
.rt-mobile-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px; /* good tap target */
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--white);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: 0.2s ease;
  margin-top: 0.65rem;
}

.rt-mobile-item:hover {
  background: rgba(245, 221, 102, 0.16);
  border-color: rgba(245, 221, 102, 0.22);
  color: var(--gold-light);
}

/* Active state (mobile items) */
.rt-mobile-item.is-active {
  background: rgba(245, 221, 102, 0.14);
  border-color: rgba(245, 221, 102, 0.35);
  color: var(--gold-light);
}

/* ============================================================
   MAIN CONTENT
============================================================ */
.rt-main {
  width: 100%;
  max-width: var(--container);
  margin: 1.6rem auto 2.6rem;
  padding-left: calc(var(--pad) + var(--safe-left));
  padding-right: calc(var(--pad) + var(--safe-right));
}

/* ============================================================
   FOOTER (Mobile-first)
============================================================ */
.rt-footer {
  margin-top: auto;
  padding: 2.5rem calc(var(--pad) + var(--safe-left));
  padding-right: calc(var(--pad) + var(--safe-right));
  padding-bottom: calc(2.5rem + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.88);
  border-top: 1px solid var(--border-gold);
}

.rt-footer-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr; /* Mobile-first */
  gap: 2rem;
}

/* Footer brand */
.ft-brand {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ft-navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  justify-content: flex-start;
}

.ft-logo-box {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 221, 102, 0.28);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
}

.ft-navbar-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.ft-logo-text {
  color: var(--white);
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.ft-tagline {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Footer columns */
.ft-column h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 0.65rem;
}

.ft-column p,
.ft-column a {
  color: var(--text);
  display: block;
  margin-bottom: 0.45rem;
  text-decoration: none;
  transition: 0.2s ease;
  line-height: 1.45;
}

.ft-column a:hover {
  color: var(--gold-light);
  text-shadow: 0 0 6px rgba(245, 221, 102, 0.45);
}

/* Social */
.ft-social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.6rem;
}

.ft-social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 221, 102, 0.22);
  transition: 0.2s ease;
}
.ft-social-links a:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  border-color: var(--gold-light);
  transform: translateY(-2px);
}
.ft-social-links a i {
  width: 20px;
  height: 20px;
  color: var(--gold-light);
  transition: 0.2s ease;
}
.ft-social-links a:hover i {
  color: var(--black);
}

/* Footer bottom */
.rt-footer-bottom {
  max-width: var(--container);
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(245, 221, 102, 0.14);
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.rt-dev-link {
  color: var(--gold-light);
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  font-weight: 750;
  transition: 0.2s ease;
  text-decoration: none;
}
.rt-dev-link:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: var(--black);
  transform: translateY(-1px);
}

/* ============================================================
   PWA INSTALL BANNER (Moved from inline styles)
   HTML classes:
   - #pwa-install-banner.rt-pwa-banner
   - .is-visible toggled by JS
============================================================ */
.rt-pwa-banner {
  position: fixed;
  left: 15px;
  right: 15px;
  bottom: calc(15px + var(--safe-bottom));
  z-index: 9999;

  display: none;
  padding: 14px 14px;
  border-radius: var(--radius-lg);

  background: rgba(10, 10, 10, 0.92);
  border: 1px solid rgba(245, 221, 102, 0.24);
  box-shadow: var(--shadow-soft);

  color: var(--gold-light);
  text-align: center;

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rt-pwa-banner.is-visible {
  display: block;
}

.rt-pwa-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--gold-light);
}

.rt-pwa-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rt-pwa-btn {
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: 0.2s ease;
  min-height: 42px;
  font-weight: 750;
}

.rt-pwa-btn-primary {
  background: var(--gold-light);
  border: 1px solid var(--gold-light);
  color: var(--black);
}
.rt-pwa-btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.rt-pwa-btn-ghost {
  background: transparent;
  border: 1px solid rgba(245, 221, 102, 0.45);
  color: var(--gold-light);
}
.rt-pwa-btn-ghost:hover {
  background: rgba(245, 221, 102, 0.1);
  transform: translateY(-1px);
}

/* Keep banner comfortable on larger screens */
@media (min-width: 821px) {
  .rt-pwa-banner {
    left: auto;
    right: 22px;
    bottom: calc(22px + var(--safe-bottom));
    max-width: 420px;
    text-align: left;
  }

  .rt-pwa-actions {
    justify-content: flex-start;
  }
}

/* ============================================================
   RESPONSIVE ENHANCEMENTS
============================================================ */

/* Tablet and up: show desktop nav, improve footer grid */
@media (min-width: 821px) {
  .rt-navbar {
    padding: 0.9rem 0;
  }

  /* Show desktop nav */
  .rt-navbar-actions {
    display: flex;
  }

  /* Hide mobile button + menu */
  .rt-mobile-menu-btn {
    display: none;
  }
  .rt-mobile-menu {
    display: none;
  }

  /* Footer grid becomes multi-column */
  .rt-footer-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 2.25rem;
  }
}

/* Medium screens: 2 columns footer for comfortable reading */
@media (min-width: 521px) and (max-width: 820px) {
  .rt-footer-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

/* Small screens: center some footer elements for balance */
@media (max-width: 520px) {
  .rt-footer-grid {
    text-align: center;
  }

  .ft-navbar-brand {
    justify-content: center;
  }

  .ft-social-links {
    justify-content: center;
  }
}
