/* ========================================
TechRepair.Co V7 - Shared Styles
Common styles for navbar, footer, starfield, and base layout
======================================== */

/* CSS Variables */
:root {
  --bg-primary: #050508;
  --bg-card: rgba(15, 20, 30, 0.9);
  --accent: #00d4ff;
  --accent-secondary: #00a8ff;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-glow: rgba(0, 212, 255, 0.2);
}

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Starfield Canvas - All pages share this */
#starfield,
#objects-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -999;
  pointer-events: none;
  contain: strict; /* Performance optimization */
  will-change: transform; /* GPU acceleration hint */
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  #starfield,
  #objects-canvas {
    display: none;
  }
}

/* Content visibility - render only when near viewport */
.section,
.hero,
.guide-card,
.tool-card,
.calc-preview-card,
.tutorial-card,
.electronics-card {
  content-visibility: auto;
  contain-intrinsic-size: 0 300px;
}

/* Mobile-specific performance */
@media (max-width: 768px) {
  /* Disable heavy effects on mobile */
  .card,
  .tool-card,
  .calc-preview-card,
  .guide-card {
    transform: none !important;
    transition: opacity 0.2s ease;
    will-change: auto;
  }

  /* Simplify hover states */
  .card:hover,
  .tool-card:hover,
  .calc-preview-card:hover,
  .guide-card:hover {
    transform: none !important;
    box-shadow: none;
  }

  /* Disable backdrop-filter on mobile (GPU intensive) */
  .navbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Optimize font rendering */
  body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
  }

  /* Touch-friendly buttons */
  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Disable sticky positioning issues */
  .forum-sidebar {
    position: relative;
    top: 0;
  }
}

/* Reduce motion for battery saving */
@media (prefers-reduced-motion: reduce), (dynamic-range: standard) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Disable parallax */
  .guide-card,
  .tool-card {
    transform: none !important;
  }
}

/* ========================================
Navigation
======================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(5, 5, 8, 0.98);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.logo-icon-img {
  height: 40px;
  width: auto;
  border-radius: 10px;
  object-fit: cover;
}

.logo-text {
  font-weight: 700;
  font-size: 1.3rem;
  background: linear-gradient(135deg, white, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.login-btn {
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border: none;
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.login-btn:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.2s;
}

/* ========================================
Main Layout
======================================== */
main {
  padding-top: 90px;
  padding-bottom: 60px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-header {
  text-align: center;
  padding: 40px 0 60px;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 16px;
  background: linear-gradient(135deg, white, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ========================================
Footer
======================================== */
.footer {
  background: rgba(5, 5, 8, 0.98);
  border-top: 1px solid var(--border-glow);
  padding: 40px 24px;
  text-align: center;
}

.footer p {
  color: var(--text-muted);
}

/* ========================================
Common Components
======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: var(--bg-primary);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}

.btn-secondary:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.section-title {
  font-size: 1.5rem;
  margin: 60px 0 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title i {
  color: var(--accent);
}

/* Card Styles */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s;
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.4);
  transform: translateY(-3px);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 24px;
    gap: 8px;
    border-bottom: 1px solid var(--border-glow);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
  }

  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    text-align: center;
    justify-content: center;
  }

  .login-btn {
    width: 100%;
    margin-top: 8px;
  }
}

/* ========================================
Footer Extended (Full Layout) - Added
======================================== */
.footer-extended {
background: rgba(5, 5, 8, 0.95);
border-top: 1px solid var(--border-glow);
padding: 60px 24px 24px;
}

.footer-grid {
display: grid;
grid-template-columns: 2fr repeat(3, 1fr);
gap: 40px;
margin-bottom: 40px;
}

.footer-links h4 {
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
color: white;
margin-bottom: 16px;
}

.footer-links a {
display: block;
color: var(--text-muted);
text-decoration: none;
padding: 6px 0;
font-size: 0.9rem;
transition: color 0.2s;
}

.footer-links a:hover {
color: var(--accent);
}

.footer-brand {
margin-bottom: 16px;
display: inline-flex;
}

.footer-brand-text {
color: var(--text-muted);
font-size: 0.9rem;
line-height: 1.7;
}

.footer-copyright {
color: var(--text-muted);
font-size: 0.85rem;
text-align: center;
padding-top: 24px;
border-top: 1px solid var(--border-glow);
}

@media (max-width: 768px) {
.footer-grid {
grid-template-columns: repeat(2, 1fr);
}
}

@media (max-width: 480px) {
.footer-grid {
grid-template-columns: 1fr;
}
}
