/*========================================
    UNDERGROUND CHAT - OPTIMIZED STYLESHEET
========================================*/

/* Base Resets & Theme Colors */
:root {
  --green: #5CFF72;
  --orange: #FF7A00;
  --red: #FF4D4D;
  --bg: #000000;
  --nav-bg: rgba(0, 0, 0, 0.85);
  --card-bg: #0a0a0a;
  --border-color: rgba(255, 255, 255, 0.1);
  --transition-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  padding-bottom: 90px;
}

/* Ambient FX & Backgrounds (GPU Accelerated) */
#graffiti-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('assets/svg/graffiti-wall.svg');
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  transition: transform 0.2s var(--transition-smooth);
  will-change: transform;
}

#mouse-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92, 255, 114, 0.12) 0%, rgba(255, 122, 0, 0.05) 45%, transparent 70%);
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  transition: transform 0.05s linear;
  will-change: transform;
}

/* 📱 MOBILE FLOATING TOP BAR */
.mobile-top-bar {
  display: none;
  position: fixed;
  top: 14px;
  left: 0;
  width: 100%;
  padding: 0 16px;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  pointer-events: none;
}

.mobile-top-bar * {
  pointer-events: auto;
}

/* Mobile Profile Pic (Top Left) */
.mobile-profile-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--green);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  transition: transform 0.3s var(--transition-smooth);
  text-decoration: none;
  will-change: transform;
}

.mobile-profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-profile-btn:active {
  transform: translate3d(0, 0, 0) scale(0.92);
}

/* Mobile Logout Button (Top Right) */
.mobile-logout-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(18, 18, 18, 0.85);
  border: 1px solid rgba(255, 77, 77, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  transition: all 0.3s var(--transition-smooth);
}

.mobile-logout-btn img {
  width: 20px;
  height: 20px;
}

.mobile-logout-btn:active {
  transform: translate3d(0, 0, 0) scale(0.92);
  background: rgba(255, 77, 77, 0.25);
}

/* 💻 DESKTOP NAVIGATION HEADER */
header {
  width: 100%;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--nav-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Desktop Profile Avatar (Top Left) */
.desktop-profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--green);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s ease;
  will-change: transform;
}

.desktop-profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.desktop-profile-btn:hover {
  transform: translate3d(0, 0, 0) scale(1.08);
  box-shadow: 0 0 15px rgba(92, 255, 114, 0.4);
}

.logo {
  font-family: 'Permanent Marker', cursive;
  font-size: 1.7rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1px;
  transition: transform 0.3s var(--transition-smooth);
  will-change: transform;
}

.logo:hover {
  transform: translate3d(0, 0, 0) scale(1.05) rotate(-1deg);
}

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

/* Desktop Nav Links */
.desktop-nav {
  display: flex;
  gap: 12px;
  list-style: none;
  align-items: center;
}

.desktop-nav li a {
  color: #aaa;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s var(--transition-smooth);
  will-change: transform;
}

.desktop-nav li a .nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.desktop-nav li a:hover .nav-icon,
.desktop-nav li a.active .nav-icon {
  opacity: 1;
  transform: scale(1.1);
}

.desktop-nav li a:hover,
.desktop-nav li a.active {
  color: var(--green);
  background: rgba(92, 255, 114, 0.08);
  transform: translate3d(0, -2px, 0);
}

/* Desktop Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn .join {
  background: var(--green);
  color: #000000;
  padding: 10px 22px;
  border-radius: 30px;
  font-weight: 800;
  text-decoration: none;
  transition: all 0.3s var(--transition-smooth);
  box-shadow: 0 0 15px rgba(92, 255, 114, 0.3);
  display: inline-block;
  will-change: transform;
}

.nav-btn .join:hover {
  transform: translate3d(0, -3px, 0) scale(1.03);
  box-shadow: 0 0 25px rgba(92, 255, 114, 0.6);
}

.desktop-logout-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 77, 77, 0.1);
  border: 1px solid rgba(255, 77, 77, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
  will-change: transform;
}

.desktop-logout-btn img {
  width: 18px;
  height: 18px;
}

.desktop-logout-btn:hover {
  background: rgba(255, 77, 77, 0.25);
  border-color: var(--red);
  transform: translate3d(0, 0, 0) scale(1.08);
  box-shadow: 0 0 15px rgba(255, 77, 77, 0.4);
}

/* Hero Section */
.hero {
  max-width: 1100px;
  margin: 140px auto 40px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 10;
  animation: fadeInUp 0.8s var(--transition-smooth);
  will-change: transform, opacity;
}

.badge-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.badge {
  border: 1px solid var(--orange);
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: rgba(255, 122, 0, 0.08);
  transition: all 0.3s ease;
  will-change: transform;
}

.badge:hover {
  background: rgba(255, 122, 0, 0.2);
  transform: scale(1.05);
}

.rating-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.3s ease;
  will-change: transform;
}

.rating-box:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translate3d(0, -2px, 0);
}

.rating-stars { color: #FFD400; }
.rating-score { color: #fff; }

.hero-title {
  font-size: clamp(2.2rem, 7vw, 5.2rem);
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: -1px;
}

.hero-title .desktop-title { display: inline; }
.hero-title .mobile-title { display: none; }

.hero-title .highlight {
  font-family: 'Permanent Marker', cursive;
  color: var(--green);
  text-shadow: 0 0 20px rgba(92, 255, 114, 0.4);
  display: inline-block;
  transition: transform 0.3s var(--transition-smooth);
  will-change: transform;
}

.hero-title .highlight:hover {
  transform: translate3d(0, 0, 0) scale(1.08) rotate(-2deg);
}

.hero-description {
  color: #a5a5a5;
  font-size: 0.98rem;
  max-width: 520px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
}

.btn-primary {
  flex: 1;
  background: var(--green);
  color: #000000;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 40px;
  text-decoration: none;
  box-shadow: 0 0 25px rgba(92, 255, 114, 0.35);
  transition: all 0.3s var(--transition-smooth);
  will-change: transform;
}

.btn-primary:hover {
  transform: translate3d(0, -4px, 0) scale(1.02);
  box-shadow: 0 0 35px rgba(92, 255, 114, 0.65);
}

.btn-secondary {
  flex: 1;
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 40px;
  text-decoration: none;
  transition: all 0.3s var(--transition-smooth);
  will-change: transform;
}

.btn-secondary:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: translate3d(0, -4px, 0) scale(1.02);
}

/* =========================================
   PUBLISH A BOOK COMPOSER CARD
========================================= */
.publish-book-card {
  width: 100%;
  max-width: 400px;
  margin-bottom: 28px;
}

.publish-book-link {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 18, 18, 0.9);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: 30px;
  text-decoration: none;
  color: #888;
  font-size: 0.95rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  transition: all 0.3s var(--transition-smooth);
}

.publish-book-link:hover {
  border-color: var(--green);
  color: #fff;
  background: rgba(25, 25, 25, 0.95);
  transform: translate3d(0, -2px, 0);
  box-shadow: 0 0 20px rgba(92, 255, 114, 0.15);
}

.publish-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--green);
  object-fit: cover;
}

/* Chat Mockup Card (GPU Accelerated) */
.chat-mockup {
  width: 100%;
  max-width: 400px;
  background: #0a0a0a;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(92, 255, 114, 0.1);
  position: relative;
  transition: transform 0.4s var(--transition-smooth), border-color 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.chat-mockup:hover {
  transform: translate3d(0, -6px, 0) scale(1.02);
  border-color: rgba(92, 255, 114, 0.4);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 1), 0 0 35px rgba(92, 255, 114, 0.25);
}

.crown-badge {
  position: absolute;
  top: -18px;
  right: 20px;
  width: 38px;
  height: 38px;
  background: #000000;
  border: 2px solid var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(92, 255, 114, 0.4);
  transition: transform 0.3s ease;
  will-change: transform;
}

.chat-mockup:hover .crown-badge {
  transform: rotate(15deg) scale(1.1);
}

.crown-badge img {
  width: 20px;
  height: 20px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  max-width: 85%;
  position: relative;
  transition: transform 0.2s ease;
  will-change: transform;
}

.msg:hover { transform: scale(1.02); }

.msg-incoming {
  background: #121212;
  color: #ddd;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-outgoing {
  background: var(--green);
  color: #000000;
  font-weight: 700;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* =========================================
   BOOKS SECTIONS & FEED GRID
========================================= */
.books-feed,
.popular-books {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.feed-header,
.popular-books h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-left: 4px solid var(--green);
  padding-left: 12px;
}

.feed-header h2,
.popular-books h2 {
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#booksContainer,
#popularBooks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* Book Card Component */
.book-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s var(--transition-smooth);
  text-decoration: none;
  color: #fff;
  position: relative;
}

.book-card:hover {
  transform: translate3d(0, -6px, 0);
  border-color: rgba(92, 255, 114, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(92, 255, 114, 0.15);
}

.book-cover-wrapper {
  width: 100%;
  height: 260px;
  overflow: hidden;
  position: relative;
  background: #141414;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--transition-smooth);
}

.book-card:hover .book-cover {
  transform: scale(1.05);
}

.book-badge-paid {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--orange);
  color: #000;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 12px;
}

.book-badge-free {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--green);
  color: #000;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 12px;
}

.book-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-author {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 12px;
}

.book-stats {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #aaa;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
  z-index: 1000;
  animation: slideUp 0.5s var(--transition-smooth);
  will-change: transform;
}

.mobile-bottom-nav a {
  color: #888;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.3s var(--transition-smooth);
}

.mobile-bottom-nav a .nav-icon {
  width: 22px;
  height: 22px;
  transition: transform 0.3s var(--transition-smooth);
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav a.active {
  color: var(--green);
}

.mobile-bottom-nav a:hover .nav-icon,
.mobile-bottom-nav a.active .nav-icon {
  transform: translate3d(0, -3px, 0) scale(1.1);
}

/* Keyframes */
@keyframes fadeInUp {
  from { opacity: 0; transform: translate3d(0, 20px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes slideUp {
  from { transform: translate3d(0, 100%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

/* Responsive Queries */
@media (max-width: 768px) {
  .mobile-top-bar {
    top: 28px !important;
  }
  header { display: none !important; }
  .mobile-top-bar { display: flex; }
  .hero-title .desktop-title { display: none; }
  .hero-title .mobile-title {
    display: inline;
    font-family: 'Permanent Marker', cursive;
    letter-spacing: 0.5px;
  }
  .mobile-bottom-nav { display: flex; }
  .hero { margin-top: -70px; margin-bottom: 30px; }
  .hero-buttons { flex-direction: column; }
  
  #booksContainer,
  #popularBooks {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .book-cover-wrapper {
    height: 190px;
  }
}
