/* Modern Dark Theme & Variables */
:root {
  --bg-darkest: #09090b;
  --bg-main: #0e0e12;
  --bg-surface: #16161d;
  --bg-card: #1c1c26;
  --bg-hover: #262634;
  --text-main: #f4f4f6;
  --text-muted: #8e8e9f;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --danger: #f43f5e;
  --success: #10b981;
  --border: #262633;
  --sidebar-w: 250px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
header {
  background: rgba(22, 22, 29, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  gap: 20px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
  width: var(--sidebar-w);
  flex-shrink: 0;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.logo-glyph {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-center {
  flex: 1;
  max-width: 580px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px 6px 4px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 0.92rem;
}

.search-bar button {
  background: var(--bg-card);
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.search-bar button:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  outline: none;
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-main);
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 12px var(--accent-glow);
}

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

/* Page Layout */
.app-container {
  display: flex;
  flex: 1;
}

/* Sidebar */
aside {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
  min-height: calc(100vh - 64px);
  transition: width 0.3s ease;
}

.nav-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding-left: 12px;
  margin-bottom: 8px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--bg-card);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Main Content Area */
main {
  flex: 1;
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.page-view {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.page-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Category Filter Chips */
.chips-container {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.chip.active {
  background: #fff;
  color: #000;
  font-weight: 600;
  border-color: #fff;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 28px 20px;
}

.media-card {
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s;
}

.media-card:hover {
  transform: translateY(-4px);
}

.preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.media-card:hover .preview-box video {
  transform: scale(1.04);
}

.badge-time {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
}

.badge-live {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.media-meta {
  display: flex;
  gap: 12px;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a2a36;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.meta-info {
  flex: 1;
}

.meta-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-author {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.meta-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Shorts Feed */
.shorts-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  max-width: 520px;
  margin: 0 auto;
}

.short-card {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  width: 100%;
}

.short-video-wrapper {
  width: 380px;
  height: 640px;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.short-video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.short-info-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}

.short-action-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.round-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.round-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.08);
}

.action-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Watch Layout */
.watch-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
}

.player-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.player-box video {
  width: 100%;
  height: 100%;
  display: block;
}

.watch-details {
  padding: 18px 0;
}

.watch-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.watch-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.author-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.watch-actions {
  display: flex;
  gap: 10px;
}

.comments-container {
  margin-top: 28px;
}

.comment-field-wrap {
  display: flex;
  gap: 12px;
  margin: 18px 0 28px;
}

.comment-field-wrap input {
  flex: 1;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #fff;
  outline: none;
}

.comment-field-wrap input:focus {
  border-color: var(--accent);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.comment-item {
  display: flex;
  gap: 14px;
}

.comment-body h5 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.comment-body h5 span {
  font-weight: 400;
  color: var(--text-muted);
}

.comment-body p {
  font-size: 0.92rem;
  color: #d1d1db;
  line-height: 1.4;
}

.recommended-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rec-card {
  display: flex;
  gap: 12px;
  cursor: pointer;
}

.rec-thumb {
  width: 140px;
  height: 84px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.rec-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

/* Info & Status Cards */
.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.data-table th, .data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: #fff;
  font-size: 0.92rem;
  outline: none;
}

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

/* Footer */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

@media (max-width: 1024px) {
  .watch-grid { grid-template-columns: 1fr; }
  aside { width: 72px; padding: 16px 8px; }
  .nav-group-label, .nav-link span { display: none; }
  .nav-link { justify-content: center; padding: 12px 0; }
  .brand-section { width: auto; }
}
