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

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

body {
  font-family: 'Inter', sans-serif;
  background-color: #f8fafc;
  color: #374151;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ======= HEADER ======= */
.header {
  background: #ffffff;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 4rem;
}

.logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  color: #4f46e5;
}

.logo-text {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-left: 0.5rem;
}

.search-bar {
  display: flex;
  flex: 1;
  max-width: 36rem;
  margin: 0 2rem;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: #ffffff;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-bar button {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
}

.search-bar button:hover {
  color: #4f46e5;
}

.search-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.header-icons {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.icon-btn {
  padding: 0.5rem;
  border-radius: 50%;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ======= LAYOUT ======= */
.main-wrapper {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 0; /* Убрал горизонтальные отступы */
  gap: 2rem;
  flex: 1;
  width: 100%;
}

/* ======= SIDEBAR ======= */
.sidebar {
  width: 160px; /* Еще уже сайдбар */
  flex-shrink: 0;
  margin-left: 0; /* Прижимаем к левому краю */
  padding-left: 1.5rem; /* Отступ только слева */
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.75rem; /* Уменьшил отступы */
  text-decoration: none;
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0.5rem 0 0 0.5rem; /* Закругление только слева */
  transition: all 0.2s;
  margin-right: 0; /* Убрал отступ справа */
}

.nav-item:hover {
  background: #f3f4f6;
  color: #374151;
}

.nav-item.active {
  background: #eef2ff;
  color: #4f46e5;
}

.nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  margin-right: 0.5rem;
}

/* ======= MAIN CONTENT ======= */
.main-content {
  flex: 1;
  min-width: 0;
  padding-right: 1.5rem; /* Отступ только справа */
}

.content-header {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
}

/* ======= VIDEO GRID ======= */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.video-card {
  background: #ffffff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #f3f4f6;
  min-width: 0;
}

.video-card:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 5px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Video Thumbnail */
.video-thumbnail {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #f3f4f6;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
  transform: scale(1.05);
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: all 0.3s ease;
}

.video-card:hover .play-button {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.play-button i {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.125rem;
}

/* Video Info */
.video-info {
  padding: 1rem;
  min-width: 0;
}

.video-details {
  min-width: 0;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.video-description {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
}

.video-category {
  font-size: 0.7rem;
  color: #4f46e5;
  background: #eef2ff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  display: inline-block;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* ======= FOOTER ======= */
.footer {
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-link {
  color: #6b7280;
  transition: color 0.2s;
}

.social-link:hover {
  color: #4f46e5;
}

.copyright {
  font-size: 0.875rem;
  color: #6b7280;
}

/* ======= ERROR STATES ======= */
.error-message {
  text-align: center;
  padding: 2rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  color: #dc2626;
  margin: 1rem 0;
}

.error-message button {
  background: #dc2626;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.error-message button:hover {
  background: #b91c1c;
}

.error-message ul {
  text-align: left;
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.error-message li {
  margin: 0.5rem 0;
}

/* ======= RESPONSIVE DESIGN ======= */
@media (max-width: 1400px) {
  .header-container,
  .main-wrapper,
  .footer-content {
    max-width: 1200px;
  }
  
  .video-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }
}

@media (max-width: 1200px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .sidebar {
    width: 150px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }
  
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  
  .main-content {
    padding: 0 1.5rem; /* Добавляем отступы когда сайдбар скрыт */
  }
}

@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .search-bar {
    max-width: 28rem;
    margin: 0 1.5rem;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 1rem;
  }
  
  .search-bar {
    margin: 0 1rem;
    max-width: 24rem;
  }
  
  .content-header {
    margin-bottom: 1.5rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  
  .main-wrapper {
    padding: 1.25rem 0;
  }
  
  .main-content {
    padding: 0 1rem;
  }
}

@media (max-width: 640px) {
  .search-bar {
    display: none;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .header-icons {
    gap: 0.5rem;
  }
  
  .logo-text {
    font-size: 1.25rem;
  }
  
  .video-info {
    padding: 1rem;
  }
  
  .video-title {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 0.75rem;
  }
  
  .main-content {
    padding: 0 0.75rem;
  }
  
  .footer-content {
    padding: 2rem 1rem;
  }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 3rem 2rem;
  color: #6b7280;
  font-size: 1rem;
  grid-column: 1 / -1;
}

/* ======= PAGINATION ======= */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 2rem;
  padding: 0 1rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
  justify-content: center;
}

.pagination-btn:hover:not(.disabled) {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.pagination-btn.disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pagination-btn i {
  width: 1.125rem;
  height: 1.125rem;
}

.pagination-pages {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.page-number {
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 3rem;
  text-align: center;
}

.page-number:hover:not(.active) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.page-number.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  cursor: default;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
  text-align: center;
}

/* Адаптивность пагинации */
@media (max-width: 768px) {
  .pagination-controls {
    gap: 0.75rem;
  }
  
  .pagination-btn {
    padding: 0.625rem 1rem;
    min-width: 80px;
    font-size: 0.8rem;
  }
  
  .page-number {
    padding: 0.625rem 0.875rem;
    min-width: 2.5rem;
    font-size: 0.8rem;
  }
  
  .pagination-pages {
    gap: 0.375rem;
  }
}

@media (max-width: 640px) {
  .pagination-controls {
    flex-direction: column;
    gap: 1rem;
  }
  
  .pagination-pages {
    order: -1;
  }
  
  .pagination-btn {
    width: 100%;
    max-width: 200px;
  }
}

/* ======= VIDEO PLAYER PAGE ======= */
.video-player-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.back-button {
  margin-bottom: 2rem;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
  background: #f8fafc;
  border-color: #d1d5db;
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.video-player-wrapper {
  margin-bottom: 2.5rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  background: #000;
}

.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.video-player iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-details {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
}

.video-details h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  word-wrap: break-word;
}

.video-actions {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  color: #374151;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 140px;
  justify-content: center;
}

.action-btn:hover {
  background: #ffffff;
  border-color: #d1d5db;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-btn.like-btn:hover {
  color: #059669;
  border-color: #059669;
}

.action-btn.dislike-btn:hover {
  color: #dc2626;
  border-color: #dc2626;
}

.action-btn.share-btn:hover {
  color: #2563eb;
  border-color: #2563eb;
}

.action-btn i {
  width: 1.25rem;
  height: 1.25rem;
}

.video-info-expanded {
  margin-top: 1rem;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.category-badge {
  background: #eef2ff;
  color: #4f46e5;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.publish-date {
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
}

.video-description {
  color: #374151;
  line-height: 1.7;
  font-size: 1.05rem;
  white-space: pre-line;
  word-wrap: break-word;
}

/* Адаптивность для страницы видео */
@media (max-width: 1024px) {
  .video-details {
    padding: 2rem;
  }
  
  .video-details h1 {
    font-size: 1.5rem;
  }
  
  .video-player-wrapper {
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .video-player-container {
    padding: 0 0.5rem;
  }
  
  .video-details {
    padding: 1.5rem;
  }
  
  .video-details h1 {
    font-size: 1.375rem;
  }
  
  .action-buttons {
    justify-content: space-between;
  }
  
  .action-btn {
    flex: 1;
    min-width: auto;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .video-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .back-button {
    margin-bottom: 1.5rem;
  }
  
  .back-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .video-details {
    padding: 1.25rem;
  }
  
  .video-details h1 {
    font-size: 1.25rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
  }
  
  .video-description {
    font-size: 1rem;
  }
  
  .sidebar {
    display: none;
  }
}

@media (max-width: 480px) {
  .video-player-container {
    padding: 0 0.25rem;
  }
  
  .video-details {
    padding: 1rem;
  }
  
  .video-details h1 {
    font-size: 1.125rem;
  }
  
  .back-btn {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
  }
}

/* ======= MOBILE MENU STYLES ======= */

/* Header left section for mobile */
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* Menu toggle button - hidden on desktop */
.menu-toggle {
  display: none;
  padding: 0.5rem;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: #f3f4f6;
  color: #374151;
}

.menu-icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* Mobile overlay */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar header for mobile */
.sidebar-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
  background: #ffffff;
}

.sidebar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.sidebar-close {
  padding: 0.375rem;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.sidebar-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.close-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* ======= MOBILE RESPONSIVE STYLES ======= */

@media (max-width: 1024px) {
  /* Show menu toggle on mobile */
  .menu-toggle {
    display: block;
  }
  
  /* Hide default sidebar on mobile */
  .sidebar {
    display: none;
  }
  
  /* Mobile sidebar styles */
  .sidebar.mobile-active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    margin: 0;
    padding: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
  }
  
  .sidebar.mobile-active.active {
    transform: translateX(0);
  }
  
  .sidebar-header {
    display: flex;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10000;
  }
  
  .sidebar-nav {
    padding: 0 0.75rem 2rem;
    height: calc(100vh - 80px);
    overflow-y: auto;
  }
  
  .nav-item {
    border-radius: 0.5rem;
    margin: 0.25rem 0;
    font-size: 0.9rem;
    padding: 0.875rem 0.75rem;
    border: none;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.2s;
  }
  
  .nav-item:hover {
    background: #f3f4f6;
    color: #374151;
  }
  
  .nav-item.active {
    background: #eef2ff;
    color: #4f46e5;
  }
  
  .nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
  }
}

@media (max-width: 768px) {
  .sidebar.mobile-active {
    width: 260px;
  }
  
  .header-container {
    padding: 0 1rem;
  }
  
  .header-left {
    gap: 0.75rem;
  }
}

@media (max-width: 640px) {
  .sidebar.mobile-active {
    width: 100%;
  }
  
  .menu-toggle {
    padding: 0.375rem;
  }
  
  .menu-icon {
    width: 1.375rem;
    height: 1.375rem;
  }
}

@media (max-width: 480px) {
  .sidebar-header {
    padding: 0.875rem 1rem;
  }
  
  .sidebar-title {
    font-size: 1rem;
  }
  
  .sidebar-nav {
    padding: 0 0.5rem 1.5rem;
  }
  
  .nav-item {
    padding: 0.75rem 0.625rem;
    font-size: 0.875rem;
  }
  
  .nav-icon {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.625rem;
  }
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Desktop sidebar styles */
@media (min-width: 1025px) {
  .sidebar {
    display: block !important;
    position: static !important;
    width: 160px !important;
    transform: none !important;
    height: auto !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  .sidebar-header {
    display: none !important;
  }
  
  .sidebar-nav {
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .nav-item {
    margin-right: 0 !important;
    border-radius: 0.5rem 0 0 0.5rem !important;
  }
}