/* ═══════════════════════════════════════════════════════════════════════════
   2010 YouTube Retro Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

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

body {
  background: #f2f2f2;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  color: #333;
}

a { color: #0033cc; text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: #551a8b; }

/* ─── Masthead (Header) ────────────────────────────────────────────────── */

#masthead {
  background: #fff;
  border-bottom: 1px solid #ccc;
  padding: 8px 0;
}

#masthead-inner {
  max-width: 1003px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 16px;
}

/* YouTube Logo */
#yt-logo {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  flex-shrink: 0;
}
#yt-logo:hover { text-decoration: none; }

.logo-main {
  font-size: 22px;
  font-weight: bold;
  color: #333;
  letter-spacing: -0.5px;
}
.logo-main .tube {
  background: #cc0000;
  color: #fff;
  padding: 1px 5px 2px;
  border-radius: 4px;
  font-size: 20px;
  position: relative;
  top: -1px;
}

.logo-tagline {
  font-size: 10px;
  font-style: italic;
  color: #888;
  margin-top: -2px;
}

/* Search */
#search-box {
  display: flex;
  flex: 1;
  max-width: 400px;
}
#search-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #bbb;
  border-radius: 3px 0 0 3px;
  font-size: 13px;
  font-family: Arial, sans-serif;
  outline: none;
}
#search-input:focus { border-color: #4d90fe; }
#search-btn {
  background: #e8e8e8;
  border: 1px solid #bbb;
  border-left: 0;
  border-radius: 0 3px 3px 0;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  color: #333;
}
#search-btn:hover { background: #d4d4d4; }

/* Nav tabs */
#nav-tabs {
  display: flex;
  gap: 0;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: bold;
  color: #666 !important;
  text-decoration: none !important;
  border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: #333 !important; }
.nav-tab.active {
  color: #333 !important;
  border-bottom-color: #cc0000;
}

/* ─── Sub-header nav bar ───────────────────────────────────────────────── */

#sub-nav {
  background: #e8e8e8;
  border-bottom: 1px solid #ccc;
}
#sub-nav-inner {
  max-width: 1003px;
  margin: 0 auto;
  padding: 0 10px;
  display: flex;
  gap: 2px;
}
.sub-tab {
  padding: 5px 10px;
  font-size: 11px;
  color: #666 !important;
  text-decoration: none !important;
}
.sub-tab:hover { background: #d4d4d4; }
.sub-tab.active { background: #f2f2f2; font-weight: bold; color: #333 !important; }

/* ─── Content area ─────────────────────────────────────────────────────── */

#content {
  max-width: 1003px;
  margin: 0 auto;
  padding: 16px 10px;
  display: flex;
  gap: 20px;
}

#main {
  flex: 1;
  min-width: 0;
}

#sidebar {
  width: 200px;
  flex-shrink: 0;
}

/* ─── Section headers ──────────────────────────────────────────────────── */

.section-title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #ccc;
}

/* ─── Video grid ───────────────────────────────────────────────────────── */

#video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 12px;
}

.grid-item {
  width: 100%;
}

.grid-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border: 1px solid #999;
  overflow: hidden;
  position: relative;
}

.grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid-thumb .thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 32px;
  background: #1a1a1a;
}

.grid-thumb .duration-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
}

.grid-title {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: #0033cc !important;
  margin: 4px 0 2px;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}

.grid-meta {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
}

/* ─── Pagination ───────────────────────────────────────────────────────── */

#pagination {
  text-align: center;
  padding: 20px 0;
  margin-top: 12px;
  border-top: 1px solid #ccc;
}

.page-link {
  display: inline-block;
  padding: 3px 10px;
  margin: 0 2px;
  border: 1px solid #ccc;
  font-size: 12px;
  color: #0033cc !important;
  background: #fff;
  text-decoration: none !important;
}
.page-link:hover { background: #e8e8e8; }
.page-link.active {
  background: #ccc;
  font-weight: bold;
  color: #333 !important;
}

/* ─── Sidebar modules ──────────────────────────────────────────────────── */

.sidebar-module {
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 11px;
}
.sidebar-module h3 {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
  color: #333;
}
.sidebar-module p {
  margin-bottom: 4px;
  color: #666;
}

.yt-button {
  display: inline-block;
  padding: 4px 12px;
  background: #e8e8e8;
  border: 1px solid #bbb;
  border-radius: 3px;
  color: #333 !important;
  font-size: 11px;
  text-decoration: none !important;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.yt-button:hover { background: #d4d4d4; }

/* ─── Footer ───────────────────────────────────────────────────────────── */

#footer {
  max-width: 1003px;
  margin: 20px auto;
  padding: 12px 10px;
  border-top: 1px solid #ccc;
  text-align: center;
  font-size: 11px;
  color: #888;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Watch page
   ═══════════════════════════════════════════════════════════════════════════ */

#watch-player {
  width: 640px;
  background: #000;
  margin-bottom: 12px;
  position: relative;
  cursor: pointer;
}
#watch-player video {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: contain;
}

/* ─── Play overlay (big center play button) ──────────────────────────── */

#play-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: rgba(255,255,255,0.8);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#watch-player.paused #play-overlay { opacity: 1; }

/* ─── Custom player controls ─────────────────────────────────────────── */

#player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding-top: 20px;
  opacity: 1;
  transition: opacity 0.3s;
}
#watch-player:not(.show-controls):not(.paused) #player-controls {
  opacity: 0;
}
#watch-player:hover #player-controls,
#watch-player.paused #player-controls {
  opacity: 1;
}

/* Progress bar */
#progress-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  margin: 0 8px;
  transition: height 0.1s;
}
#progress-bar:hover {
  height: 6px;
}
#progress-buffered {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: rgba(255,255,255,0.35);
  pointer-events: none;
}
#progress-played {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: #cc0000;
  pointer-events: none;
}
#progress-handle {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  background: #cc0000;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.1s;
  pointer-events: none;
}
#progress-bar:hover #progress-handle {
  transform: translate(-50%, -50%) scale(1);
}
#progress-tooltip {
  position: absolute;
  bottom: 14px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  transform: translateX(-50%);
  pointer-events: none;
  display: none;
  white-space: nowrap;
}
#progress-bar:hover #progress-tooltip {
  display: block;
}

/* Controls row */
#controls-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 6px;
  color: #fff;
  font-size: 12px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  opacity: 0.9;
}
.ctrl-btn:hover { opacity: 1; }

#volume-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

#vol-slider {
  width: 0;
  opacity: 0;
  transition: width 0.2s, opacity 0.2s;
  accent-color: #fff;
  height: 3px;
  cursor: pointer;
}
#volume-group:hover #vol-slider {
  width: 60px;
  opacity: 1;
}

#time-display {
  font-family: Arial, sans-serif;
  font-size: 11px;
  color: #ddd;
  margin-left: 4px;
  user-select: none;
}

#controls-spacer { flex: 1; }

#watch-description {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

#watch-info {
  border: 1px solid #ccc;
  background: #fff;
  padding: 10px;
  margin-bottom: 12px;
}

#watch-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 6px;
}

#watch-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #666;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

#watch-details .detail-row {
  font-size: 12px;
  color: #666;
  margin-bottom: 3px;
}
#watch-details .label {
  font-weight: bold;
  color: #333;
}

/* ─── Like / Dislike / Share actions ──────────────────────────────────── */

#watch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.yt-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: linear-gradient(#fff, #e8e8e8);
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  font-family: Arial, sans-serif;
  color: #333;
}
.yt-action-btn:hover { background: linear-gradient(#f0f0f0, #d4d4d4); }
.yt-action-btn.active-like { background: linear-gradient(#e8f0fe, #c3d9f7); border-color: #4d90fe; }
.yt-action-btn.active-dislike { background: linear-gradient(#fee8e8, #f7c3c3); border-color: #cc0000; }

.thumb-icon { font-size: 14px; }

/* ─── Share toast ─────────────────────────────────────────────────────── */

.share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 9999;
  animation: toastFade 2s ease-in-out forwards;
}

@keyframes toastFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── Related videos sidebar ──────────────────────────────────────────── */

.related-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  text-decoration: none !important;
}
.related-item:hover { background: #f9f9f9; }

.related-thumb {
  width: 120px;
  height: 90px;
  background: #1a1a1a;
  flex-shrink: 0;
  border: 1px solid #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #999;
  overflow: hidden;
}

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

.related-info {
  min-width: 0;
}
.related-title {
  font-size: 11px;
  font-weight: bold;
  color: #0033cc;
  line-height: 1.3;
  margin-bottom: 2px;
}
.related-meta {
  font-size: 11px;
  color: #666;
}

/* ─── Comments section ────────────────────────────────────────────────── */

#comments {
  border: 1px solid #ccc;
  background: #fff;
  padding: 10px;
}
#comments h3 {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
}

#comment-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
}

#comment-author {
  width: 160px;
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  background: #f9f9f9;
  color: #666;
}

#comment-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 12px;
  font-family: Arial, sans-serif;
  min-height: 32px;
}
#comment-input:focus { border-color: #4d90fe; outline: none; }

#comment-submit {
  padding: 5px 14px;
  flex-shrink: 0;
}

/* Comment list */
.comment-item {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.comment-item:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.comment-author {
  font-weight: bold;
  color: #0033cc;
  font-size: 12px;
}

.comment-time {
  font-size: 11px;
  color: #999;
}

.comment-text {
  color: #333;
  line-height: 1.4;
}

.no-comments {
  color: #888;
  font-style: italic;
  font-size: 12px;
}

/* Clickable timestamp links in comments */
.timestamp-link {
  color: #0033cc !important;
  font-weight: bold;
  text-decoration: none !important;
  background: #eef3ff;
  padding: 1px 4px;
  border-radius: 2px;
  cursor: pointer;
  font-family: monospace;
  font-size: 11px;
}
.timestamp-link:hover {
  background: #d0dfff;
  text-decoration: underline !important;
}

/* Fullscreen */
#watch-player:fullscreen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#watch-player:fullscreen video {
  max-height: 100vh;
  max-width: 100vw;
}
#watch-player:fullscreen #player-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}
#watch-player:fullscreen #play-overlay {
  bottom: 50px;
}

/* Unsupported format */
.unsupported-msg {
  padding: 40px;
  text-align: center;
  color: #fff;
  font-size: 14px;
}
.unsupported-msg a {
  color: #6cf;
  margin-top: 10px;
  display: inline-block;
}
