/* ---------------------------------- */
/* -- Mobile-first layout (Default) -- */
/* ---------------------------------- */
.channel-container {
    /* Stack content vertically on small screens */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%; /* Use height 100% to allow content to scroll if needed */
    padding: 10px;
    box-sizing: border-box;
    gap: 15px; /* Adds space between the player and playlist */
}

.video-player-wrapper {
    /* Use a flexible width for the player */
    width: 100%; 
    /* Maintain vertical aspect ratio with a modern approach */
    aspect-ratio: 16 / 9; 
    
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#channel-player {
    width: 100%;
    height: 100%;
}

.playlist-container {
    width: 100%;
    max-width: 350px;
    height: 100%; /* Let the height be determined by content */
    max-height: 300px; /* Limit max height for better mobile scrolling */
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 15px;
}

/* Add this new section for the description box */
/* ---------------------------------- */
/* -- Playlist Description Styling -- */
/* ---------------------------------- */
.playlist-description-box {
    padding: 12px;
    margin-bottom: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    transition: all 0.3s ease;

    border-left: 4px solid #1e90ff; /* Accent line for emphasis */
}

/* Hide the box when it's empty */
.playlist-description-box:empty {
    display: none;
}

/* ------------------------------------ */
/* -- Desktop and tablet layout -- */
/* ------------------------------------ */
@media (min-width: 768px) {
    .channel-container {
        flex-direction: row; /* Switch to a side-by-side layout */
        height: 100vh;
        gap: 20px;
    }

    .playlist-container {
        max-height: 560px; /* Adjust height for larger screens */
    }
}

/* ---------------------------------- */
/* -- Existing playlist styling -- */
/* ---------------------------------- */
.playlist-container h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.playlist-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
    margin-bottom: 8px;
}

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

.playlist-item.active {
    background-color: #e0e0e0;
    font-weight: bold;
}

.playlist-item img {
    width: 60px;
    height: auto;
    border-radius: 4px;
    margin-right: 10px;
}

.playlist-item-details {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.playlist-item-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wrapper */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* Select */
.custom-select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Arrow default */
.custom-select-wrapper::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 12px;
  height: 12px;
  pointer-events: none;

  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  transform: translateY(-50%);
}

/* Hover/focus */
.custom-select-wrapper select:hover {
  border-color: #1e90ff;
}
.custom-select-wrapper select:focus {
  border-color: #1e90ff;
  box-shadow: 0 0 4px rgba(30, 144, 255, 0.3);
}

/* Base styling for search box */
#search-input {
  width: 100%;
  padding: 8px 36px 8px 12px; /* extra right space for icon */
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  color: #333;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;

  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

/* Hover + focus states */
#search-input:hover {
  border-color: #999;
}
#search-input:focus {
  border-color: #1e90ff;
  box-shadow: 0 0 4px rgba(30, 144, 255, 0.3);
}

/* Playlist controls container (aligns select + search) */
.playlist-controls {
  display: flex;
  flex-wrap: wrap;        /* stack on small screens */
  gap: 10px;              /* spacing between controls */
  margin-bottom: 12px;    /* space before description */
  width: 100%;
}

/* Each control group flexes equally */
.playlist-controls .control-group {
  flex: 1;
  min-width: 160px; /* prevent overly narrow fields */
}

/* Ensure select + input match in height */
.custom-select-wrapper select,
#search-input {
  height: 38px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
}

/* On small screens, stack vertically */
@media (max-width: 600px) {
  .playlist-controls {
    flex-direction: column;
  }
}
