/* ============================================
   SPACE WEBSITE — MAIN STYLESHEET
   ============================================ */

/* --- VARIABLES & THEME --- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --accent: #4f8ef7;
  --accent-hover: #3a7ae0;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --border: #2a2a3e;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Light mode */
[data-theme="light"] {
  --bg-primary: #f0f4ff;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text-primary: #0f0f1a;
  --text-secondary: #4a4a6a;
  --text-muted: #9090a0;
  --border: #e0e4f0;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* --- READING PROGRESS BAR --- */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s;
}

/* --- NAVIGATION --- */
nav {
  position: sticky;
  top: 0;
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  padding: 0 1.5rem;
}

[data-theme="light"] nav {
  background: rgba(240,244,255,0.95);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- THEME TOGGLE --- */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--border);
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-card);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

/* --- LAYOUT --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

/* --- HERO --- */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('');
  background-size: cover;
  background-position: center;
  opacity: 0.4;
  transition: opacity 0.5s;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  padding: 2rem 1.5rem;
}

.hero-badge {
  display: inline-block;
  background: rgba(79,142,247,0.15);
  color: var(--accent);
  border: 1px solid rgba(79,142,247,0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 550px;
}

/* --- CARDS --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.card-body {
  padding: 1.25rem;
}

.card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- GRID --- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* --- TAGS & BADGES --- */
.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tag:hover, .tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- SEARCH BAR --- */
.search-wrap {
  position: relative;
  max-width: 500px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* --- ARTICLE PAGE --- */
.article-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.article-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.article-body {
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--text-secondary);
  max-width: 720px;
}

.article-body h2 {
  font-size: 1.6rem;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
}

.article-body h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body img {
  border-radius: var(--radius);
  margin: 2rem 0;
}

/* --- ARTICLE ACTIONS --- */
.article-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 2rem 0;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.active {
  background: rgba(79,142,247,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- RECOMMENDATIONS --- */
.recommendations {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s, transform 0.6s;
}

.recommendations.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* --- COMMENTS --- */
.comments-section {
  padding: 2rem 0;
}

.comment {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.comment-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-date {
  font-size: 0.8rem;
}
.comment-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.comment-text a {
  color: var(--accent);
}

.comment-form {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  margin-bottom: 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent);
}

.comment-form textarea {
  resize: vertical;
  min-height: 100px;
}

/* --- PROFILE PAGE --- */
.profile-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  min-height: calc(100vh - 64px);
}

.profile-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  height: fit-content;
  position: sticky;
  top: 64px;
}

.profile-header {
  text-align: center;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #fff;
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.profile-badge {
  display: inline-block;
  background: rgba(79,142,247,0.15);
  color: var(--accent);
  border: 1px solid rgba(79,142,247,0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- ADMIN --- */
.admin-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  min-height: calc(100vh - 64px);
}

.admin-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.admin-nav-item:hover, .admin-nav-item.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.admin-content {
  padding: 2rem;
}

/* --- FORM ELEMENTS --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

/* --- TOAST NOTIFICATIONS --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success);
  color: #fff;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-info {
  background: var(--accent);
  color: #fff;
}

/* --- BACK TO TOP --- */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- LOADING SKELETON --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- APOD SECTION --- */
.apod-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 3rem;
}

.apod-image {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
}

.apod-body {
  padding: 1.5rem;
}

.apod-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.apod-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.apod-explanation {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- FOOTER --- */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  max-width: 260px;
}

.footer-heading {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 1.5rem 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- LOGIN PAGE --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- EMPTY STATE --- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* --- 404 PAGE --- */
.page-404 {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.page-404 h1 {
  font-size: 8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 1rem;
}
/* --- MOBILE --- */
/* --- HAMBURGER BUTTON --- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 0.5rem;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease-in-out;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}
/* ============================================
   MOBILE RESPONSIVE FIXES (under 768px)
   Fixes all 6 bugs without touching desktop
   ============================================ */

@media (max-width: 768px) {
  /* --- FIX #1: LOGIN BUTTON SPINNER OVAL --- */
  /* Make spinner circular and prevent squishing */
  .spinner {
    width: 20px !important;
    height: 20px !important;
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
    border: 2px solid rgba(0,0,0,0.2) !important;
    border-top-color: #1a1a1a !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
  }

  .google-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    width: 100% !important;
    padding: 0.9rem 1.5rem !important;
  }

  /* --- FIX #2: HERO SECTION HEADER OVERLAP --- */
  /* Add proper spacing below sticky nav */
  .hero {
    min-height: calc(100vh - 64px) !important;
    margin-top: 0 !important;
    padding-top: 2rem !important;
  }

  .section {
    padding: 2rem 0 !important;
  }

  /* --- FIX #3: HAMBURGER MENU ALIGNMENT & SMOOTHNESS --- */
  .hamburger {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .hamburger span {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
  }

  .nav-links {
    display: none !important;
    position: absolute !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border) !important;
    flex-direction: column !important;
    padding: 1rem 1.5rem !important;
    gap: 0 !important;
    z-index: 999 !important;
    animation: slideDown 0.3s ease-out !important;
  }

  .nav-links.mobile-open {
    display: flex !important;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-links li {
    padding: 0.75rem 0 !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .nav-links li:last-child {
    border-bottom: none !important;
  }

  .nav-links a {
    font-size: 1rem !important;
    display: block !important;
  }

  /* --- FIX #4: FOOTER TEXT WRAPPING & STACKING --- */
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1rem !important;
  }

  .footer-brand p {
    max-width: 100% !important;
    margin: 0 auto !important;
  }

  /* --- FIX #5: PROFILE NAVIGATION ICONS SQUISHING --- */
  /* Bottom navigation bar spacing */
  [class*="nav-bottom"],
  [class*="tab-nav"],
  .profile-nav,
  .bottom-nav {
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 1rem 0.5rem !important;
  }

  [class*="nav-bottom"] a,
  [class*="tab-nav"] a,
  .profile-nav a,
  .bottom-nav a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex: 1 !important;
    padding: 0.5rem !important;
    text-align: center !important;
    flex-shrink: 0 !important;
  }

  [class*="nav-bottom"] span,
  [class*="tab-nav"] span,
  .profile-nav span,
  .bottom-nav span {
    font-size: 1.5rem !important;
  }

  /* --- FIX #6: PROFILE AVATAR OVAL SHAPE --- */
  /* Make avatar perfectly circular and prevent stretching */
  .profile-avatar {
    width: 80px !important;
    height: 80px !important;
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    margin: 0 auto 1rem !important;
  }

  /* All profile images should be circular */
  img[referrerpolicy="no-referrer"] {
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    border-radius: 50% !important;
  }

  /* --- ADDITIONAL MOBILE OPTIMIZATIONS --- */
  .profile-wrapper {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .profile-sidebar {
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 1.5rem !important;
    position: static !important;
    height: auto !important;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }

  .admin-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-sidebar {
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .hero h1 {
    font-size: 1.8rem !important;
  }

  .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .grid-3 {
    grid-template-columns: 1fr !important;
  }

  .toast {
    bottom: 1rem !important;
    right: 1rem !important;
    left: 1rem !important;
  }

  #back-to-top {
    bottom: 1rem !important;
    left: 1rem !important;
  }

  .auth-card {
    padding: 1.5rem !important;
  }

  .auth-title {
    font-size: 1.5rem !important;
  }

  .search-input {
    font-size: 16px !important;
  }
}

/* --- EXTRA SMALL DEVICES (under 480px) --- */
@media (max-width: 480px) {
  .nav-logo {
    font-size: 1rem !important;
  }

  .hero h1 {
    font-size: 1.5rem !important;
  }

  .profile-avatar {
    width: 70px !important;
    height: 70px !important;
  }

  .auth-card {
    padding: 1.25rem !important;
  }

  .footer-inner {
    padding: 0 0.75rem !important;
  }

  .container {
    padding: 0 1rem !important;
  }

  nav {
    padding: 0 1rem !important;
  }
}

/* --- PRINT STYLES --- */
@media print {
  nav, footer, .article-actions,
  .recommendations, .comments-section,
  #back-to-top, #progress-bar {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .article-body {
    max-width: 100%;
  }
}
