/* XyeTube — iTouch Edition · 2007 */

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

:root {
  --bg:          #14161a;
  --bg2:         #1c1f26;
  --bg3:         #22262e;
  --panel:       rgba(255,255,255,0.05);
  --panel-hover: rgba(255,255,255,0.08);
  --border:      rgba(255,255,255,0.09);
  --red:         #cc2200;
  --red-hi:      #ff3311;
  --accent:      #5b7fa6;
  --accent-hi:   #7aaed6;
  --text:        #e4e6ea;
  --text-mid:    #9aa1ac;
  --text-dim:    #5a6070;
  --white:       #ffffff;
}

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

body {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  color: var(--text);
  background: radial-gradient(circle at 30% 10%, #1e2330 0%, var(--bg) 60%);
  min-height: 100vh;
}

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

/* ===== TOP BAR ===== */
#topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.4);
  padding: 0 16px;
  min-height: 52px;
}
#topbar table { width: 100%; }
#topbar-left { width: 180px; vertical-align: middle; }
#logo-link { display: flex; align-items: center; gap: 8px; text-decoration: none; }
#logo-link img { display: block; filter: brightness(1.1); }

/* fallback text logo if png not styled */
#topbar-search { text-align: center; vertical-align: middle; padding: 8px; }
#topbar-right {
  text-align: right; vertical-align: middle;
  white-space: nowrap; padding-right: 8px;
  font-size: 11px; color: var(--text-mid);
}
#topbar-right a { color: var(--text-mid); }
#topbar-right a:hover { color: var(--white); }
#topbar-right b { color: var(--text); }
.toplink { color: var(--accent-hi) !important; font-weight: 600; font-size: 11px; }

#search-box {
  width: 300px;
  height: 28px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.15s;
}
#search-box:focus { outline: none; border-color: var(--accent); }
#search-box::placeholder { color: var(--text-dim); }

.btn-search {
  height: 28px;
  padding: 0 14px;
  background: linear-gradient(180deg, #3a3f4a, #252830);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 4px 4px 0;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-search:hover { background: linear-gradient(180deg, var(--accent), #3d5a7a); color: #fff; }

/* ===== NAVBAR ===== */
#navbar {
  background: var(--bg3);
  border-bottom: 2px solid var(--red);
  height: 30px;
  line-height: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.navlink {
  color: var(--text-mid);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 0 14px;
  display: inline-block;
  height: 30px;
  line-height: 30px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.navlink:hover { background: rgba(204,34,0,0.18); color: var(--white); }

/* ===== FLASH MESSAGES ===== */
.flash-success {
  background: rgba(52,160,80,0.12);
  border-bottom: 1px solid rgba(52,160,80,0.3);
  color: #7de09a;
  padding: 7px 16px;
  font-size: 12px;
}
.flash-error {
  background: rgba(204,34,0,0.12);
  border-bottom: 1px solid rgba(204,34,0,0.3);
  color: #ff8070;
  padding: 7px 16px;
  font-size: 12px;
}

/* ===== PAGE WRAPPER ===== */
#page-wrap {
  width: 960px;
  margin: 0 auto;
  padding: 14px 0;
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--red);
  padding-bottom: 5px;
  margin-bottom: 12px;
}
.section-title a { color: var(--accent-hi); font-size: 10px; float: right; font-weight: 500; text-transform: none; letter-spacing: 0; }

/* ===== VIDEO GRID ===== */
.video-grid { display: block; overflow: hidden; }
.video-grid-inner { display: flex; flex-wrap: wrap; gap: 0; margin: 0 -5px; }
.video-thumb-item {
  width: 155px;
  margin: 0 5px 16px 5px;
  vertical-align: top;
  display: inline-block;
}
.thumb-img-wrap {
  position: relative;
  width: 155px;
  height: 116px;
  overflow: hidden;
  background: #000;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.thumb-img-wrap img {
  width: 155px; height: 116px;
  object-fit: cover; display: block;
  transition: opacity 0.15s, transform 0.15s;
}
.thumb-img-wrap:hover img { opacity: 0.8; transform: scale(1.03); }
.thumb-no-img {
  width: 155px; height: 116px;
  background: linear-gradient(135deg, #1a1d22 0%, #2c3140 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 28px;
}
.thumb-duration {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(0,0,0,0.82);
  color: #fff; font-size: 10px; font-weight: 600;
  padding: 1px 4px; border-radius: 2px;
  letter-spacing: 0.3px;
}
.thumb-title {
  font-size: 12px; font-weight: 600;
  color: var(--text);
  margin-top: 5px; line-height: 1.35;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.thumb-title:hover { color: var(--accent-hi); }
.thumb-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.thumb-meta a { color: var(--accent-hi); }
.thumb-views { color: var(--text-dim); font-size: 10px; }

/* ===== SIDEBAR ===== */
.layout-with-sidebar { display: flex; gap: 12px; width: 960px; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 200px; flex-shrink: 0; }

/* ===== SIDEBAR BOX ===== */
.sidebar-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
  backdrop-filter: blur(6px);
}
.sidebar-box-title {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700;
  color: var(--text-mid);
  padding: 5px 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sidebar-box-body { padding: 6px 10px; font-size: 11px; }
.sidebar-box-body a { color: var(--accent-hi); display: block; padding: 3px 0; }
.sidebar-box-body a:hover { color: var(--white); }

/* ===== VIDEO WATCH PAGE ===== */
#watch-wrap { display: flex; gap: 14px; }
#watch-left { flex: 1; min-width: 0; }
#watch-right { width: 240px; flex-shrink: 0; }

#video-player-box {
  background: #000;
  width: 100%;
  aspect-ratio: 16/9;
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
#video-player-box video { width: 100%; height: 100%; display: block; }

#video-info-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(4px);
}
#video-title-main {
  font-size: 17px; font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  line-height: 1.3;
}
#video-meta-row {
  font-size: 11px; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px; margin-bottom: 8px;
  display: flex; align-items: center;
  justify-content: space-between;
}
#like-dislike-bar { display: flex; align-items: center; gap: 6px; }
.btn-like, .btn-dislike {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-mid);
  padding: 3px 12px;
  cursor: pointer;
  font-size: 11px; font-weight: 600;
  border-radius: 3px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-like:hover { background: rgba(52,160,80,0.18); border-color: #34a050; color: #7de09a; }
.btn-dislike:hover { background: rgba(204,34,0,0.18); border-color: var(--red); color: #ff8070; }
.btn-like.active { background: rgba(52,160,80,0.22); border-color: #34a050; color: #7de09a; }
.btn-dislike.active { background: rgba(204,34,0,0.22); border-color: var(--red); color: #ff8070; }
.like-count { font-size: 11px; color: var(--text-mid); }

#video-description {
  font-size: 12px; color: var(--text-mid);
  line-height: 1.6; margin-top: 8px;
  white-space: pre-wrap; word-break: break-word;
}
#video-tags { margin-top: 8px; font-size: 11px; }
#video-tags a {
  display: inline-block;
  background: rgba(91,127,166,0.15);
  border: 1px solid rgba(91,127,166,0.3);
  color: var(--accent-hi);
  padding: 1px 7px; margin: 2px 2px 2px 0;
  border-radius: 3px;
}
#video-tags a:hover { background: rgba(91,127,166,0.28); }

/* Channel info under video */
#channel-info-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.channel-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 3px; border: 1px solid var(--border);
  object-fit: cover;
}
.channel-avatar-sm-placeholder {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #3d5a7a);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700;
}
#channel-name-link { font-weight: 700; font-size: 13px; color: var(--text); }
#channel-name-link:hover { color: var(--accent-hi); }
#channel-subs { font-size: 11px; color: var(--text-dim); }

#btn-subscribe {
  padding: 5px 16px;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--red);
  background: linear-gradient(180deg, var(--red-hi) 0%, var(--red) 100%);
  color: #fff;
  border-radius: 3px;
  margin-left: auto;
  font-family: inherit;
  transition: opacity 0.15s;
}
#btn-subscribe.subscribed {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
  color: var(--text-mid);
}
#btn-subscribe:hover { opacity: 0.85; }

/* ===== COMMENTS ===== */
#comments-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 10px;
}
#comments-title {
  font-size: 12px; font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.comment-form textarea {
  width: 100%;
  height: 52px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px; font-family: inherit;
  padding: 6px 8px;
  resize: vertical;
  transition: border-color 0.15s;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form button {
  margin-top: 6px;
  padding: 4px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-mid);
  cursor: pointer;
  font-size: 11px; font-weight: 600;
  font-family: inherit;
  border-radius: 3px;
  transition: all 0.15s;
}
.comment-form button:hover { background: var(--panel-hover); color: var(--white); }
.comment-item {
  display: flex; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.comment-avatar {
  width: 28px; height: 28px;
  border-radius: 3px; object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.comment-avatar-ph {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), #3d5a7a);
  border-radius: 3px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
}
.comment-body { flex: 1; min-width: 0; }
.comment-user { font-weight: 700; color: var(--accent-hi); font-size: 11px; }
.comment-text { font-size: 12px; color: var(--text-mid); margin-top: 2px; word-break: break-word; line-height: 1.5; }
.comment-time { font-size: 10px; color: var(--text-dim); margin-top: 3px; }

/* ===== RELATED VIDEOS ===== */
.related-item {
  display: flex; gap: 8px;
  margin-bottom: 10px;
  padding: 6px;
  border-radius: 5px;
  transition: background 0.15s;
}
.related-item:hover { background: var(--panel-hover); }
.related-thumb {
  width: 80px; height: 60px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0; background: #000;
}
.related-thumb-ph {
  width: 80px; height: 60px;
  background: linear-gradient(135deg, #1a1d22, #2c3140);
  flex-shrink: 0; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 18px;
}
.related-info { flex: 1; min-width: 0; }
.related-title { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.35; }
.related-title:hover { color: var(--accent-hi); }
.related-meta { font-size: 10px; color: var(--text-dim); margin-top: 3px; }

/* ===== AUTH FORMS ===== */
.auth-box {
  width: 380px;
  margin: 36px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 28px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.auth-box h2 {
  font-size: 16px; font-weight: 700;
  color: var(--white);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--red);
  padding-bottom: 8px;
}
.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px; font-family: inherit;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row select { background-color: var(--bg3); }
.btn-primary {
  padding: 7px 20px;
  background: linear-gradient(180deg, var(--red-hi) 0%, var(--red) 100%);
  border: 1px solid var(--red);
  color: #fff;
  font-size: 12px; font-weight: 700;
  cursor: pointer; border-radius: 4px;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-secondary {
  padding: 6px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-size: 12px; font-weight: 600;
  cursor: pointer; border-radius: 4px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--panel-hover); color: var(--white); }
.auth-switch { margin-top: 12px; font-size: 11px; color: var(--text-dim); }
.auth-switch a { color: var(--accent-hi); }

/* ===== UPLOAD FORM ===== */
.upload-box {
  max-width: 620px;
  margin: 20px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 28px;
  backdrop-filter: blur(6px);
}
.upload-box h2 {
  font-size: 16px; font-weight: 700;
  color: var(--white);
  border-bottom: 2px solid var(--red);
  padding-bottom: 7px; margin-bottom: 16px;
}
.upload-box input[type=file] {
  font-size: 12px;
  color: var(--text-mid);
}
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-mid); }

/* ===== CHANNEL PAGE ===== */
#channel-header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(6px);
}
.channel-big-avatar {
  width: 80px; height: 80px;
  object-fit: cover;
  border: 2px solid var(--border);
  border-radius: 4px;
}
.channel-big-avatar-ph {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--accent), #3d5a7a);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; font-weight: 700;
  border: 2px solid var(--border);
}
#channel-name-big { font-size: 20px; font-weight: 700; color: var(--white); }
#channel-subs-big { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
#channel-bio { font-size: 12px; color: var(--text-mid); margin-top: 6px; line-height: 1.5; }

/* ===== 404 ===== */
.error-box {
  text-align: center;
  padding: 80px 20px;
  font-size: 14px;
  color: var(--text-mid);
}
.error-box h1 { font-size: 52px; color: var(--red); font-weight: 700; margin-bottom: 10px; }

/* ===== FOOTER ===== */
#footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 12px;
  text-align: center;
  margin-top: 28px;
  font-size: 11px;
  color: var(--text-dim);
}
#footer-links { margin-bottom: 5px; }
#footer-links a { color: var(--text-dim); margin: 0 5px; }
#footer-links a:hover { color: var(--accent-hi); }
#footer-copy { color: var(--text-dim); opacity: 0.6; }

/* ===== UPLOAD PROGRESS BAR ===== */
#upload-progress { display: none; margin-top: 12px; }
#upload-bar-wrap {
  width: 100%; height: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
#upload-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red-hi), var(--red));
  transition: width 0.2s;
  border-radius: 7px;
}
#upload-status { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ===== MISC ===== */
.no-videos { color: var(--text-dim); font-size: 13px; text-align: center; padding: 40px; }
.views-badge {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10px; color: var(--text-dim);
  padding: 0 5px;
}
.category-badge {
  display: inline-block;
  background: rgba(91,127,166,0.15);
  border: 1px solid rgba(91,127,166,0.3);
  border-radius: 3px;
  font-size: 10px; color: var(--accent-hi);
  padding: 0 5px;
  margin-left: 4px;
}

/* category filter tabs */
.cat-tabs { margin-bottom: 12px; }
.cat-tab {
  display: inline-block;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 3px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-mid);
  margin-right: 5px;
  cursor: pointer;
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.15s;
}
.cat-tab:hover { background: rgba(91,127,166,0.2); border-color: var(--accent); color: var(--white); }
.cat-tab.active { background: linear-gradient(180deg, var(--red-hi), var(--red)); border-color: var(--red); color: #fff; }
