html,
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(135deg, #1e1e2e, #2a2a3e);
  color: #ffffff;
  overflow-x: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  flex-wrap: wrap;
  gap: 20px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.control-btn {
  padding: 10px 20px;
  background: #4ecdc4;
  color: #1e1e2e;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: #45b7aa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.control-btn.small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.settings-group {
  display: flex;
  gap: 10px;
}

.notification {
  background: #ff6b6b;
  color: #ffffff;
  padding: 10px 20px;
  text-align: center;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.notification button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  font-size: 1.2rem;
  color: #ffffff;
  pointer-events: none;
}

#searchInput {
  padding: 10px 10px 10px 40px;
  width: 250px;
}

.filter-sort {
  display: flex;
  gap: 10px;
}

.control-select {
  padding: 10px;
  border: none;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  color: #1e1e2e;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.control-select:focus {
  outline: none;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

h1 {
  margin: 0;
  font-size: 2rem;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

input[type='file'],
input[type='text'],
select {
  padding: 10px;
  border: none;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input[type='file']::file-selector-button {
  background: #4ecdc4;
  color: #1e1e2e;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.3s ease;
}

input[type='file']::file-selector-button:hover {
  background: #45b7aa;
}

input[type='text']:focus,
select:focus {
  outline: none;
  /* background: rgba(255, 255, 255, 0.2); */
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

main {
  padding: 20px;
  min-height: calc(100vh - 100px); /* Adjust based on header height */
}

#videoGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 250px);
  gap: 20px;
  height: 100%;
  justify-content: center;
}

.video-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-item {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
  width: 100%;
  height: auto;
}

.video-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

.video-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-item:hover .video-preview {
  opacity: 1;
}

.video-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 15px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.video-duration {
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
}

.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.favorite-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.video-title {
  font-size: 1rem;
  font-weight: bold;
  margin: 5px 0 0 0;
  text-align: center;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 250px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

#fullscreenVideo {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
}

#closeFullscreen {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #ff6b6b;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

#closeFullscreen:hover {
  background: #ff5252;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  font-size: 3rem;
  cursor: pointer;
  padding: 20px;
  border-radius: 10px;
  transition: background 0.3s ease;
}

.nav-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.nav-left {
  left: 20px;
}

.nav-right {
  right: 20px;
}

.current-video {
  border: 3px solid #4ecdc4;
  box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.video-item {
  animation: fadeIn 0.5s ease-out;
}

.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 46, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 999;
  color: #ffffff;
}

.loader.show {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid #4ecdc4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 50px;
}

.pagination-btn:hover:not(:disabled) {
  background: #4ecdc4;
  color: #1e1e2e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.pagination-btn.active {
  background: #4ecdc4;
  color: #1e1e2e;
  font-weight: bold;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#folderSelect {
  max-width: 300px;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .header-controls {
    flex-direction: column;
    gap: 10px;
  }

  .search-container #searchInput {
    width: 200px;
  }

  .filter-sort {
    flex-direction: column;
    width: 100%;
  }

  .control-select {
    width: 100%;
  }

  #videoGrid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }
}
