/* ============================================================
   Rocket by SpaceIntel.xyz — Global Styles
   Dark theme · Space Grotesk · Rocket branding
   ============================================================ */

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

:root {
  --bg:          #0a0a0b;
  --bg-card:     #131316;
  --bg-elevated: #1a1a1f;
  --bg-input:    #1e1e24;
  --border:      #2a2a32;
  --text:        #e4e4e7;
  --text-muted:  #71717a;
  --accent:      #7c3aed;
  --accent-hover:#6d28d9;
  --accent-soft: rgba(124,58,237,.12);
  --red:         #ef4444;
  --green:       #22c55e;
  --orange:      #f97316;
  --radius:      12px;
  --radius-sm:   8px;
  --font:        'Space Grotesk', system-ui, sans-serif;
  --nav-h:       64px;
  --max-w:       1280px;
  --transition:  .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

img, video { max-width: 100%; display: block; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

button { cursor: pointer; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Utility ---------- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(10,10,11,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.nav-inner {
  width: 100%; max-width: var(--max-w);
  margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; color: var(--text); }
.nav-logo:hover { color: var(--text); }
.nav-logo svg { width: 32px; height: 32px; }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-elevated); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: .875rem; transition: all var(--transition); border: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 8px 14px; }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* User avatar in nav */
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: box-shadow var(--transition);
}
.nav-avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Mobile hamburger */
.hamburger { display: none; background: none; border: none; flex-direction: column; gap: 5px; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }
.mobile-menu {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 99; flex-direction: column; padding: 24px;
  gap: 4px;
}
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 14px 16px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; }
.mobile-menu a:hover, .mobile-menu a.active { background: var(--bg-elevated); color: var(--text); }

/* ---------- Main content area ---------- */
main { flex: 1; padding-top: 32px; padding-bottom: 64px; }

/* ---------- Auth page (index.html) ---------- */
.auth-wrapper {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 32px;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.auth-logo svg { width: 48px; height: 48px; }
.auth-logo span { font-size: 1.75rem; font-weight: 700; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: .95rem; }

/* Tabs */
.auth-tabs { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 12px; text-align: center; font-weight: 600;
  color: var(--text-muted); background: none; border: none; border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.form-input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

.google-btn {
  width: 100%; padding: 12px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-weight: 600; color: var(--text);
  transition: all var(--transition);
}
.google-btn:hover { border-color: var(--accent); background: var(--bg-elevated); }
.google-btn svg { width: 20px; height: 20px; }

.divider {
  display: flex; align-items: center; gap: 16px;
  margin: 24px 0; color: var(--text-muted); font-size: .8rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-error { color: var(--red); font-size: .85rem; margin-bottom: 16px; text-align: center; display: none; }
.auth-error.show { display: block; }

/* ---------- Page Header ---------- */
.page-header {
  padding: 24px 0; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ---------- Video Grid (main.html) ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.video-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.video-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.video-thumb {
  position: relative; width: 100%; padding-top: 56.25%;
  background: var(--bg-elevated); overflow: hidden;
}
.video-thumb img, .video-thumb video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
}
.video-duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.8); padding: 2px 8px; border-radius: 4px;
  font-size: .75rem; font-weight: 600;
}
.video-info { padding: 16px; display: flex; gap: 12px; }
.video-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.video-meta h3 { font-size: .95rem; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.video-meta p { font-size: .8rem; color: var(--text-muted); }

/* ---------- Filter / Search bar ---------- */
.search-bar {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 200px; padding: 10px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
}
.search-input:focus { border-color: var(--accent); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 16px; border-radius: 20px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted); cursor: pointer;
  transition: all var(--transition);
}
.chip:hover, .chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Chat / Posts (submain.html) ---------- */
.chat-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.posts-feed { display: flex; flex-direction: column; gap: 16px; }
.post-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color var(--transition);
}
.post-card:hover { border-color: var(--accent); }
.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.post-author { font-weight: 600; font-size: .9rem; }
.post-time { font-size: .8rem; color: var(--text-muted); }
.post-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.post-body { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }
.post-actions { display: flex; gap: 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.post-action {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-muted);
  font-size: .85rem; cursor: pointer; transition: color var(--transition);
}
.post-action:hover { color: var(--accent); }
.post-action svg { width: 18px; height: 18px; }

/* Sidebar */
.sidebar-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.sidebar-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 16px; }
.trending-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.trending-item:last-child { border-bottom: none; }
.trending-item .tag { color: var(--accent); font-size: .8rem; font-weight: 600; }
.trending-item .title { font-size: .9rem; margin-top: 2px; }
.trending-item .count { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Books (subsub.html) ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}
.book-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.book-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.book-cover {
  width: 100%; height: 280px; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .placeholder-icon { color: var(--text-muted); opacity: .3; }
.book-info { padding: 16px; }
.book-info h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.book-info .author { font-size: .8rem; color: var(--text-muted); margin-bottom: 8px; }
.book-info .book-meta { display: flex; align-items: center; justify-content: space-between; }
.book-info .rating { color: var(--orange); font-size: .85rem; font-weight: 600; }
.book-info .download-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent);
  font-size: .8rem; font-weight: 600; border: none; cursor: pointer;
  transition: all var(--transition);
}
.book-info .download-btn:hover { background: var(--accent); color: #fff; }

/* ---------- Upload (subdev.html) ---------- */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 60px 40px; text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 16px; }
.upload-zone h3 { margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: .9rem; }
.upload-zone .file-types { font-size: .8rem; color: var(--text-muted); margin-top: 8px; }

.upload-form { max-width: 640px; margin: 0 auto; }
.upload-form .form-group { margin-bottom: 20px; }
.upload-preview {
  width: 100%; max-height: 300px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); overflow: hidden; margin-top: 16px;
}
.upload-preview video, .upload-preview img { width: 100%; max-height: 300px; object-fit: contain; }

.progress-bar {
  width: 100%; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-top: 12px; display: none;
}
.progress-bar.show { display: block; }
.progress-bar .fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0%; transition: width .3s ease; }

/* ---------- About page ---------- */
.about-hero {
  text-align: center; padding: 80px 24px;
  border-bottom: 1px solid var(--border);
}
.about-hero .rocket-icon { margin-bottom: 24px; }
.about-hero .rocket-icon svg { width: 80px; height: 80px; color: var(--accent); }
.about-hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 12px; }
.about-hero p { color: var(--text-muted); max-width: 600px; margin: 0 auto; font-size: 1.1rem; }

.about-section { padding: 60px 0; }
.about-section h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.about-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.about-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.about-card p { color: var(--text-muted); font-size: .9rem; line-height: 1.7; }

.creator-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.creator-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; text-align: center;
}
.creator-avatar {
  width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.25rem; color: #fff;
}
.creator-card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.creator-card .role { color: var(--accent); font-size: .85rem; font-weight: 600; margin-bottom: 12px; }
.creator-card p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: auto;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer-brand svg { width: 24px; height: 24px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); font-size: .85rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-muted); font-size: .8rem; }

/* ---------- Toast notification ---------- */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-size: .9rem;
  animation: slideIn .3s ease;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 150; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  width: 90%; max-width: 500px;
  transform: translateY(20px); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h2 { margin-bottom: 16px; }
.modal-close { float: right; background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links, .nav-right .btn { display: none; }
  .hamburger { display: flex; }
  .video-grid { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .about-hero h1 { font-size: 1.75rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .search-bar { flex-direction: column; }
}