/* General Styles */

/* Sidebar */
#sidebar {
  width: 220px;
  background: #222;
  position: fixed;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.otstup {
  margin-top: auto !important;
}
#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Кнопки в sidebar */
.sidebar-btn {
  width: 90%;
  margin: 12px auto;
  padding: 0.7rem 0;
  background: linear-gradient(90deg, #f7b6c2 0%, #b2d8f7 100%);
  color: #444;
  border: none;
  border-radius: 5px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  text-align: center;
  box-shadow: 0 2px 12px rgba(178, 216, 247, 0.15);
  display: block;
}
.sidebar-btn:hover {
  background: #222;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 94, 174, 0.18);
  transform: translateY(-2px) scale(1.04);
}

/* login button в sidebar */
.login-btn {
  background: linear-gradient(90deg, #f7b6c2 0%, #b2d8f7 100%);
  color: #444;
  border: none;
  margin-right: 30px;       /* смещает кнопку чуть влево */
  display: block;
  border-radius: 5px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(178, 216, 247, 0.15);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: #222;
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 94, 174, 0.18);
  transform: translateY(-2px) scale(1.04);
}

/* Topbar */
#topbar {
  background: #222;
  color: #fff;
  display: flex;
  align-items: center;
  height: 70px;
  position: fixed;
  z-index: 1000;
  width: 19%; /* 220px — ширина sidebar */
  left: 81%;                /* смещаем вправо на ширину sidebar */
  top: 0;
  border-radius: 0 0 0 18px;  /* скругление только слева снизу */
  box-shadow: 0 2px 12px rgba(34,34,34,0.12);
  justify-content: flex-end;  /* контент справа */
  padding-right: 32px;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}
#resultsContainer, .results-popup {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 1000;
    background: #23232a;
    width: 100%;
    min-width: 220px;
    border-radius: 8px;
    box-shadow: 0 2px 8px #000a;
    display: none;
    flex-direction: column;
    margin-top: 4px;
    padding: 8px 0;
}

#resultsContainer.active, .results-popup.active {
    display: flex;
}

.category-button, .video-button {
    display: block;
    width: 100%;
    text-align: left;
    margin: 0;
    padding: 12px 16px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 1em;
    border-bottom: 1px solid #23232a;
    transition: background 0.18s;
}

.category-button:last-child, .video-button:last-child {
    border-bottom: none;
}

.category-button:hover, .video-button:hover {
    background-color: #444;
}

/* Текст в topbar */
#topbar div {
  color: #fff;
  font-weight: bold;
  letter-spacing: 1px;
}

/* video gallery */

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

/* Мобильная адаптация */
@media (max-width: 600px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 220px;
    z-index: 2000;
    background: #222;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 2px 0 16px #000a;
  }
  #sidebar.open {
    transform: translateX(0);
  }
  .container {
    flex-direction: column;
  }
  main {
    margin-left: 0 !important;
    padding: 16px 4px 16px 4px;
    padding-top: 70px;
  }
  #topbar {
    width: 100% !important;
    left: 0 !important;
    border-radius: 0 0 0 0 !important;
    justify-content: flex-start;
    padding-right: 8px;
    padding-left: 8px;
    min-width: 0;
  }
  #searchForm {
    margin-left: 0;
    margin-right: 0;
    flex: 1;
    margin: 0 auto !important;
    float: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100vw;
  }
  #video-gallery {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .pagination {
    margin-top: 16px;
  }
  .login-btn {
    margin-right: 0;
    margin-left: 8px;
  }
  /* Новая кнопка-стрелка для sidebar (теперь круглая) */
  .sidebar-toggle-arrow {
    position: fixed;
    left: 12px;
    top: 45vh;
    z-index: 2101;
    width: 38px;
    height: 38px;
    background: #23232a;
    border: none;
    border-radius: 50%;
    box-shadow: 2px 2px 12px #000a;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 0.35s cubic-bezier(.4,0,.2,1), opacity 0.25s, background 0.2s, box-shadow 0.2s;
    color: #fff;
    font-size: 1.5em;
    padding: 0;
  }
  .sidebar-toggle-arrow:hover {
    background: #444;
    box-shadow: 0 4px 20px #000a;
  }
  .sidebar-toggle-arrow span {
    font-size: 1.6em;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #cat-gallery {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
}

.video-link {
  text-decoration: none;
  color: inherit;
}

.video-card {
  background: #272727;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 20px rgba(178, 216, 247, 0.15);
}

.video-card video {
  width: 100%;
  height: 135px;
  pointer-events: none;
}

.video-info {
  padding: 8px;
}

.video-info h3 {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  color: #fff;
}
/* cat gallery */
#cat-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* pagination */
.pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
}

.pagination button {
  background: #222;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5em;
  margin: 0 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.pagination button:hover {
  background: #444;
}

#pageIndicator {
  font-size: 1.1em;
  color: #d7d7d7;
}
.fade-out {
  opacity: 0;
  transition: opacity 0.5s;
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
  opacity: 0;
  pointer-events: none;
}
.modal.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.modal.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.login-modal-content {
  background: #23272f;
  padding: 2.5rem 2rem 2rem 2rem;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(178, 216, 247, 0.15);
  width: 100%;
  max-width: 350px;
  color: #fff;
  position: relative;
  animation: modalFadeIn 0.4s;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@keyframes modalFadeIn {
  from {
    transform: translateY(40px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
.close-btn {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 1.5em;
  color: #fff;
  cursor: pointer;
  transition: color 0.2s;
}
.close-btn:hover {
  color: #66a6ff;
}
.login-title {
  margin-bottom: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #66a6ff;
}
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.login-form label {
  margin-bottom: 0.4rem;
  color: #b0b8c1;
  font-size: 1rem;
}
.login-form input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #444;
  border-radius: 8px;
  font-size: 1rem;
  background: #181a20;
  color: #fff;
  transition: border 0.2s;
}
.login-form input:focus {
  border-color: #66a6ff;
  outline: none;
}
.login-submit-btn {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(90deg, #66a6ff 0%, #89f7fe 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}
.login-submit-btn:hover {
  background: linear-gradient(90deg, #89f7fe 0%, #66a6ff 100%);
}

/* Search form */
#searchForm {
  display: flex;
  align-items: center;
  margin-right: 18px;
  background: #18181a;
  border-radius: 6px;
  padding: 0 4px 0 0;
  margin-left: 100px;
}

#searchInput {
  padding: 11px 14px;
  border: none;
  border-radius: 6px 0 0 6px;
  font-size: 1em;
  background: #18181a;
  color: #fff;
  outline: none;
}

#searchForm button[type="submit"] {
  background: #18181a;
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  padding: 11px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#searchForm button[type="submit"]:hover {
  background: #ff2a2a;
  color: #fff;
}
/* Video Styles */

.action-btn {
  background: linear-gradient(90deg, #f7b6c2 0%, #b2d8f7 100%);
  color: #444;
  border: none;
  border-radius: 5px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(178, 216, 247, 0.15);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.action-btn:hover {
  background: linear-gradient(90deg, #222 0%, #222 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 65, 108, 0.25);
  transform: translateY(-2px) scale(1.04);
}
.video-player {
  width: 100%;
  border-radius: 8px;
}
.actions {
  margin: 16px 0;
  display: flex;
  gap: 16px;
}
.comments-section {
  margin-top: 32px;
}
.comment-form textarea {
  width: 100%;
  height: 60px;
  border-radius: 5px;
  border: 1px solid #ccc;
  padding: 8px;
  resize: vertical;
  background: #222;
}
.comment-form button {
  margin-top: 8px;
  background: linear-gradient(90deg, #f7b6c2 0%, #b2d8f7 100%);
}
.comment {
  background: #222;
  border-radius: 5px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.comment-author {
  font-weight: bold;
  margin-bottom: 4px;
}
.comment-date {
  color: #888;
  font-size: 12px;
  margin-bottom: 4px;
}

#video-content {
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.5s;
  will-change: transform, opacity;
  position: relative;
}
.slide-out-left {
  transform: translateX(-120%);
  opacity: 0;
}
.slide-in-right {
  transform: translateX(120%);
  opacity: 0;
}
.slide-in-right-active {
  transform: translateX(0);
  opacity: 1;
}
.slide-out-right {
  transform: translateX(120%);
  opacity: 0;
}
.slide-in-left {
  transform: translateX(-120%);
  opacity: 0;
}
.slide-in-left-active {
  transform: translateX(0);
  opacity: 1;
}
