/*
 * layout.css — header, footer, grid, responsive breakpoints, app shell
 * Carnac Prediction Tracker
 * Load order: 4 of 4 (base → cards → modal → layout)
 * Depends on: base.css (CSS variables)
 */

/* ── App shell ───────────────────────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* CRT scanline overlay — purely decorative */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-scanline);
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface);
  border-bottom: 3px solid var(--color-cyan);
  box-shadow: 0 2px 20px rgba(0, 255, 255, 0.12);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* ── Brand ───────────────────────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
}

.brand-logo {
  font-size: 1.9rem;
  filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.6));
  animation: float 4s ease-in-out infinite;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 0.95rem; /* Adjusted for the longer title */
  color: var(--color-cyan);
  margin: 0;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px var(--color-cyan), 0 0 32px rgba(0, 255, 255, 0.25);
  line-height: 1.3;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--color-yellow);
  letter-spacing: 0.12em;
  opacity: 0.8;
  line-height: 1.4;
}

/* ── Header actions ──────────────────────────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── Offline badge ───────────────────────────────────────────────────────────── */
.badge-offline {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--color-yellow);
  background: rgba(255, 230, 0, 0.08);
  border: 2px solid var(--color-yellow);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  animation: blink 2.2s step-end infinite;
  white-space: nowrap;
}

/* ── Add button ──────────────────────────────────────────────────────────────── */
.btn-add-prediction {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #000;
  background: var(--color-cyan);
  border: 2px solid var(--color-cyan);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.25);
  white-space: nowrap;
}
.btn-add-prediction:hover {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 22px rgba(0, 255, 255, 0.55);
  transform: translateY(-2px);
}
.btn-add-prediction:active {
  transform: scale(0.95);
}

/* ── Firebase demo notice ────────────────────────────────────────────────────── */
.demo-notice {
  background: rgba(255, 230, 0, 0.06);
  border: 2px solid var(--color-yellow);
  border-radius: var(--radius-md);
  padding: 10px var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-yellow);
  margin-bottom: var(--space-lg);
  line-height: 1.55;
}

.demo-notice code {
  background: rgba(255, 230, 0, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

/* ── Sync error banner ───────────────────────────────────────────────────────── */
.sync-error-banner {
  margin-bottom: var(--space-md);
  padding: 10px var(--space-md);
  background: rgba(255, 80, 120, 0.07);
  border: 2px solid var(--color-pink);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-pink);
}

/* ── Main content ────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  letter-spacing: 0.1em;
}

.footer-version {
  color: var(--color-cyan);
  opacity: 0.7;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .predictions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-inner {
    padding: 12px var(--space-md);
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    display: none;
  }

  .btn-add-prediction {
    font-size: 0.5rem;
    padding: 8px 12px;
  }

  .main {
    padding: var(--space-lg) var(--space-md);
  }
}

@media (max-width: 380px) {
  .brand-logo {
    font-size: 1.4rem;
  }

  .brand-title {
    font-size: 0.8rem;
  }
}

/* Footer links and buttons */
.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.footer-separator {
  color: var(--border);
  font-weight: bold;
}

.btn-footer-link {
  background: none;
  border: none;
  color: var(--color-cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.btn-footer-link:hover {
  color: var(--color-pink);
  text-decoration: underline;
}

.footer-powered {
  font-size: 0.6rem;
  opacity: 0.5;
  letter-spacing: 0.05em;
}

/* Hamburger Menu Toggle */
.btn-menu-toggle {
  background: none;
  border: 1px solid var(--border);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1001; /* Above the overlay */
}

.btn-menu-toggle:hover {
  border-color: var(--color-cyan);
  background: rgba(0, 255, 255, 0.05);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.hamburger-bar {
  width: 1.25rem;
  height: 2px;
  background-color: var(--color-cyan);
  transition: all 0.3s ease;
  pointer-events: none;
}

.btn-menu-toggle.active .hamburger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  background-color: var(--color-pink);
}

.btn-menu-toggle.active .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.btn-menu-toggle.active .hamburger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  background-color: var(--color-pink);
}

/* Nav Menu Overlay & Dropdown */
.nav-menu-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease-out;
}

.nav-menu {
  width: 100%;
  max-width: 300px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  height: 100%; /* Fill full height */
  padding-top: 5rem; /* Space for the header toggle */
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.nav-list {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
}

.nav-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1.25rem 1.5rem;
  color: var(--color-cyan);
  font-family: var(--font-display);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: background 0.2s ease;
}

.nav-link:hover {
  background: rgba(0, 255, 255, 0.05);
  color: var(--color-pink);
}

.nav-email {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--color-purple);
  opacity: 0.7;
  text-transform: none;
}

/* Changelog Specific Styles */
.modal-changelog {
  max-width: 600px;
  max-height: 80vh;
}

.changelog-content {
  overflow-y: auto;
  padding-right: 0.5rem;
}

.changelog-content h3 {
  color: var(--color-yellow);
  font-family: var(--font-display);
  font-size: 0.9rem;
  margin: 1.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.changelog-content h3:first-child {
  margin-top: 0;
}

.changelog-content ul {
  list-style: none;
  padding-left: 1rem;
}

.changelog-content li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
  line-height: 1.4;
}

.changelog-content li::before {
  content: "»";
  position: absolute;
  left: -1rem;
  color: var(--color-cyan);
}

/* About Modal Styling */
.modal-about {
  max-width: 600px;
  max-height: 85vh;
}

.about-content {
  overflow-y: auto;
}

.about-section {
  margin-bottom: 2rem;
}

.about-section h3 {
  color: var(--color-cyan);
  font-family: var(--font-display);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.about-section p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.about-list {
  padding-left: 1.5rem;
}

.about-list li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.about-list li strong {
  color: var(--color-yellow);
  font-family: var(--font-display);
  font-size: 0.65rem;
  display: block;
  margin-bottom: 0.25rem;
}

/* How It Works - Main Section */
.how-it-works-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.6s ease-out;
}

.how-it-works-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2rem;
}

.how-section h3 {
  color: var(--color-yellow);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
}

.how-section p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.6;
}

.how-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.how-list li {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.4;
  position: relative;
  padding-left: 1rem;
}

.how-list li::before {
  content: "»";
  position: absolute;
  left: 0;
  color: var(--color-cyan);
}

.how-list li strong {
  color: var(--color-pink);
  text-transform: uppercase;
  font-size: 0.6rem;
  margin-right: 4px;
}

@media (max-width: 768px) {
  .how-it-works-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Category Selector (Form) */
.category-selector {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.category-btn {
  flex: 1;
  padding: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.category-btn.active {
  background: rgba(0, 255, 255, 0.1);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}
