/* MP3 Playlist Styles */

/* Tab Navigation */
.mp3-tabs-wrapper {
    margin-bottom: 20px;
}

.mp3-tab-nav {
    display: flex;
    border-bottom: 2px solid #ddd;
    background-color: #f9f9f9;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.mp3-tab-button {
    flex: 1;
    padding: 15px 20px;
    background: #f9f9f9;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.mp3-tab-button:hover {
    background: #e9e9e9;
    color: #333;
}

.mp3-tab-button.active {
    background: #fff;
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* Tab Content */
.mp3-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.mp3-tab-content.active {
    display: block;
}

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

/* Playlist Manager */
.playlist-manager {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* User Info Section */
.playlist-user-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.user-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-welcome,
.guest-welcome {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.user-note,
.guest-note {
    font-size: 13px;
    color: #666;
}

.guest-note a {
    color: #0073aa;
    text-decoration: none;
}

.guest-note a:hover {
    text-decoration: underline;
}

/* Category Selector */
.category-selector {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.category-selector label {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.category-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    min-width: 200px;
}

.category-selector button {
    padding: 8px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.category-selector button:hover {
    background: #005177;
}

.playlist-controls {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.playlist-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    justify-items: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.playlist-actions .button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    width: 100%;
    min-width: 120px;
}

.playlist-info {
    text-align: center;
    margin-bottom: 10px;
}

.playlist-info {
    color: #666;
    font-weight: 500;
}

/* Playlist Content Layout */
.playlist-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 500px;
}

.available-songs,
.current-playlist {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
}

.available-songs h3,
.current-playlist h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

/* Song Search */
.song-search {
    margin-bottom: 15px;
}

.song-search input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Songs List */
.songs-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.song-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

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

.song-item:hover {
    background: #f0f8ff;
    transform: translateX(2px);
}

.song-item.playing {
    background: #e6f3ff;
    border-left: 4px solid #0073aa;
}

.song-artwork {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    margin-right: 12px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.song-details {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    color: #666;
    font-size: 13px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-actions {
    display: flex;
    gap: 5px;
    opacity: 1; /* Always visible for available songs */
    transition: opacity 0.2s ease;
}

.song-item:hover .song-actions {
    opacity: 1;
}

/* Make actions always visible in available songs list */
#available-songs-list .song-actions {
    opacity: 1 !important;
}

/* Only hide actions in current playlist on desktop */
#current-playlist-list .song-actions {
    opacity: 0;
}

#current-playlist-list .song-item:hover .song-actions {
    opacity: 1;
}

.song-action-btn {
    background: #0073aa !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
    min-width: 50px !important;
    text-align: center !important;
}

.song-action-btn:hover {
    background: #005177 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.song-action-btn:active {
    transform: translateY(0) !important;
}

.song-action-btn.remove {
    background: #dc3545 !important;
}

.song-action-btn.remove:hover {
    background: #c82333 !important;
}

.song-action-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Playlist Header */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.playlist-name-display {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.playlist-name-display:hover {
    color: #0073aa;
}

.playlist-name-input {
    background: transparent !important;
    border: 1px dashed #ccc !important;
    padding: 2px 5px !important;
    font-weight: 600 !important;
    color: #333 !important;
    font-size: inherit !important;
    font-family: inherit !important;
}

/* Sortable Playlist */
.sortable {
    min-height: 100px;
}

.sortable .song-item {
    cursor: move;
}

.sortable .song-item:hover {
    background: #f0f8ff;
}

.ui-sortable-helper {
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    transform: rotate(2deg) !important;
}

.ui-sortable-placeholder {
    background: #e6f3ff !important;
    border: 2px dashed #0073aa !important;
    height: 60px !important;
    margin: 2px 0 !important;
}

/* Empty States */
.loading,
.empty-playlist {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-playlist p {
    margin: 0;
    font-style: italic;
}

.playlist-instructions {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
}

.playlist-instructions h4 {
    color: #0073aa;
    margin: 0 0 15px 0;
    font-size: 18px;
}

.playlist-instructions p {
    color: #666;
    margin: 10px 0;
    line-height: 1.5;
}

.playlist-instructions p:last-child {
    margin-bottom: 0;
}

/* Drag Handle */
.drag-handle {
    color: #999;
    cursor: move;
    margin-right: 8px;
    font-size: 16px;
}

.drag-handle:hover {
    color: #0073aa;
}

/* Modal Styles */
.mp3-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.mp3-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
}

.mp3-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.mp3-modal-close:hover {
    color: #000;
}

.mp3-modal h3 {
    margin-top: 0;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

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

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
}

.form-actions .button {
    margin-left: 10px;
}

/* Saved Playlists List */
.playlist-header-info {
    background: #e6f3ff;
    color: #0073aa;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
    border: 1px solid #b3d9ff;
}

.saved-playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.saved-playlist-item:hover {
    background: #f0f8ff;
    border-color: #0073aa;
}

.saved-playlist-info h4 {
    margin: 0 0 4px 0;
    color: #333;
}

.saved-playlist-info p {
    margin: 0 0 4px 0;
    color: #666;
    font-size: 13px;
}

.saved-playlist-info .storage-type {
    color: #888;
    font-size: 11px;
    font-style: italic;
}

.saved-playlist-actions {
    display: flex;
    gap: 5px;
}

/* Shared Playlist Styles */
.own-playlist {
    border-left: 4px solid #0073aa;
}

.other-playlist {
    border-left: 4px solid #28a745;
    background: #f8fff9;
}

.other-playlist:hover {
    background: #e8f5e8;
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.error {
    text-align: center;
    padding: 20px;
    color: #d63638;
    background: #ffeaea;
    border: 1px solid #f0a0a0;
    border-radius: 4px;
    margin: 10px 0;
}

/* Search Results */
.no-results {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Playlist Status Indicators */
.playlist-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

.playlist-status.saved {
    background: #d4edda;
    color: #155724;
}

.playlist-status.modified {
    background: #fff3cd;
    color: #856404;
}

/* Upload Tab Styles */
.upload-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.upload-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.upload-form .form-group {
    margin-bottom: 20px;
}

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

.upload-form input[type="text"],
.upload-form select,
.upload-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.upload-form textarea {
    resize: vertical;
    min-height: 100px;
}

.upload-form .button {
    padding: 10px 20px;
    margin-right: 10px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-form .button-primary {
    background: #0073aa;
    color: white;
    border: none;
}

.upload-form .button-primary:hover:not(:disabled) {
    background: #005177;
}

.upload-form .button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#upload-progress {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005177);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: #0073aa;
}

#upload-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

#upload-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#upload-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* File selection styling */
#selected-file-name,
#selected-artwork-name {
    margin-left: 10px;
    font-style: italic;
    color: #666;
}

#selected-file-name.selected,
#selected-artwork-name.selected {
    color: #0073aa;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mp3-tab-button {
        padding: 12px 15px;
        font-size: 14px;
    }

    .playlist-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .playlist-controls {
        margin-bottom: 15px;
    }

    .playlist-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        max-width: 400px;
    }

    .playlist-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .mp3-modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 15px;
    }

    .song-item {
        padding: 10px;
    }

    .song-artwork {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    .song-title {
        font-size: 14px;
    }

    .song-artist {
        font-size: 12px;
    }

    .song-actions {
        opacity: 1; /* Always show on mobile */
    }

    .song-action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .mp3-tabs-wrapper {
        margin-bottom: 15px;
    }

    .mp3-tab-button {
        padding: 10px 12px;
        font-size: 13px;
    }

    .playlist-manager {
        padding: 15px;
    }

    .available-songs h3,
    .current-playlist h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .songs-list {
        max-height: 300px;
    }

    .playlist-actions .button {
        padding: 6px 12px;
        font-size: 13px;
        min-width: 100px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .playlist-actions {
        grid-template-columns: 1fr;
        max-width: 250px;
    }

    .playlist-actions .button {
        padding: 8px 16px;
        font-size: 14px;
    }
}
