/* === NexTrack Brand Variables (centralized) === */

#ai-playlist-form {
    max-width: 700px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
    box-sizing: border-box;
}

#ai-playlist-history.playlist-history-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(var(--brand-rgb), 0.06);
}

#ai-playlist-container {
    max-width: 700px;
    margin: 0 auto;
}

.playlist-history-item {
    display: flex;
    flex-direction: column;
    background: #191919;
    border-bottom: 1px solid #232323;
    padding: 10px 16px;
    transition: background 0.17s;
    cursor: pointer;
    gap: 6px;
    position: relative;
}

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

.playlist-history-item:hover,
.playlist-history-item.playing {
    background: rgba(var(--brand-rgb), 0.15);
    border-left: 4px solid var(--brand);
    box-shadow: 0 2px 12px rgba(var(--brand-rgb), 0.06);
}

.playlist-history-top,
.playlist-history-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    align-items: center;  
    text-align: center;       
    flex-wrap: wrap;
    width: 100%;
}

.playlist-history-top {
    gap: 10px;
}

.playlist-history-bottom {
    gap: 10px;
    margin-top: 4px;
}

.playlist-history-index {
    font-size: 14px;
    color: #aaa;
    font-weight: 500;
    min-width: 20px;
    text-align: right;
}

.playlist-history-title {
    color: var(--brand);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.playlist-history-meta {
    font-size: 12px;
    color: #aaa;
    font-weight: 400;
    white-space: nowrap;
}

.playlist-history-controls {
    display: flex;
    gap: 10px;
}

.playlist-history-refresh,
.playlist-history-remove {
    font-size: 15px;
    color: #888;
    padding: 4px 6px;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
}

.playlist-history-refresh:hover,
.playlist-history-remove:hover {
    color: var(--brand);
    background: rgba(var(--brand-rgb), 0.15);
}

.playlist-history-remove:active,
.playlist-history-remove:focus {
    background: #181818;
}

.playlist-recommendations-header {
    font-size: 12px;
    font-weight: 500;
    color: #eee;
    text-align: center;
}

.playlist-recommendations-title {
    color: var(--brand);
    font-weight: 600;
    margin-left: 5px;
    font-size: 10px;
}

#clear-playlist-wrapper {
  text-align: center;  
}

.clear-playlist-button {
  font-size: 12px;
  padding: 4px 10px;
  background-color: #333;
  color: var(--text);
  border: 1px solid #666;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  display: inline-block;
}

.track-sets-badge {
    background: #232323;
    color: var(--brand);
    border-radius: 16px;
    padding: 2px 12px 2px 8px;
    margin-left: 10px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(var(--brand-rgb), 0.05);
}

.track-sets-badge i {
    margin-right: 3px;
    font-size: 13px;
    color: #aaa;
}

@media (max-width: 600px) {

    #ai-playlist-container {
        padding-left: 4px;
        padding-right: 4px;
        max-width: 100%;
    }
    .playlist-history-item {
        padding: 8px 12px;
    }

    .playlist-history-top,
    .playlist-history-bottom {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;  
        text-align: center; 
        align-items: center;
    }

    .playlist-history-index {
        font-size: 13px;
    }

    .playlist-history-title {
        font-size: 14px;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1 1 auto; 
    }

    .playlist-history-meta {
        font-size: 12px;
        flex-shrink: 0;
    }

    .playlist-history-controls {
        gap: 8px;
        justify-content: flex-end;
        flex-shrink: 0;
    }

    .playlist-history-refresh,
    .playlist-history-remove {
        font-size: 14px;
        padding: 4px 6px;
    }

    #playlist-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 0 12px;
    }

    #select-playlist-wrapper,
    #clear-playlist-wrapper,
    #delete-playlist-wrapper {
        width: 100%;
        text-align: center;
    }

    .saved-playlists-dropdown,
    .clear-playlist-button,
    .delete-playlist-button {
        width: 100%;
        box-sizing: border-box;
        padding: 10px 0;
        font-size: 16px;
    }

    /* make the dropdown label wrap nicely */
    #select-playlist-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    #select-playlist-wrapper::before {        
        margin-bottom: 4px;
        color: #eee;
        font-weight: 500;
    }
  
}

#ai-playlist-container {
    width: 100%;
    max-width: 700px;
    box-sizing: border-box;
    overflow-x: hidden;
    padding-left: 8px;
    padding-right: 8px;
}

#playlist-controls {
  display: flex;
  align-items: center;
  gap: 1rem;  
  max-width: 700px; /* match your other containers */
}

#select-playlist-wrapper {
  flex-shrink: 0;
}

.saved-playlists-dropdown {
  min-width: 180px;
  padding: 4px 8px;
}

/* Simple dark-theme dropdown */
.saved-playlists-dropdown {
  background-color: #222;       /* match your playlist cards */
  color: #eee;                  /* light text */
  border: 1px solid #444;       /* soft border */
  border-radius: 6px;           /* rounded corners */
  padding: 6px 12px;            /* comfy click area */
  font-size: 14px;
  min-width: 180px;
  transition: box-shadow 0.2s;
}

/* Hover/focus: subtle glow */
.saved-playlists-dropdown:hover,
.saved-playlists-dropdown:focus {
  outline: none;
  box-shadow: 0 0 8px rgba(var(--brand-rgb), 0.4);
  border-color: var(--brand);
}

.delete-playlist-button {
  font-size: 12px;
  padding: 4px 10px;
  background-color: #550000;
  color: var(--text);
  border: 1px solid #880000;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.delete-playlist-button:hover {
  background-color: var(--brand-strong);
}

#more-playlist-paid-notice {
  display: block;          /* ensure it’s full-width */
  margin: 10px auto;       /* space above/below */
  max-width: 700px;        /* match your other containers */
  text-align: center;
}

.drag-handle {
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;          /* bigger tap target */
  height: 28px;         /* bigger tap target */
  margin-right: 6px;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;   /* helps avoid browser gestures */
}

.playlist-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;          /* smaller gap between items */
  max-width: 700px;     /* match your other containers */
  width: 100%;
  margin: 16px auto;    /* vertical spacing, centered */
  padding: 0 16px;      /* horizontal inset so it doesn’t touch edges */
  box-sizing: border-box;
}

.playlist-dropdown,
.playlist-btn {
  flex: 1 1 0;
  min-width: 100px;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #222;
  color: #eee;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.playlist-dropdown:focus,
.playlist-btn:hover {
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), 0.15);
}

.playlist-btn.delete {
  background: #550000;
  border-color: var(--brand);
}
.playlist-btn.delete:hover {
  background: rgba(var(--brand-rgb), 0.15);
}

/* Stack on very narrow screens */
@media (max-width: 480px) {
  .playlist-controls {
    flex-direction: column;
  }
}

/* 1. Ensure each control wrapper flexes equally */
.playlist-controls > div {
  flex: 1 1 0;             /* grow & shrink equally */
  text-align: center;      /* center contents */
}

/* 2. Make all controls full-width, same height and padding */
.playlist-controls select,
.playlist-controls .clear-playlist-button,
.playlist-controls .delete-playlist-button {
  width: 100%;
  height: 44px;            /* choose a comfortable tap target */
  padding: 0 12px;         /* horizontal padding */
  font-size: 14px;         /* legible on mobile */
  box-sizing: border-box;  /* include padding in width */
}

/* 3. Ensure on small screens they stack */
@media (max-width: 480px) {
  /* let the container fill the screen */
  .playlist-controls {
    max-width: 100%;
    width: 100%;
    gap: 4px;
    padding: 0;    
  }

  /* each child div becomes full-width with no extra side gaps */
  .playlist-controls > div {
    width: 100%;
    margin-bottom: 0px;
  }
  .playlist-controls > div:last-child {
    margin-bottom: 0;
  }

  /* ensure dropdown & buttons fill their wrapper completely */
  .playlist-controls select,
  .playlist-controls .clear-playlist-button,
  .playlist-controls .delete-playlist-button {
    width: 100%;
    box-sizing: border-box;
  }
}

.playlist-history-top {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between; /* keeps title on right */
}

.playlist-history-left {
  display: flex;
  flex-direction: column;   /* stack vertically */
  align-items: center;      /* center under the handle */
  gap: 2px;                 /* small space between ☰ and number */
  flex-shrink: 0;
  min-width: 24px;          /* keeps the left block tidy */
}

.playlist-history-left .drag-handle {
  margin-right: 0;          /* no side gap when stacked */
}

.playlist-history-index {
  min-width: 0;             /* allow it to be as narrow as needed */
  text-align: center;       /* centered under the handle */
  font-size: 12px;
}

.drag-handle {
    cursor: grab;
    font-size: 18px;
    line-height: 1;
}
