:root {
  --bg: #09090b;
  --panel: #101014;
  --border: rgba(255,255,255,0.10);
  --text: #ffffff;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --accent: #22c55e;
  --accent-hover: #4ade80;
  --danger: #dc2626;
  --shadow: 0 20px 50px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }

.app {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(34,197,94,0.15), transparent 30%),
    radial-gradient(circle at top left, rgba(59,130,246,0.10), transparent 28%),
    var(--bg);
}

.sidebar {
  position: fixed; top: 0; left: 0; width: 268px; height: 100vh;
  background: rgba(16,16,20,0.96); border-right: 1px solid var(--border);
  padding: 22px; display: flex; flex-direction: column; gap: 28px; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 17px; background: var(--accent); color: #020617;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px;
}
.brand h1 { font-size: 23px; line-height: 1; letter-spacing: -0.05em; }
.brand p { color: var(--muted-2); font-size: 12px; margin-top: 4px; }

.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a {
  color: #d4d4d8; padding: 13px 14px; border-radius: 18px; font-size: 15px; transition: 0.2s ease;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.09); color: #fff; }

.side-card {
  margin-top: auto; padding: 18px; border-radius: 24px; background: rgba(255,255,255,0.045); border: 1px solid var(--border);
}
.side-card h3 { font-size: 16px; margin-bottom: 8px; }
.side-card p { font-size: 13px; line-height: 1.5; color: var(--muted); margin-bottom: 16px; }

.main { margin-left: 268px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  padding: 18px 32px; background: rgba(9,9,11,0.86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.mobile-menu {
  display: none; width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border);
  background: rgba(255,255,255,0.07); color: #fff; font-size: 22px; cursor: pointer;
}
.search-wrap { flex: 1; max-width: 680px; position: relative; }
.search-wrap input {
  width: 100%; border: 1px solid var(--border); background: rgba(255,255,255,0.055); color: #fff;
  border-radius: 18px; padding: 14px 16px 14px 44px; outline: none; font-size: 14px;
}
.search-wrap input:focus { border-color: rgba(34,197,94,0.75); }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.primary-btn, .secondary-btn, .join-btn, .watch-btn, .small-btn, .danger-btn {
  border: none; border-radius: 16px; padding: 12px 16px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s ease;
}
.primary-btn, .join-btn { background: var(--accent); color: #020617; }
.primary-btn:hover, .join-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.secondary-btn { border: 1px solid var(--border); background: rgba(255,255,255,0.07); color: #fff; }
.secondary-btn:hover { background: rgba(255,255,255,0.12); }
.danger-btn { background: rgba(220,38,38,0.14); color: #fecaca; border: 1px solid rgba(220,38,38,0.35); }
.small-btn { padding: 8px 11px; font-size: 12px; background: rgba(255,255,255,0.09); color: #fff; }
.small-btn:hover { background: var(--accent); color: #020617; }

.content { padding: 32px; padding-bottom: 90px; }
.hero {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 28px; align-items: center;
  padding: 34px; border-radius: 36px; background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025));
  border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(34,197,94,0.12); color: #86efac;
  border: 1px solid rgba(34,197,94,0.35); padding: 9px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800; margin-bottom: 18px;
}
.hero h2, .page-hero h2 {
  max-width: 830px; font-size: clamp(38px, 6vw, 72px); line-height: 0.96; letter-spacing: -0.07em; margin-bottom: 18px;
}
.hero p, .page-hero p { color: var(--muted); font-size: 18px; line-height: 1.65; max-width: 700px; margin-bottom: 24px; }
.hero-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.featured-shell { padding: 5px; border-radius: 32px; background: linear-gradient(135deg, #22c55e, #06b6d4, #8b5cf6); box-shadow: var(--shadow); }
.featured { border-radius: 28px; background: rgba(0,0,0,0.58); padding: 18px; }
.video-box {
  aspect-ratio: 16 / 10; border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.02)), radial-gradient(circle at center, rgba(34,197,94,0.22), transparent 42%), #101014;
  padding: 18px; position: relative; overflow: hidden;
}
.video-large { aspect-ratio: 16 / 9; border-radius: 28px; min-height: 360px; }
.video-frame {
  width: 100%; aspect-ratio: 16 / 9; border: none; border-radius: 28px; display: block; background: #000; box-shadow: var(--shadow);
}
.video-top, .thumb-top { display: flex; justify-content: space-between; align-items: center; }
.live-badge { background: var(--danger); color: #fff; font-size: 11px; font-weight: 900; padding: 6px 10px; border-radius: 999px; }
.viewers-badge { background: rgba(0,0,0,0.4); color: #fff; font-size: 12px; font-weight: 700; padding: 7px 10px; border-radius: 999px; }
.play-circle {
  width: 86px; height: 86px; border-radius: 50%; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 34px; position: absolute; inset: 0; margin: auto; backdrop-filter: blur(12px);
}
.featured-meta { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.avatar, .creator-avatar {
  border-radius: 18px; background: var(--accent); color: #020617; display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.avatar { width: 44px; height: 44px; }
.creator-avatar { width: 92px; height: 92px; font-size: 36px; }
.featured-meta h4 { font-size: 16px; margin-bottom: 3px; }
.featured-meta p { color: var(--muted); font-size: 13px; }

.categories { display: flex; gap: 10px; overflow-x: auto; padding: 28px 0 10px; }
.categories button {
  border: none; white-space: nowrap; padding: 12px 18px; border-radius: 16px;
  background: rgba(255,255,255,0.08); color: #fff; font-weight: 800; cursor: pointer; transition: 0.2s ease;
}
.categories button:hover, .categories button.active { background: var(--accent); color: #020617; }

.section-title { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 30px 0 18px; }
.section-title h3 { font-size: 28px; letter-spacing: -0.04em; }
.section-title p { color: var(--muted); margin-top: 5px; }

.home-layout { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 24px; align-items: start; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4, .category-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }

.card, .info-card, .chat-panel, .profile-panel, .form-panel, .rank-panel, .category-card, .dashboard-card, .auth-card {
  background: rgba(255,255,255,0.045); border: 1px solid var(--border); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow);
}
.card { transition: 0.2s ease; }
.card:hover { transform: translateY(-3px); border-color: rgba(34,197,94,0.5); }
.thumb { aspect-ratio: 16 / 9; padding: 14px; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.thumb strong { text-align: center; font-size: 28px; letter-spacing: -0.05em; text-shadow: 0 6px 20px rgba(0,0,0,0.35); }
.bg-1 { background: linear-gradient(135deg, #7c3aed, #db2777); }
.bg-2 { background: linear-gradient(135deg, #059669, #0891b2); }
.bg-3 { background: linear-gradient(135deg, #ea580c, #dc2626); }
.bg-4 { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.bg-5 { background: linear-gradient(135deg, #c026d3, #7c3aed); }
.bg-6 { background: linear-gradient(135deg, #ca8a04, #ea580c); }
.bg-7 { background: linear-gradient(135deg, #0f766e, #16a34a); }
.bg-8 { background: linear-gradient(135deg, #be123c, #f97316); }

.card-body { padding: 16px; }
.card-body h4 { font-size: 18px; margin-bottom: 6px; letter-spacing: -0.03em; }
.creator { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-actions { display: flex; gap: 8px; }
.tag {
  background: rgba(255,255,255,0.08); color: #d4d4d8; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-style: normal; font-weight: 700;
}
.watch-btn { background: rgba(255,255,255,0.09); color: #fff; padding: 9px 12px; font-size: 13px; }
.watch-btn:hover { background: var(--accent); color: #020617; }
.empty-state {
  display: none; padding: 40px; border-radius: 24px; border: 1px solid var(--border); background: rgba(255,255,255,0.045);
  color: var(--muted); text-align: center; margin-top: 18px;
}

.page-hero {
  padding: 34px; border-radius: 36px; background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025));
  border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 24px;
}
.profile-layout, .watch-layout, .join-layout, .dashboard-layout, .auth-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; align-items: start; }
.creator-banner { min-height: 250px; border-radius: 32px; padding: 24px; display: flex; align-items: end; margin-bottom: -42px; }
.profile-card { padding: 0 24px 24px; }
.profile-header { display: flex; align-items: end; gap: 18px; margin-bottom: 18px; }
.profile-header h2 { font-size: 36px; letter-spacing: -0.05em; }
.profile-header p { color: var(--muted); margin-top: 4px; }

.platform-stats, .stats-row, .dashboard-stats { display: grid; gap: 16px; }
.platform-stats { grid-template-columns: repeat(4, minmax(0,1fr)); margin-top: 24px; }
.stats-row { grid-template-columns: repeat(3, 1fr); margin: 22px 0; }
.dashboard-stats { grid-template-columns: repeat(3, 1fr); }
.stat-box { padding: 16px; border-radius: 20px; background: rgba(255,255,255,0.055); border: 1px solid var(--border); }
.stat-box strong { display: block; font-size: 22px; }
.stat-box span { color: var(--muted); font-size: 13px; }

.info-card, .profile-panel, .chat-panel, .form-panel, .rank-panel, .dashboard-card, .auth-card { padding: 22px; }
.info-card h3, .profile-panel h3, .chat-panel h3, .form-panel h3, .rank-panel h3, .dashboard-card h3, .auth-card h3 {
  font-size: 22px; margin-bottom: 12px; letter-spacing: -0.04em;
}
.info-card p, .profile-panel p, .rank-panel p, .dashboard-card p, .auth-card p { color: var(--muted); line-height: 1.65; margin-bottom: 14px; }

.schedule-list, .social-list, .rank-list, .task-list { display: grid; gap: 10px; margin-top: 16px; }
.schedule-list div, .social-list a, .rank-item, .task-list div {
  padding: 13px; border-radius: 16px; background: rgba(255,255,255,0.055); border: 1px solid var(--border); color: #e4e4e7;
}
.rank-item { display: flex; align-items: center; gap: 12px; }
.rank-number {
  width: 28px; height: 28px; border-radius: 10px; background: var(--accent); color: #020617;
  display: flex; align-items: center; justify-content: center; font-weight: 900; flex: 0 0 auto;
}
.rank-item h4 { font-size: 14px; margin-bottom: 3px; }
.rank-item p { margin: 0; font-size: 12px; }

.watch-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0 22px; }
.watch-title-row h2 { font-size: 32px; letter-spacing: -0.05em; }
.chat-messages { display: grid; gap: 12px; max-height: 440px; overflow: auto; padding-right: 4px; }
.message { padding: 12px; background: rgba(255,255,255,0.055); border-radius: 16px; color: #e4e4e7; font-size: 14px; line-height: 1.45; }
.message strong { color: #86efac; }
.chat-input { display: flex; gap: 10px; margin-top: 16px; }
.chat-input input {
  flex: 1; border: 1px solid var(--border); background: rgba(255,255,255,0.055); color: #fff; border-radius: 16px; padding: 13px; outline: none;
}

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 8px; }
.form-row label { color: #e4e4e7; font-size: 14px; font-weight: 700; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; border: 1px solid var(--border); background: rgba(255,255,255,0.055); color: #fff; border-radius: 16px; padding: 13px; outline: none;
}
.form-row select option { color: #111827; }
.form-row textarea { min-height: 130px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: rgba(34,197,94,0.75); }
.form-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.success-box, .error-box {
  display: none; margin-top: 16px; padding: 16px; border-radius: 18px;
}
.success-box { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35); color: #bbf7d0; }
.error-box { background: rgba(220,38,38,0.12); border: 1px solid rgba(220,38,38,0.35); color: #fecaca; }

.category-card { min-height: 180px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; }
.category-card h3 { font-size: 28px; letter-spacing: -0.05em; }
.category-card p { color: rgba(255,255,255,0.82); line-height: 1.5; }

.install-banner {
  display: none; position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: 380px; padding: 18px;
  border-radius: 24px; background: rgba(16,16,20,0.96); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.install-banner h3 { font-size: 17px; margin-bottom: 7px; }
.install-banner p { color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 14px; }
.install-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(9,9,11,0.92);
  backdrop-filter: blur(14px); border-top: 1px solid var(--border);
}
.bottom-nav a {
  flex: 1; padding: 9px 4px; border-radius: 14px; color: #d4d4d8; font-size: 11px; text-align: center; display: grid; gap: 3px;
}
.bottom-nav a.active, .bottom-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }

.footer-note { color: var(--muted-2); text-align: center; padding: 34px 20px 10px; font-size: 13px; }

@media (max-width: 1200px) {
  .home-layout, .hero, .profile-layout, .watch-layout, .join-layout, .dashboard-layout, .auth-layout { grid-template-columns: 1fr; }
  .grid, .grid-4, .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 14px; }
  .topbar-actions .secondary-btn { display: none; }
  .content { padding: 18px; padding-bottom: 95px; }
  .hero, .page-hero { padding: 24px; border-radius: 28px; }
  .hero h2, .page-hero h2 { font-size: 42px; }
  .grid, .grid-4, .category-grid, .platform-stats, .stats-row, .dashboard-stats { grid-template-columns: 1fr; }
  .watch-title-row { align-items: start; flex-direction: column; }
  .install-banner { left: 14px; right: 14px; bottom: 82px; max-width: none; }
  .bottom-nav { display: flex; }
}
@media (max-width: 520px) {
  .join-btn { padding: 11px 13px; }
  .hero h2, .page-hero h2 { font-size: 36px; }
  .hero p, .page-hero p { font-size: 16px; }
  .creator-banner { min-height: 200px; }
  .profile-header { align-items: start; flex-direction: column; }
  .chat-input { flex-direction: column; }
}


/* V7 Admin Panel */
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.admin-table-card {
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.035);
}

.admin-toolbar h3 {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.admin-toolbar p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.admin-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.055);
  border: 1px solid var(--border);
}

.admin-row h4 {
  font-size: 18px;
  margin-bottom: 5px;
}

.admin-row p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.admin-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.08);
  color: #e4e4e7;
}

.status-new { background: rgba(59,130,246,0.16); color: #bfdbfe; }
.status-reviewed { background: rgba(245,158,11,0.16); color: #fde68a; }
.status-approved { background: rgba(34,197,94,0.16); color: #bbf7d0; }
.status-rejected { background: rgba(220,38,38,0.16); color: #fecaca; }

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-login-note {
  padding: 16px;
  border-radius: 18px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.35);
  color: #fde68a;
  margin-top: 18px;
}

@media (max-width: 820px) {
  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    justify-content: flex-start;
  }

  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* V8 Image Upload + Creator Management */
.creator-photo {
  width: 92px;
  height: 92px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.creator-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.creator-banner.has-image {
  background-size: cover !important;
  background-position: center !important;
  position: relative;
}

.creator-banner.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0.05));
  border-radius: inherit;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
}

.preview-avatar {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  object-fit: cover;
}

.preview-banner {
  width: 100%;
  min-height: 130px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  object-fit: cover;
}

.creator-management-list {
  display: grid;
  gap: 12px;
}

.creator-management-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.055);
  border: 1px solid var(--border);
}

.creator-management-row img,
.creator-management-initial {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--accent);
  color: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 24px;
}

.creator-management-row h4 {
  margin-bottom: 4px;
  font-size: 17px;
}

.creator-management-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.creator-management-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-edit-panel {
  display: none;
  margin-top: 18px;
}

.admin-edit-panel.open {
  display: block;
}

@media (max-width: 820px) {
  .creator-management-row {
    grid-template-columns: 64px 1fr;
  }

  .creator-management-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .upload-preview-grid {
    grid-template-columns: 1fr;
  }
}
