/* Reset box-sizing for all elements to include padding and border in element's total width and height */
* {
  box-sizing: border-box;
}

/* Body styles: basic font, background, text color, and flex container for layout */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f9f9f9;
  color: #222;
  display: flex;
  height: 100vh;        /* Full viewport height */
  overflow: hidden;     /* Prevent scroll on body */
}

/* Dark mode styles for the body */
body.dark-mode {
  background-color: #121212;
  color: #eee;
}

/* Sidebar navigation styles */
nav.sidebar {
  width: 220px;               /* Fixed sidebar width */
  background-color: #f1f1f1;  /* Light grey background */
  border-right: 1px solid #ddd; /* Border on the right side */
  padding-top: 20px;          /* Space at the top */
  display: flex;
  flex-direction: column;     /* Stack links vertically */
  position: fixed;            /* Fixed position on screen */
  top: 0;
  left: 0;
  bottom: 0;                 /* Full height sidebar */
  transition: transform 0.3s ease; /* Smooth slide for mobile */
  
}

/* Dark mode sidebar background and border */
body.dark-mode nav.sidebar {
  background-color: #1e1e1e;
  border-right-color: #333;
}

/* Sidebar links styling */
nav.sidebar a {
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  /* Remove border-left transparent to allow full red border */
  border-left: none;
  display: flex;
  align-items: center;
  height: 48px; /* fix height so border covers full link height */
  position: relative;
}

/* Add a pseudo-element for the left red bar on hover and active */
nav.sidebar a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: transparent;
  transition: background-color 0.3s ease;
}

/* Hover effect for sidebar links */
nav.sidebar a:hover::before {
  background-color: #ff0000; /* Red left border on hover */
}

nav.sidebar a:hover {
  background-color: #ddd;
  color: #ff0000;             /* Red text on hover */
}

/* Active sidebar link styling */
nav.sidebar a.active::before {
  background-color: #ff0000; /* Full height red left bar */
}

nav.sidebar a.active {
  background-color: #ff0000;  /* Red background */
  color: white;               /* White text */
}

/* Sidebar link colors for dark mode */
body.dark-mode nav.sidebar a {
  color: #ccc;
}

/* Dark mode hover effect for sidebar links */
body.dark-mode nav.sidebar a:hover {
  background-color: #333;
  color: #ff5555;             /* Softer red on hover */
}

/* Main content area, positioned next to sidebar */
.main-content {
  margin-left: 220px;         /* Leave space for sidebar */
  flex-grow: 1;               /* Take remaining horizontal space */
  display: flex;
  flex-direction: column;
  height: 100vh;              /* Full height */
  overflow-y: auto;           /* Enable vertical scrolling */
}

/* Header styles: red background with white text */
header {
  background-color: #ff0000;
  color: white;
  padding: 15px 20px;
  font-size: 26px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between; /* Space between title and buttons */
  position: sticky;               /* Sticks to top on scroll */
  top: 0;
  z-index: 1;                    /* Above other content */
}

/* Container for search input */
#search-container {
  display: block;
  align-items: center;
  gap: 10px;
}

/* Search input box styling */
#search-input {
  padding: 8px 12px;
  border: none;
  border-radius: 3px;
  font-size: 16px;
  max-width: 900px;
  width: 100%;
}

/* Grid layout for video cards, responsive */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Responsive columns */
  gap: 15px;
  padding: 20px;
}

/* Individual video card container */
.video-card {
  background: white;
  border: 1px solid #ddd;
  transition: background-color 0.3s ease;
  cursor: pointer;
  border-radius: 4px;
}

/* Hover effect on video cards */
.video-card:hover {
  background-color: #eee;
}

/* Dark mode styles for video cards */
body.dark-mode .video-card {
  background-color: #222;
  border-color: #444;
}

/* Thumbnail container for video image */
.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;      /* Maintain 16:9 aspect ratio */
  background-color: #000;    /* Black background while loading */
  overflow: hidden;
  position: relative;
}

/* Image inside the thumbnail container */
.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;         /* Cover entire thumbnail box */
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

/* Video title text */
.video-title {
  padding: 10px;
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}

/* Row of buttons below each video card (like, watchlist) */
.button-row {
  display: flex;
  justify-content: space-around; /* Space buttons evenly */
  padding: 8px;
  font-size: 18px;
}

/* Buttons style */
.button-row button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  transition: transform 0.2s;
}

/* Hover scale effect on buttons */
.button-row button:hover {
  transform: scale(1.1);
}

/* Color for liked videos */
.liked {
  color: #ff0000;
}

/* Color for watchlisted videos */
.watchlisted {
  color: #ff0000;
}

/* Dark mode video title color */
body.dark-mode .video-title {
  color: #ddd;
}

/* Buttons in header (dark mode toggle, random video) */
#toggle-dark-mode,
#random-video-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

/* Responsive design: hide sidebar and adjust layout on small screens */
@media (max-width: 700px) {
  nav.sidebar {
    transform: translateX(-100%);  /* Hide sidebar by sliding left */
    position: absolute;
    z-index: 10;
    background-color: #f1f1f1;
  }
  nav.sidebar.show {
    transform: translateX(0);     /* Show sidebar when toggled */
  }
  .main-content {
    margin-left: 0;               /* Remove left margin when sidebar hidden */
  }
}

/* Hamburger menu toggle button styles, hidden by default */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  margin-right: 10px;
  cursor: pointer;
}

/* Show hamburger menu on small screens */
@media (max-width: 700px) {
  .menu-toggle {
    display: block;
  }
}


