/**
 * Playlists Page Styling
 * BlazinStreetz Phase 3 - User Playlists System
 *
 * Styles for playlist dashboard and player pages
 * Follows platform BEM methodology and component patterns
 *
 * @created 2025-11-24
 * @jira BSAPP-607
 */

/* ============================================
   PLAYLISTS PAGE LAYOUT
   ============================================ */

.playlists-page-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0 80px;
}

/* ============================================
   PLAYLIST CARDS
   ============================================ */

/* Playlist-specific card enhancements */
.bs-card--playlist {
    position: relative;
}

/* Privacy Badge */
.bs-card__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.bs-card__badge--public {
    background: rgba(46, 204, 113, 0.9);
    color: white;
}

.bs-card__badge--private {
    background: rgba(149, 165, 166, 0.9);
    color: white;
}

/* Card Action Buttons */
.bs-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f5f5f5;
    color: #e74c3c;
}

.btn-icon:active {
    transform: scale(0.95);
}

/* ============================================
   PLAYLIST MODALS
   ============================================ */

.playlist-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playlist-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.playlist-modal__content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    animation: modalSlideIn 0.3s ease-out;
}

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

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

.playlist-modal__header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.playlist-modal__close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.playlist-modal__close:hover {
    background: #f5f5f5;
    color: #333;
}

.btn-create-new-playlist {
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-left: auto;
    margin-right: 12px;
}

.btn-create-new-playlist:hover {
    background: #e74c3c;
    color: white;
}

.btn-create-new-playlist i {
    font-size: 12px;
}

.playlist-modal__body {
    padding: 24px;
}

.playlist-modal__footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 24px;  /* top | sides | bottom */
    border-top: 1px solid rgba(255, 255, 255, 0.1);  /* subtle separator */
    margin-top: 0;  /* border provides visual separation */
}

/* Modal Button Variants */
.playlist-modal .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.playlist-modal .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.playlist-modal .btn-danger i {
    margin-right: 6px;
}

/* Modal Text Variants */
.playlist-modal .text-warning {
    color: #ffc107;
    font-size: 14px;
    margin-top: 12px;
}

.playlist-modal .text-warning i {
    margin-right: 8px;
}

.playlist-modal .text-muted {
    color: #6c757d;
    font-size: 14px;
}

/* Delete Confirmation Modal Variants */
.playlist-modal__content--delete {
    max-width: 400px;
}

.playlist-modal__header--danger {
    background: #dc3545;
    color: white;
    text-align: center;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.playlist-modal__header--danger i {
    font-size: 2rem;
}

.playlist-modal__header--danger h3 {
    color: white;
}

.playlist-modal__header--danger .playlist-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.playlist-modal__header--danger .playlist-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.required {
    color: #e74c3c;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-control::placeholder {
    color: #999;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

/* ============================================
   ARTWORK SELECTION GRID
   ============================================ */

.artwork-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;  /* Match gap for visual balance */
}

.artwork-grid__item {
    position: relative;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.artwork-grid__item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.artwork-grid__item:hover {
    border-color: rgba(231, 76, 60, 0.5);
    transform: scale(1.02);
}

.artwork-grid__item--selected {
    border-color: #e74c3c;
}

.artwork-grid__item--selected .artwork-grid__check {
    display: flex;
}

.artwork-grid__check {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(231, 76, 60, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

/* Responsive: 3 columns on mobile */
@media (max-width: 576px) {
    .artwork-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 8px;  /* Match gap */
        max-height: 220px;
    }

    .artwork-grid__check {
        font-size: 20px;
    }
}

/* ============================================
   ARTWORK GRID - LARGE VARIANT (Edit Modal)
   ============================================ */

/* Artwork tab content wrapper */
.artwork-tab-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Hint text above grid */
.artwork-tab-hint {
    color: var(--text-secondary, #b3b3b3);
    font-size: 14px;
    margin: 0;
}

/* Large variant for Edit Modal */
.artwork-grid--large {
    padding: 12px;  /* Match gap for visual balance */
    max-height: 320px;
}

/* Tablet: 577px - 767px */
@media (min-width: 577px) and (max-width: 767px) {
    .artwork-grid--large {
        gap: 10px;
        padding: 10px;
        max-height: 280px;
    }
}

/* Mobile: ≤576px */
@media (max-width: 576px) {
    .artwork-grid--large {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 8px;
    }

    .artwork-tab-hint {
        font-size: 13px;
    }
}

/* Small Mobile: ≤400px */
@media (max-width: 400px) {
    .artwork-grid--large {
        gap: 6px;
        padding: 6px;
        max-height: 200px;
    }
}

/* ============================================
   ADD TO PLAYLIST MODAL
   ============================================ */

.add-to-playlist-modal .playlist-modal__content {
    max-height: 600px;
}

.playlist-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.playlist-selection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.playlist-selection-item:hover {
    background: #e9ecef;
    border-color: #e74c3c;
}

.playlist-selection-item:active {
    transform: scale(0.98);
}

.playlist-selection-item__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.playlist-selection-item__name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-selection-item__meta {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.playlist-selection-item__meta i {
    font-size: 11px;
}

.playlist-selection-item__status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #2ecc71;
    font-weight: 600;
}

.playlist-selection-item__status i {
    font-size: 16px;
}

.playlist-selection-item--already-added {
    background: #e8f5e9;
    border-color: #2ecc71;
    cursor: not-allowed;
    opacity: 0.7;
}

.playlist-selection-item--already-added:hover {
    background: #e8f5e9;
    border-color: #2ecc71;
}

/* Loading State */
.playlist-selection-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.playlist-selection-item.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e74c3c;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State in Modal */
.playlist-selection-empty {
    text-align: center;
    padding: 40px 20px;
}

.playlist-selection-empty i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.playlist-selection-empty h4 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.playlist-selection-empty p {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.btn-create-playlist {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.btn-create-playlist:hover {
    background: #c0392b;
}

.btn-create-playlist i {
    font-size: 14px;
}

/* ============================================
   PLAYLIST HERO
   ============================================ */

.hero--playlist {
    min-height: 400px;
}

/* Hero Action Button - Desktop constrained width */
.hero__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 220px;
    margin-top: 20px;
}

.hero__description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 16px;
    max-width: 600px;
    line-height: 1.6;
}

.hero__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.btn-play-all {
    font-size: 16px;
    padding: 12px 32px;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.playlist-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #2ecc71;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10002;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    font-weight: 500;
}

.playlist-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.playlist-notification i {
    font-size: 20px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.empty-state i {
    color: #ccc;
    margin-bottom: 24px;
}

.empty-state h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
}

.empty-state .text-muted {
    font-size: 14px;
    color: #999;
}

.empty-state .btn {
    margin-top: 24px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .hero__actions {
        flex-direction: column;
        width: 100%;
    }

    .hero__actions .btn {
        width: 100%;
    }

    .hero__action-btn {
        max-width: 100%;
        width: 100%;
    }

    .track-row {
        gap: 12px;
        padding: 10px;
    }

    .track-row__number {
        width: 24px;
        font-size: 13px;
    }

    .track-row__plays {
        display: none;
    }

    .track-row__actions {
        opacity: 1;
    }

    .playlist-modal__content {
        width: 95%;
        max-height: 95vh;
    }

    .playlist-modal__header,
    .playlist-modal__body {
        padding: 20px;
    }

    .playlist-notification {
        bottom: 16px;
        right: 16px;
        left: 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .track-row__info {
        max-width: 150px;
    }

    .btn-icon {
        font-size: 14px;
        width: 32px;
        height: 32px;
    }
}

/* ============================================
   EDIT MODAL TABS (BSAPP-647)
   ============================================ */

.playlist-modal__tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e0e0e0;
    margin: -24px -24px 24px -24px;
    padding: 0 24px;
    background: #fafafa;
}

.playlist-modal__tab {
    background: transparent;
    border: none;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: color 0.2s ease;
}

.playlist-modal__tab:hover {
    color: #333;
}

.playlist-modal__tab--active {
    color: #e74c3c;
}

.playlist-modal__tab--active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e74c3c;
}

.playlist-modal__tab i {
    font-size: 14px;
}

.playlist-modal__tab-badge {
    background: #e0e0e0;
    color: #666;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.playlist-modal__tab--active .playlist-modal__tab-badge {
    background: #e74c3c;
    color: white;
}

.playlist-modal__tab-content {
    display: none;
}

.playlist-modal__tab-content--active {
    display: block;
}

/* ============================================
   MODAL TRACK LIST (BSAPP-647)
   ============================================ */

.modal-track-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 400px;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

.modal-track-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.modal-track-row:hover {
    background: #f0f1f2;
}

.modal-track-row__handle {
    color: #999;
    cursor: grab;
    padding: 8px 4px;
    font-size: 14px;
    flex-shrink: 0;
    touch-action: none;
}

.modal-track-row__handle:active {
    cursor: grabbing;
}

.modal-track-row__number {
    width: 24px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    flex-shrink: 0;
}

.modal-track-row__image {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e0e0e0;
}

.modal-track-row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-track-row__title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.modal-track-row__artist {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.modal-track-row__remove {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 8px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-track-row__remove:hover {
    background: #fee2e2;
    color: #dc3545;
}

/* Sortable States */
.modal-track-row.sortable-ghost {
    opacity: 0.4;
    background: #e8f4ff;
}

.modal-track-row.sortable-drag {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.modal-track-row.sortable-chosen {
    background: #fff;
}

/* Empty State in Tracks Tab */
.modal-tracks-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.modal-tracks-empty i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
    display: block;
}

.modal-tracks-empty p {
    font-size: 14px;
    margin: 0;
}

/* ============================================
   MODAL TRACK LIST RESPONSIVE (BSAPP-647)
   ============================================ */

@media (max-width: 576px) {
    .playlist-modal__tabs {
        margin: -20px -20px 20px -20px;
        padding: 0 16px;
    }

    .playlist-modal__tab {
        padding: 14px 12px;
        font-size: 13px;
    }

    .modal-track-list {
        max-height: 350px;
    }

    .modal-track-row {
        gap: 8px;
        padding: 8px 10px;
    }

    .modal-track-row__image {
        width: 36px;
        height: 36px;
    }

    .modal-track-row__title {
        font-size: 13px;
    }

    .modal-track-row__artist {
        font-size: 11px;
    }

    .modal-track-row__handle,
    .modal-track-row__remove {
        min-width: 44px;
        min-height: 44px;
    }
}
