/* ===============================
   MelodyStream — Podcast Search Page
   =============================== */


main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 80vh;
  padding: 3rem 2rem;
  gap: 2rem;

  max-width: 1000px;
  width: 90%;
  margin: 0 auto;
}


main h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-azul2);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

main h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-top: 1rem;
  color: var(--color-azul1);
  text-align: center;
}


.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 900px;
}

#searchInput {
  flex: 1;
  min-width: 250px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  color: var(--color-blanco);
  transition: all 0.3s ease;
}

#searchInput:focus {
  outline: none;
  border-color: var(--color-azul1);
  box-shadow: 0 0 0 3px rgba(62, 154, 222, 0.3);
}

#searchInput::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

#headerProfileIm img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

#headerProfileIm {
  display: flex;
  align-items: center;
  margin-right: 20px;
}

/* Botones */
#searchButton,
#uploadPodcastBtn,
#createFolderBtn {
  background-color: var(--color-azul1);
  border: none;
  color: var(--color-blanco);
  padding: 0.7rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s;
}

#searchButton:hover,
#uploadPodcastBtn:hover,
#createFolderBtn:hover {
  background-color: var(--color-azul2);
  transform: scale(1.05);
}

#uploadPodcastBtn {
  background-color: var(--color-morado);
}

#uploadPodcastBtn:hover {
  background-color: #4324a8;
}

#createFolderBtn {
  background-color: #28a745;
}

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


#foldersList,
#podcastList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
  justify-content: center;
  align-items: start;
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

.podcast-card {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px; 
  padding: 1rem;
  
  transition: all 0.3s ease;
  text-align: center;
  
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 
    0 0 8px rgba(62, 154, 222, 0.3);
  
  display: flex;
  flex-direction: column;

  min-height: unset; 
  height: auto; 

  align-items: center;

  max-width: 250px;
  width: 100%;

  justify-self: center;
}

.podcast-card:hover {
  transform: translateY(-3px); 
  border-color: var(--color-azul2);
  box-shadow: 0 6px 20px rgba(62, 154, 222, 0.25), 
    0 0 12px rgba(62, 154, 222, 0.5);
}

.podcast-card img {
  width: 150px;
  height: 150px;

  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  flex-shrink: 0;

  border: 2px solid var(--color-azul2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.podcast-card h3 {
  font-size: 1.3rem;
  color: var(--color-azul2);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-shrink: 0;
}

.podcast-card p {
  font-size: 0.95rem;
  color: var(--color-blanco);
  opacity: 0.85;
  margin-bottom: 0.6rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.podcast-card .podcast-uploader {
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.podcast-card audio {
  width: 100%;
  margin-top: auto;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.podcast-card button {
  margin-top: auto;
  flex-shrink: 0;
}

.podcast-card button:not(:last-child) {
  margin-bottom: 0.4rem;
}


.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-outline-primary {
  background-color: var(--color-azul1);
  color: var(--color-blanco);
}

.btn-outline-primary:hover {
  background-color: var(--color-azul2);
  transform: scale(1.05);
}

.btn-outline-danger {
  background-color: #dc3545;
  color: var(--color-blanco);
}

.btn-outline-danger:hover {
  background-color: #c82333;
  transform: scale(1.05);
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}


#folder-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

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

#folder-modal > div {
  background: #0a0a0a;
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 100%);
  max-width: 1100px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Scrollbar personalizada para el modal */
#folder-modal > div::-webkit-scrollbar {
  width: 10px;
}

#folder-modal > div::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

#folder-modal > div::-webkit-scrollbar-thumb {
  background: rgba(62, 154, 222, 0.6);
  border-radius: 10px;
}

#folder-modal > div::-webkit-scrollbar-thumb:hover {
  background: rgba(62, 154, 222, 0.8);
}

#folder-modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  padding: 10px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
  z-index: 10;
}

#folder-modal-close:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

#folder-modal-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-azul2);
  margin-bottom: 2rem;
  padding-right: 100px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-empty-message {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2rem;
  font-style: italic;
}

/* User select modal */
.user-select-overlay {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.user-select-box {
  width: 400px;
  max-width: 90%;
  max-height: 70vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.user-select-box h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #333;
  font-size: 1.4rem;
}

.user-select-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.user-select-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

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

.user-select-info strong {
  color: #333;
  display: block;
  margin-bottom: 4px;
}

.user-select-email {
  font-size: 0.85rem;
  color: #666;
}

.user-select-btn {
  margin-left: 12px;
  background-color: var(--color-azul1);
  color: white;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.user-select-btn:hover {
  background-color: var(--color-azul2);
}

.user-select-cancel {
  width: 100%;
  background-color: #6c757d;
  color: white;
  padding: 10px;
}

.user-select-cancel:hover {
  background-color: #5a6268;
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 768px) {
  .search-row {
    flex-direction: column;
  }

  #searchInput {
    width: 100%;
  }

  #folder-modal > div {
    padding: 20px;
  }

  #folder-modal-title {
    font-size: 1.5rem;
    padding-right: 60px;
  }

}

@media (max-width: 600px) {
  main h1 {
    font-size: 2rem;
  }

  main h2 {
    font-size: 1.5rem;
  }

}

.folder-btn-row {
  display: block; 
}


.podcast-card .btn {
  width: 100% !important;    
  min-width: 0 !important;
  padding: 0.6rem 1.2rem;
  box-sizing: border-box;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.podcast-card .btn + .btn {
  margin-top: 0.6rem;
}

@media (max-width: 480px) {
  .podcast-card .btn { width: 100% !important; }
}


#folder-modal .podcast-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  backdrop-filter: blur(6px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  color: var(--color-blanco);
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  max-width: 250px;
  width: 100%;
  justify-self: center;
}

#folder-modal .podcast-card:hover {
  transform: scale(1.03);
  box-shadow: 0 0 15px rgba(62, 154, 222, 0.4);
}

#folder-modal .podcast-card img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  border: 2px solid var(--color-azul2);
}

#folder-modal .podcast-card h4,
#folder-modal .podcast-card h3 {
  color: var(--color-blanco);
  font-weight: 700;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}

#folder-modal .podcast-card p {
  color: #e0e0e0;
  font-weight: 400;
  margin: 0;
  font-size: 0.9rem;
}

#folder-modal .podcast-card audio {
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 6px;
  outline: none;
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ensure modal grid matches profile layout */
#folder-modal > div #folder-podcast-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* Normalize podcast thumbnail size everywhere (folders modal + modal-podcast-item */
#folder-modal .podcast-card img,
.modal-podcast-item img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  border: 2px solid var(--color-azul2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


.top-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 900px;
}

#createBtn,
#uploadPodcastBtn,
#createFolderBtn {
  background-color: var(--color-azul1);
  border: none;
  color: var(--color-blanco);
  padding: 0.8rem 1.6rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s;
}

#createBtn:hover,
#uploadPodcastBtn:hover,
#createFolderBtn:hover {
  background-color: var(--color-azul2);
  transform: scale(1.05);
}

#uploadPodcastBtn { background-color: var(--color-morado); }
#uploadPodcastBtn:hover { background-color: #4324a8; }
#createFolderBtn { background-color: #28a745; }
#createFolderBtn:hover { background-color: #218838; }

/* ===============================
   SEARCH BOX 
   =============================== */
.search-box {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.search-type {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.radio-pill {
  cursor: pointer;
  user-select: none;
}

.radio-pill input {
  display: none;
}

.radio-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: var(--color-blanco);
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.radio-pill input:checked + span {
  background: rgba(62, 154, 222, 0.18);
  border-color: rgba(62, 154, 222, 0.55);
  transform: scale(1.02);
}

/* ===============================
   RESULTS GRID
   =============================== */
#resultsList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
  justify-content: center;
  align-items: start;
  gap: 1rem;
  width: 100%;
  margin-top: 1rem;
}

/* Results list (new page layout) */
#resultsList{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  justify-content: center;
  align-items: start;
  width: 100%;
  margin-top: 1rem;
}

/* Ensure audio controls have enough width to show time */
.podcast-card audio{
  width: 100%;
  min-width: 210px;
}

#viewAllButton{
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-blanco);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

#viewAllButton:hover{
  background: rgba(255,255,255,0.12);
  transform: scale(1.03);
}

#resultsList > h3{
  grid-column: 1 / -1;
}

.top-actions #viewAllButton{
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-blanco);
}
.top-actions #viewAllButton:hover{
  background: rgba(255,255,255,0.12);
}

.user-select-search {
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0 12px;
  color: #000000;             
  caret-color: #000000;        
  border-radius: 10px;
  outline: none;
}

.user-select-search::placeholder {
  color: rgba(255,255,255,0.6);
}

.user-select-empty{
  opacity: .7;
  padding: 10px;
}

