@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  --yt-bg: #0f0f0f;
  --yt-surface: #0f0f0f;
  --yt-card-bg: #0f0f0f;
  --yt-hover: #272727;
  --yt-border: #272727;
  --yt-search-border: #303030;
  --yt-search-bg: #121212;
  --yt-search-btn: #222222;
  --yt-chip-bg: #272727;
  --yt-chip-hover: #3f3f3f;
  --yt-text-primary: #f1f1f1;
  --yt-text-secondary: #aaaaaa;
  --yt-text-disabled: #717171;
  --yt-red: #ff0000;
  --yt-blue: #3ea6ff;
  --yt-sidebar-width: 240px;
  --yt-sidebar-collapsed: 72px;
  --yt-header-height: 56px;
  --radius-pill: 20px;
  --radius-card: 12px;
}

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

html, body {
  background-color: var(--yt-bg) !important;
  color: var(--yt-text-primary) !important;
  font-family: "Roboto", "Noto Sans Sinhala", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

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

/* ──────────────────────────────────────────────────────────────
   1. YOUTUBE HEADER (NAVBAR)
   ────────────────────────────────────────────────────────────── */

.yt-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--yt-header-height);
  background-color: var(--yt-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 200px;
}

.yt-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yt-text-primary);
  transition: background 0.15s ease;
}

.yt-icon-btn:hover {
  background-color: var(--yt-hover);
}

.yt-icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* YouTube Logo */
.yt-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  text-decoration: none;
}

.yt-title-logo {
  height: 24px;
  width: auto;
  max-width: 180px;
  display: block;
  user-select: none;
  object-fit: contain;
}

.yt-logo-badge {
  width: 32px;
  height: 22px;
  background: var(--yt-red);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  position: relative;
}

.yt-logo-badge svg {
  width: 14px;
  height: 14px;
  fill: #ffffff;
  margin-left: 2px;
}

.yt-logo-text {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: #ffffff;
  margin-left: 4px;
}

.yt-logo-badge-sup {
  font-size: 10px;
  color: var(--yt-text-secondary);
  position: absolute;
  top: -4px;
  right: -24px;
  font-weight: 500;
}

/* Search Bar (Center) */
.yt-header-center {
  flex: 0 1 732px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 20px;
}

.yt-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.yt-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background-color: var(--yt-search-bg);
  border: 1px solid var(--yt-search-border);
  border-right: none;
  border-radius: 40px 0 0 40px;
  padding: 0 16px;
  height: 40px;
  transition: border-color 0.2s;
}

.yt-search-box:focus-within {
  border-color: #1c62b9;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.yt-search-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--yt-text-primary);
  font-size: 15px;
}

.yt-search-box input::placeholder {
  color: #888888;
}

.yt-search-btn {
  width: 64px;
  height: 40px;
  background-color: var(--yt-search-btn);
  border: 1px solid var(--yt-search-border);
  border-radius: 0 40px 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yt-text-primary);
  transition: background 0.15s;
}

.yt-search-btn:hover {
  background-color: #333333;
}

.yt-search-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.yt-mic-btn {
  margin-left: 10px;
  background-color: var(--yt-hover);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yt-text-primary);
}

.yt-mic-btn:hover {
  background-color: #3f3f3f;
}

/* Right Nav Buttons */
.yt-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yt-btn-create {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--yt-hover);
  color: var(--yt-text-primary);
  padding: 0 14px;
  height: 36px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.yt-btn-create:hover {
  background-color: #3f3f3f;
}

.yt-btn-create svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.yt-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff0000, #ff6b6b);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* ──────────────────────────────────────────────────────────────
   2. YOUTUBE SIDEBAR (DRAWER)
   ────────────────────────────────────────────────────────────── */

.yt-layout {
  display: flex;
  margin-top: var(--yt-header-height);
  min-height: calc(100vh - var(--yt-header-height));
}

.yt-sidebar {
  width: var(--yt-sidebar-width);
  background-color: var(--yt-bg);
  position: fixed;
  top: var(--yt-header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 12px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 900;
}

.yt-sidebar::-webkit-scrollbar {
  width: 6px;
}
.yt-sidebar::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

.yt-sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.yt-sidebar-heading {
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  color: var(--yt-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-sidebar-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 14px;
  height: 40px;
  border-radius: 10px;
  color: var(--yt-text-primary);
  font-size: 14px;
  font-weight: 400;
  transition: background 0.1s;
  cursor: pointer;
  text-decoration: none;
}

.yt-sidebar-item:hover {
  background-color: var(--yt-hover);
}

.yt-sidebar-item.active {
  background-color: var(--yt-hover);
  font-weight: 600;
}

.yt-sidebar-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

.yt-sidebar-item .item-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────
   3. MAIN CONTENT CONTAINER
   ────────────────────────────────────────────────────────────── */

.yt-main {
  flex: 1;
  margin-left: var(--yt-sidebar-width);
  padding: 0 24px 40px;
  background-color: var(--yt-bg);
  min-width: 0;
}

/* ──────────────────────────────────────────────────────────────
   4. CHIPS FILTER BAR (TOP CATEGORY BAR)
   ────────────────────────────────────────────────────────────── */

.yt-chips-bar {
  position: sticky;
  top: var(--yt-header-height);
  background-color: var(--yt-bg);
  padding: 12px 0 16px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  z-index: 800;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.yt-chips-bar::-webkit-scrollbar {
  display: none;
}

.yt-chip {
  padding: 6px 14px;
  border-radius: 8px;
  background-color: var(--yt-chip-bg);
  color: var(--yt-text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.yt-chip:hover {
  background-color: var(--yt-chip-hover);
}

.yt-chip.active {
  background-color: #ffffff;
  color: #0f0f0f;
  font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────
   5. VIDEO GRID (YOUTUBE EXACT)
   ────────────────────────────────────────────────────────────── */

.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  column-gap: 16px;
  row-gap: 36px;
  margin-top: 10px;
}

.yt-video-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
}

.yt-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  background-color: #1e1e1e;
  margin-bottom: 12px;
}

.yt-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
  display: block;
}

.yt-video-card:hover .yt-thumb-box img {
  transform: scale(1.03);
}

.yt-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.yt-video-card:hover .yt-thumb-overlay {
  opacity: 1;
}

.yt-play-icon {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-play-icon svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
  margin-left: 3px;
}

.yt-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* Card Details */
.yt-card-details {
  display: flex;
  gap: 12px;
}

.yt-channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3ea6ff, #005bb5);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.yt-card-meta {
  flex: 1;
  min-width: 0;
}

.yt-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--yt-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

/* Sinhala Caption under Video Title */
.yt-sinhala-caption {
  font-family: 'Noto Sans Sinhala', 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #3ea6ff;
  line-height: 1.4;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background: rgba(62, 166, 255, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  border-left: 3px solid #3ea6ff;
}

.yt-card-channel {
  font-size: 13px;
  color: var(--yt-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}

.yt-verified-badge {
  width: 14px;
  height: 14px;
  fill: var(--yt-text-secondary);
}

.yt-card-stats {
  font-size: 12px;
  color: var(--yt-text-disabled);
}

/* Hovering Play Video Preview */
.yt-thumb-box iframe.hover-preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 10;
  pointer-events: none;
  border-radius: var(--radius-card);
}

.yt-thumb-box .yt-hover-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #ff0000;
  width: 0%;
  z-index: 12;
  transition: width 0.3s ease;
}

.yt-video-card:hover .yt-thumb-box .yt-hover-progress {
  animation: ytProgressBar 5s linear infinite;
}

@keyframes ytProgressBar {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* Watch Page Sinhala Banner */
.yt-watch-sinhala-banner {
  font-family: 'Noto Sans Sinhala', 'Roboto', sans-serif;
  background: rgba(62, 166, 255, 0.08);
  border: 1px solid rgba(62, 166, 255, 0.25);
  border-left: 4px solid #3ea6ff;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  color: #f1f1f1;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-watch-sinhala-banner span.badge {
  background: #3ea6ff;
  color: #0f0f0f;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────
   6. YOUTUBE WATCH PAGE
   ────────────────────────────────────────────────────────────── */

.yt-watch-layout {
  display: flex;
  gap: 24px;
  max-width: 1700px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.yt-watch-primary {
  flex: 1;
  min-width: 0;
}

.yt-watch-secondary {
  width: 400px;
  flex-shrink: 0;
}

.yt-player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.yt-player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.yt-watch-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--yt-text-primary);
}

.yt-watch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.yt-channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-channel-info-col h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.yt-channel-info-col p {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.yt-btn-subscribe {
  background-color: #ffffff;
  color: #0f0f0f;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 14px;
  margin-left: 12px;
  transition: opacity 0.15s;
}

.yt-btn-subscribe:hover {
  opacity: 0.9;
}

.yt-watch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-action-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--yt-hover);
  color: var(--yt-text-primary);
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.yt-action-pill:hover {
  background-color: #3f3f3f;
}

.yt-action-pill svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.yt-desc-box {
  background-color: #212121;
  border-radius: 12px;
  padding: 16px;
  line-height: 1.6;
}

.yt-desc-stats {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
}

.yt-desc-text {
  font-size: 14px;
  color: #f1f1f1;
  white-space: pre-line;
}

/* Watch Page Secondary (Related Videos) */
.yt-related-card {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  text-decoration: none;
}

.yt-related-thumb {
  position: relative;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background-color: #1e1e1e;
  flex-shrink: 0;
}

.yt-related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-related-info {
  flex: 1;
  min-width: 0;
}

.yt-related-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--yt-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.yt-related-channel {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

/* ──────────────────────────────────────────────────────────────
   7. ADMIN MODAL & PANEL (YOUTUBE STUDIO INSPIRED)
   ────────────────────────────────────────────────────────────── */

.yt-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.yt-modal-window {
  background-color: #212121;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.yt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.yt-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.yt-modal-body {
  padding: 24px;
}

.yt-form-group {
  margin-bottom: 18px;
}

.yt-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text-secondary);
  margin-bottom: 6px;
}

.yt-form-group input,
.yt-form-group select,
.yt-form-group textarea {
  width: 100%;
  background-color: #121212;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}

.yt-form-group input:focus,
.yt-form-group select:focus,
.yt-form-group textarea:focus {
  border-color: var(--yt-blue);
}

.yt-form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.yt-btn-primary {
  background-color: var(--yt-blue);
  color: #0f0f0f;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.yt-btn-primary:hover {
  opacity: 0.9;
}

.yt-btn-danger {
  background-color: var(--yt-red);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.yt-btn-danger:hover {
  opacity: 0.85;
}

.yt-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.yt-table th, .yt-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-table th {
  color: var(--yt-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
}

.yt-table tbody tr:hover {
  background-color: var(--yt-hover);
}

/* Empty State */
.yt-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--yt-text-secondary);
}

.yt-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ──────────────────────────────────────────────────────────────
   8. RESPONSIVE DESIGN
   ────────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .yt-watch-layout {
    flex-direction: column;
  }
  .yt-watch-secondary {
    width: 100%;
  }
}

@media (max-width: 792px) {
  .yt-sidebar {
    display: none;
  }
  .yt-main {
    margin-left: 0;
    padding: 0 16px 40px;
  }
  .yt-header-center {
    margin: 0 8px;
  }
  .yt-search-form {
    max-width: 100%;
  }
}
