/* --- Сброс и Глобальные стили --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Arial', sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  /* Убираем дефолтный фон */
  background: none;
}

/* --- Фон (обёртка) --- */
.wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Основной синий VK-подобный градиент */
  background: #4c7cbf;
  background: -webkit-linear-gradient(to bottom, #4c7cbf, #0077b5);
  background: linear-gradient(to bottom, #4c7cbf, #0077b5);
}

/* --- Основной контейнер платформы --- */
.vk-platform {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh; /* Обеспечиваем заполнение по высоте */
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 20;
  /* Прозрачный фон, чтобы видеть гамму градиента */
  background: transparent;
}

/* --- Анимации --- */
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

/* --- Заголовок платформы --- */
.platform-header {
  text-align: center;
  margin-bottom: 3rem;
}

.platform-title {
  font-size: 2.5rem;
  color: #1858d9;  /* Белый для четкого контраста с синим фоном */
  margin-bottom: 1rem;
  animation: slideInLeft 0.6s ease-out forwards;
}

.platform-description {
  font-size: 1.1rem;
  color: #000;
  animation: slideInRight 0.6s ease-out forwards;
}

/* --- Поисковая панель --- */
.search-wrapper {
  position: relative;
  max-width: 800px;
  margin: 0 auto 3rem;
  flex-shrink: 0;
}

.search-container {
  display: flex;
  gap: 1rem;
  background: #ffffff; /* Белый фон для контейнера ввода */
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  padding: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 1rem 2rem;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  color: #333;
}

.search-input::placeholder {
  color: #999;
}

.search-button {
  position: relative;
  padding: 1rem 3rem;
  border: none;
  border-radius: 40px;
  background: linear-gradient(135deg, #2787F5 0%, #1A5DAB 100%);
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39, 135, 245, 0.3);
}

.button-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --- Результаты поиска --- */
.results-container {
  background-color: transparent;  /* Прозрачность для гармонии с фоном */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 1rem;
  flex-grow: 1;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

/* Кастомный скроллбар для результатов */
.results-container::-webkit-scrollbar {
  width: 8px;
}
.results-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
.results-container::-webkit-scrollbar-thumb {
  background: #2787F5;
  border-radius: 4px;
}
.results-container::-webkit-scrollbar-thumb:hover {
  background: #1A5DAB;
}

/* --- Видео карточки и блоки --- */
.video-card,
.video-box {
  background: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover,
.video-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.video-iframe {
  width: 100%;
  border: none;
}

.video-info {
  padding: 1rem;
}

.video-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #333;
}

/* --- Действия (кнопки) --- */
.actions {
  display: flex;
  gap: 0.5rem;
}

.download-btn,
.retry-button,
.download-button,
.edit-button {
  padding: 8px 15px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.download-btn:hover,
.retry-button:hover,
.download-button:hover,
.edit-button:hover {
  background: #005bb5;
}

/* --- Оверлей загрузки --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
}

.loader {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2787F5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.loading-text {
  font-size: 1.2rem;
  color: #333;
}

/* --- Уведомление об ошибке --- */
.error-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #ff4757;
  color: white;
  padding: 1rem 2rem;
  border-radius: 10px;
  animation: slideInRight 0.3s ease-out;
}

.error-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Адаптация для мобильных устройств --- */
@media (max-width: 768px) {
  .search-container {
    flex-direction: column;
    border-radius: 25px;
    padding: 1rem;
  }
  .search-button {
    width: 100%;
    border-radius: 25px;
  }
  .results-container {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 300px);
  }
}
