@import '../../css/config/index.scss';

.playlist-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.playlist-modal {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s ease;

  .dark_theme & {
    background-color: #2a2a2a;
    color: #fff;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.playlist-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;

  .dark_theme & {
    border-bottom-color: #444;
  }

  h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;

    .dark_theme & {
      color: #fff;
    }
  }
}

.playlist-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.2s ease;

  &:hover {
    color: #333;
  }

  .dark_theme & {
    color: #aaa;

    &:hover {
      color: #fff;
    }
  }
}

.playlist-modal-content {
  display: flex;
  gap: 24px;
  padding: 24px;
  flex: 1;
  overflow: hidden;
}

.playlist-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;

  h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;

    .dark_theme & {
      color: #fff;
    }
  }
}

.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #ccc;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  cursor: help;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: #999;
  }

  .dark_theme & {
    background-color: #555;

    &:hover {
      background-color: #777;
    }
  }
}

.search-box {
  margin-bottom: 12px;

  input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;

    &:focus {
      outline: none;
      border-color: var(--default-theme-color, #009933);
      box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    }

    .dark_theme & {
      background-color: #333;
      border-color: #555;
      color: #fff;

      &:focus {
        border-color: var(--default-theme-color, #009933);
      }
    }
  }
}

.playlist-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  background-color: #f9f9f9;
  max-height: 400px;

  .dark_theme & {
    background-color: #333;
    border-color: #555;
  }

  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;

    .dark_theme & {
      background: #2a2a2a;
    }
  }

  &::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;

    &:hover {
      background: #aaa;
    }

    .dark_theme & {
      background: #555;

      &:hover {
        background: #666;
      }
    }
  }
}

.playlist-list .playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;

  .dark_theme & {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
  }

  &:hover {
    background-color: #f0f7ff;
    border-color: var(--default-theme-color, #009933);

    .dark_theme & {
      background-color: #3a3a3a;
    }
  }

  span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &.playlist-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;

    .dark_theme & {
      background-color: #1a1a1a;
    }

    &:hover {
      background-color: #f5f5f5;
      border-color: #e0e0e0;

      .dark_theme & {
        background-color: #1a1a1a;
        border-color: #444;
      }
    }
  }
}

.add-btn {
  background: none;
  border: none;
  color: #28a745;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;

  &:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #218838;
  }

  .dark_theme & {
    color: #4caf50;

    &:hover {
      background-color: rgba(76, 175, 80, 0.2);
      color: #66bb6a;
    }
  }
}

.remove-btn {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;

  &:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #c82333;
  }

  .dark_theme & {
    color: #ff6b6b;

    &:hover {
      background-color: rgba(255, 107, 107, 0.2);
      color: #ff8787;
    }
  }
}

.create-playlist-btn {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  background-color: var(--default-theme-color, #009933);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background-color: var(--default-theme-color, #009933);
    opacity: 0.9;
  }

  .dark_theme & {
    background-color: var(--default-theme-color, #009933);

    &:hover {
      background-color: var(--default-theme-color, #009933);
      opacity: 0.9;
    }
  }
}

.create-playlist-form {
  padding: 12px;
  background-color: #f0f7ff;
  border: 2px solid var(--default-theme-color, #009933);
  border-radius: 4px;
  margin-bottom: 12px;

  .dark_theme & {
    background-color: #1a3a52;
    border-color: var(--default-theme-color, #009933);
  }

  input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;

    &:focus {
      outline: none;
      border-color: var(--default-theme-color, #009933);
      box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    }

    .dark_theme & {
      background-color: #2a2a2a;
      border-color: #555;
      color: #fff;

      &:focus {
        border-color: var(--default-theme-color, #009933);
      }
    }
  }
}

.create-playlist-buttons {
  display: flex;
  gap: 8px;

  button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .create-btn {
    background-color: #28a745;
    color: white;

    &:hover {
      background-color: #218838;
    }

    .dark_theme & {
      background-color: #4caf50;

      &:hover {
        background-color: #45a049;
      }
    }
  }

  .cancel-btn {
    background-color: #6c757d;
    color: white;

    &:hover {
      background-color: #5a6268;
    }

    .dark_theme & {
      background-color: #555;

      &:hover {
        background-color: #666;
      }
    }
  }
}

.empty-message,
.loading-message {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
  font-style: italic;

  .dark_theme & {
    color: #666;
  }
}

.playlist-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e0e0e0;

  .dark_theme & {
    border-top-color: #444;
  }
}

.playlist-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
  }
}

.playlist-btn-cancel {
  background-color: #e0e0e0;
  color: #333;

  &:hover:not(:disabled) {
    background-color: #d0d0d0;
  }

  .dark_theme & {
    background-color: #444;
    color: #fff;

    &:hover:not(:disabled) {
      background-color: #555;
    }
  }
}

.playlist-btn-proceed {
  background-color: var(--default-theme-color, #009933);
  color: white;

  &:hover:not(:disabled) {
    background-color: var(--default-theme-color, #009933);
    opacity: 0.9;
  }

  .dark_theme & {
    background-color: var(--default-theme-color, #009933);

    &:hover:not(:disabled) {
      background-color: var(--default-theme-color, #009933);
      opacity: 0.9;
    }
  }
}

// Responsive design for smaller screens
@media (max-width: 768px) {
  .playlist-modal {
    max-width: 95%;
  }

  .playlist-modal-content {
    flex-direction: column;
    gap: 16px;
  }

  .playlist-list {
    max-height: 200px;
  }
}
