/* General styles for the project */
body {
  background-color: #f8f9fa;
}

.card {
  border-radius: 10px;
}

h2 {
  margin-bottom: 30px;
}

.playlist-container {
  overflow: auto;
  max-height: 80vh; /* Adjust as needed */
}

.btn-primary {
  background-color: #007bff;
  border-color: #007bff;
}

.chapter-drag-handle {
  cursor: grab;
  color: #6c757d;
}

.chapter-drag-handle:active {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-chapters .chapter-item {
  margin: 10px 0;
  padding: 10px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
}

/* Modal styles */
.modal-content {
  border-radius: 10px;
}

/* Ensure modals are scrollable */
.modal {
  overflow-y: auto !important;
}

.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-dialog {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-content {
  max-height: 100%;
  overflow-y: auto;
}

.modal-body {
  overflow-y: auto;
}

.modal-footer {
  flex-shrink: 0;
}

/* Video styles */
.video-title {
  font-weight: bold;
  margin-bottom: 3px;
  font-size: 0.9em;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.4;
}

.video-item {
  background-color: transparent;
  border: none;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 5px;
  padding: 10px 5px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.9em;
}

.video-item:last-child {
  border-bottom: none;
}

.video-item:hover {
  background-color: rgba(0, 123, 255, 0.1);
}

.video-item.active {
  background-color: #007bff;
  color: white;
}

.video-item.active .video-note {
  color: rgba(255, 255, 255, 0.8);
}

#sidebarContainer {
  transition: all 0.3s;
  max-width: 350px; /* Increased from 250px */
  width: 100%; /* Added to ensure it takes full width up to max-width */
  background-color: #f8f9fa;
  border-radius: 5px;
  padding: 15px;
  max-height: 80vh;
  overflow-y: auto;
}

#videoList {
  max-height: 400px;
  overflow-y: auto;
}

hr {
  border-top: 2px solid #007bff;
  width: 50%;
  margin: 20px auto;
}

#editNoteModal {
  z-index: 1051;
}

#playlistUsersModal {
  padding-right: 0 !important;
}

#playlistUsersModal .modal-dialog {
  max-width: 90%;
  margin: 1.75rem auto;
}

#playlistUsersModal .modal-content {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#playlistUsersModal .modal-body {
  flex: 1;
  overflow-y: auto;
}

#playlistUsersContainer {
  overflow-y: visible;
}

/* Additional styling for responsiveness */
@media (max-width: 768px) {
  #playlistUsersModal {
    width: 90%;
    max-width: 100%;
  }
}

body.modal-open {
  overflow: hidden;
  padding-right: 15px; /* Prevents layout shift */
}

.modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}

.state-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.state-changed {
  transition: background-color 0.3s ease;
  background-color: #f8f9fa;
}

.dropdown-item[data-state="green"] {
  color: green;
}
.dropdown-item[data-state="yellow"] {
  color: #ffc107;
}
.dropdown-item[data-state="red"] {
  color: red;
}
.dropdown-item[data-state="purple"] {
  color: purple;
}
.dropdown-item[data-state="grey"] {
  color: grey;
}

.state-dropdown .dropdown-item {
  display: flex;
  align-items: center;
}

.state-dropdown .dropdown-item::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 10px;
}

.state-dropdown .dropdown-item[data-state="green"]::before {
  background-color: green;
}

.state-dropdown .dropdown-item[data-state="yellow"]::before {
  background-color: #ffc107;
}

.state-dropdown .dropdown-item[data-state="red"]::before {
  background-color: red;
}

.state-dropdown .dropdown-item[data-state="purple"]::before {
  background-color: purple;
}

.state-dropdown .dropdown-item[data-state="grey"]::before {
  background-color: grey;
}

@media (max-width: 768px) {
  .dropdown-toggle {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 15px;
    margin-bottom: 10px;
  }

  .list-group-item {
    padding: 15px;
  }

  .dropdown-menu {
    min-width: 200px;
  }

  .dropdown-item {
    padding: 10px 15px;
  }
}

#manageFilesModal {
  z-index: 1070;
}

#manageFilesModal .modal-dialog {
  max-width: 95%;
  width: 95%;
}

#manageFilesModal .modal-content {
  background: linear-gradient(135deg, #e1f5fe, #81d4fa);
  border-radius: 20px;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#manageFilesModal .modal-header {
  background-color: #0288d1;
  color: white;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 25px;
}

#manageFilesModal .modal-title {
  font-size: 1.8em;
  font-weight: bold;
}

#manageFilesModal .close {
  color: white;
  opacity: 1;
  text-shadow: none;
  font-size: 1.5em;
}

#manageFilesModal .modal-body {
  padding: 40px;
}

#fileList {
  max-height: 500px;
  overflow-y: auto;
}

#fileList .list-group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.8);
  margin-bottom: 15px;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
}

#fileList .list-group-item:hover {
  background-color: white;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#uploadFileForm {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

#uploadFileForm .btn-primary {
  background-color: #0288d1;
  border-color: #0288d1;
}

.file-item {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.file-item h4 {
  margin-bottom: 10px;
}

#videoPlayerContainer {
  background-color: rgba(255, 255, 255, 0.1);
  max-height: 70vh;
  overflow: hidden;
}

.embed-responsive {
  max-height: 100%;
}

.embed-responsive-16by9::before {
  padding-top: 56.25%; /* This maintains the 16:9 aspect ratio */
}

.file-item embed {
  border: 1px solid #ddd;
  border-radius: 4px;
}

.pagination {
  margin-top: 20px;
}

.pagination .page-link {
  color: #007bff;
}

.pagination .page-item.active .page-link {
  background-color: #007bff;
  border-color: #007bff;
}

.playlist {
  margin-bottom: 20px;
}

.chapters-list {
  list-style-type: none;
  padding-left: 0;
}

.chapter-item {
  margin-bottom: 10px;
}

.video-list {
  list-style-type: none;
  padding-left: 20px;
}

.video-item {
  cursor: pointer;
  padding: 5px;
}

.video-item:hover {
  background-color: #f0f0f0;
}

.unassigned {
  margin-top: 20px;
  border-top: 1px solid #ccc;
  padding-top: 10px;
}

.chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.chapter-title {
  font-weight: bold;
}

.toggle-chapter {
  padding: 0.25rem 0.5rem;
}

.chapter-videos {
  margin-top: 0.5rem;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 1000px;
  opacity: 1;
  overflow: hidden;
}

.chapter-item.collapsed .chapter-videos {
  max-height: 0;
  opacity: 0;
}

.chapter-item.collapsed .toggle-chapter i {
  transform: rotate(0deg);
}

.chapter-item:not(.collapsed) .toggle-chapter i {
  transform: rotate(90deg);
}

.toggle-video-details {
  transition: transform 0.3s;
}

.toggle-video-details[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.video-input-group {
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.video-details {
  padding-top: 1rem;
}

.dropdown-item[data-state="black"] {
  color: black;
}
.dropdown-item[data-state="blue"] {
  color: blue;
}
.state-dropdown .dropdown-item[data-state="black"]::before {
  background-color: black;
}
.state-dropdown .dropdown-item[data-state="blue"]::before {
  background-color: blue;
}

/* Playlist Sorting Styles */
.playlist-drag-handle {
  cursor: grab;
  color: #6c757d;
  transition: color 0.2s ease;
}

.playlist-drag-handle:hover {
  color: #495057;
}

.playlist-drag-handle:active {
  cursor: grabbing;
  color: #343a40;
}

.playlist-item {
  transition: all 0.2s ease;
}

.playlist-item:hover {
  background-color: #f8f9fa;
}

.sortable-ghost {
  opacity: 0.5;
  background-color: #e9ecef;
}

.sortable-chosen {
  background-color: #fff3cd;
  border-color: #ffeaa7;
}

.sortable-drag {
  opacity: 0.8;
  transform: rotate(5deg);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Ensure playlist items maintain proper spacing during drag */
#playlistList .list-group-item {
  margin-bottom: 0;
  border-radius: 0;
}

#playlistList .list-group-item:first-child {
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

#playlistList .list-group-item:last-child {
  border-bottom-left-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
}
