/*
Theme Name: EduTube
Theme URI: https://edutube.example
Author: Custom Theme
Author URI: 
Description: A modern, fully responsive WordPress theme designed for educational YouTube channels. Features video embeds that play on-site, automatic YouTube RSS sync, Day/Night mode, custom logo & extensive Customizer options, and clean educational design.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: edutube
Tags: education, youtube, video, blog, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, dark-mode, responsive
*/

/* ==========================================================================
   CSS Variables - Light Mode (default)
   ========================================================================== */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-secondary: #0ea5e9;
  --color-accent: #14b8a6;
  --color-bg: #f8fafc;
  --color-bg-alt: #ffffff;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-header-bg: #ffffff;
  --color-footer-bg: #0f172a;
  --color-footer-text: #cbd5e1;
  --color-card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --color-youtube: #ff0000;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Inter', system-ui, sans-serif;
  --max-width: 1200px;
  --header-height: 70px;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-secondary: #38bdf8;
  --color-accent: #2dd4bf;
  --color-bg: #0f172a;
  --color-bg-alt: #1e293b;
  --color-surface: #1e293b;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-header-bg: #1e293b;
  --color-footer-bg: #020617;
  --color-footer-text: #94a3b8;
  --color-card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-primary-hover);
}

ul, ol {
  list-style: none;
}

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

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  margin-bottom: 0.5em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p {
  margin-bottom: 1em;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-content {
  flex: 1;
  padding: 2rem 0;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 992px) {
  .main-content.has-sidebar {
    grid-template-columns: 1fr 320px;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color var(--transition), border-color var(--transition);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 1rem;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.site-logo img {
  max-height: 42px;
  width: auto;
}

.site-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.02em;
}
.site-title a {
  color: inherit;
}
.site-title a:hover {
  color: var(--color-primary);
}

.site-description {
  display: none;
}

/* Navigation */
.main-navigation {
  display: none;
}

.main-navigation ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-navigation a {
  display: block;
  padding: 0.5rem 0.9rem;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a {
  background: var(--color-bg);
  color: var(--color-primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Day/Night Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}
.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Subscribe Button */
.btn-subscribe {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--color-youtube);
  color: #fff !important;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s;
}
.btn-subscribe:hover {
  background: #cc0000;
  transform: translateY(-1px);
}
.btn-subscribe svg {
  width: 16px;
  height: 16px;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.menu-toggle svg {
  width: 22px;
  height: 22px;
}

@media (min-width: 992px) {
  .main-navigation {
    display: block;
  }
  .menu-toggle {
    display: none;
  }
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}
.mobile-nav.active {
  display: block;
}
.mobile-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mobile-nav a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--color-text);
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.mobile-nav a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff !important;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  margin-bottom: 2.5rem;
}

.hero-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--color-card-shadow);
  border: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .hero-card {
    grid-template-columns: 1.6fr 1fr;
  }
}

.hero-video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.hero-video iframe,
.hero-video .video-placeholder {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.hero-video .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  cursor: pointer;
  transition: background var(--transition);
}
.hero-video .play-overlay:hover {
  background: rgba(0,0,0,0.5);
}
.play-button {
  width: 72px;
  height: 72px;
  background: var(--color-youtube);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(255,0,0,0.4);
  transition: transform 0.2s;
}
.play-overlay:hover .play-button {
  transform: scale(1.08);
}
.play-button svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  margin-left: 3px;
}

.hero-content {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-content .badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  width: fit-content;
}
[data-theme="dark"] .hero-content .badge {
  background: rgba(59, 130, 246, 0.2);
}
.hero-content h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ==========================================================================
   Video Grid
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.section-header h2 {
  margin: 0;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 576px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 992px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.video-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--color-card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -4px rgb(0 0 0 / 0.12);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.video-card:hover .video-thumb img {
  transform: scale(1.05);
}
.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: var(--color-youtube);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.video-card:hover .video-play-icon {
  opacity: 1;
}
.video-play-icon svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  margin-left: 2px;
}

.video-body {
  padding: 1rem 1.15rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.video-body h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-body h3 a {
  color: var(--color-text);
}
.video-body h3 a:hover {
  color: var(--color-primary);
}
.video-excerpt {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.85rem;
}
.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.video-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-radius: 999px;
  border: 1px solid var(--color-border);
}
.video-actions {
  margin-top: auto;
}

/* ==========================================================================
   Single Video
   ========================================================================== */
.single-video-wrapper {
  max-width: 900px;
  margin: 0 auto;
}
.video-player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--color-card-shadow);
}
.video-player-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.single-video-header h1 {
  margin-bottom: 0.75rem;
}
.single-video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.single-video-content {
  margin-bottom: 2rem;
  line-height: 1.7;
}
.single-video-content p {
  color: var(--color-text);
}
.watch-on-youtube {
  margin: 1.5rem 0;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--color-card-shadow);
}
.widget-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  display: inline-block;
}
.widget ul li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
}
.widget ul li:last-child {
  border-bottom: none;
}
.widget ul a {
  color: var(--color-text);
  font-size: 0.9rem;
}
.widget ul a:hover {
  color: var(--color-primary);
}

/* Categories list */
.widget_categories ul,
.widget_subject_list ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}
.footer-brand .site-title {
  color: #fff;
  margin-bottom: 0.75rem;
}
.footer-brand p {
  color: var(--color-footer-text);
  font-size: 0.9rem;
}
.footer-links h4 {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-links a {
  color: var(--color-footer-text);
  font-size: 0.9rem;
}
.footer-links a:hover {
  color: #fff;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}
.footer-bottom a {
  color: var(--color-footer-text);
}
.footer-bottom a:hover {
  color: #fff;
}

/* Social icons */
.social-links {
  display: flex;
  gap: 0.75rem;
}
.social-links a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  transition: background var(--transition);
}
.social-links a:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
  transition: all var(--transition);
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ==========================================================================
   404 & Empty
   ========================================================================== */
.error-404,
.no-results {
  text-align: center;
  padding: 4rem 1rem;
}
.error-404 h1 {
  font-size: 4rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Forms
   ========================================================================== */
.search-form {
  display: flex;
  gap: 0.5rem;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition);
}
.search-form input[type="search"]:focus {
  border-color: var(--color-primary);
}
.search-form button {
  padding: 0.65rem 1.1rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* Loading state for video embeds */
.video-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  aspect-ratio: 16/9;
}

/* ==========================================================================
   Responsive refinements
   ========================================================================== */
@media (max-width: 575px) {
  .header-actions .btn-subscribe span {
    display: none;
  }
  .hero-content {
    padding: 1.25rem;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .menu-toggle {
    display: none !important;
  }
}
