/**
 * GD Chatbot - Song Modal Styles
 * Beautiful, responsive modal for Archive.org recordings
 */

/* Song Links in Chat */
.gd-song-link {
    color: #4285f4;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    position: relative;
    transition: all 0.2s ease;
    font-weight: 500;
}

.gd-song-link:hover {
    color: #1967d2;
    text-decoration-style: solid;
}

.gd-song-link::after {
    content: "♪";
    font-size: 0.85em;
    margin-left: 3px;
    opacity: 0.7;
}

/* Tooltip on hover */
.gd-song-link:hover::before {
    content: "Click to listen";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 5px;
    font-weight: normal;
}

/* Modal Overlay */
.gd-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

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

.gd-modal-dialog {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Modal Header */
.gd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gd-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.gd-modal-close {
    background: none;
    border: none;
    font-size: 36px;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.gd-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Body */
.gd-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Performance List */
.gd-performance-list {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gd-performance-filters {
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gd-performance-filters label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.gd-performance-filters select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.gd-performance-filters select:hover {
    border-color: #667eea;
}

.gd-performance-filters select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.gd-performance-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Performance Item */
.gd-performance-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    background: white;
}

.gd-performance-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    transform: translateY(-2px);
}

.performance-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f3f4f6;
}

.performance-info {
    flex: 1;
    min-width: 0;
}

.performance-info h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.performance-date {
    margin: 4px 0;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.performance-location {
    margin: 4px 0;
    font-size: 13px;
    color: #9ca3af;
}

.performance-stats {
    margin: 6px 0 0 0;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    gap: 16px;
}

.performance-stats .downloads {
    font-weight: 500;
}

.performance-stats .rating {
    color: #f59e0b;
    font-weight: 600;
}

.gd-play-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.gd-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.gd-play-btn:active {
    transform: translateY(0);
}

/* Audio Player */
.gd-audio-player {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.player-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-info p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.player-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.player-close:hover {
    background: #e5e7eb;
    color: #111827;
}

#gd-audio-element {
    width: 100%;
    height: 48px;
    border-radius: 8px;
}

/* Loading State */
.gd-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 15px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Error State */
.gd-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc2626;
    font-size: 14px;
    background: #fef2f2;
    border-radius: 8px;
    margin: 20px;
}

/* No Results */
.gd-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 15px;
}

/* Prevent body scroll when modal open */
body.gd-modal-open {
    overflow: hidden;
}

/* Scrollbar Styling */
.gd-performance-scroll::-webkit-scrollbar {
    width: 8px;
}

.gd-performance-scroll::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.gd-performance-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.gd-performance-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gd-modal-dialog {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
        border-radius: 12px;
    }
    
    .gd-modal-header {
        padding: 20px;
    }
    
    .gd-modal-header h3 {
        font-size: 20px;
    }
    
    .gd-performance-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .performance-thumb {
        width: 100%;
        height: 120px;
    }
    
    .gd-play-btn {
        width: 100%;
    }
    
    .performance-stats {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .gd-modal-header {
        padding: 16px;
    }
    
    .gd-modal-header h3 {
        font-size: 18px;
    }
    
    .gd-performance-scroll {
        padding: 16px;
    }
    
    .gd-performance-filters {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .gd-performance-filters select {
        width: 100%;
    }
}

/* Phase 4: Streaming Services Styles */

/* Source Tabs */
.gd-source-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gd-source-tab {
    padding: 10px 20px;
    border: none;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gd-source-tab:hover {
    background: #f1f3f4;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.gd-source-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Streaming Service Items */
.gd-streaming-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.gd-streaming-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.gd-streaming-item .gd-performance-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.gd-streaming-item .gd-performance-info {
    flex: 1;
    min-width: 0;
}

.gd-streaming-item .gd-performance-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 600;
    color: #202124;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gd-streaming-item .gd-performance-meta {
    margin: 0;
    font-size: 13px;
    color: #5f6368;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gd-quality-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.gd-streaming-item .gd-performance-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.gd-popularity {
    font-size: 13px;
    color: #ea4335;
    font-weight: 500;
}

/* Additional Mobile Responsive Styles for Streaming */
@media (max-width: 768px) {
    .gd-source-tabs {
        padding: 10px;
        gap: 5px;
    }
    
    .gd-source-tab {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .gd-streaming-item {
        flex-direction: column;
        text-align: center;
    }
    
    .gd-streaming-item .gd-performance-thumb {
        margin: 0 auto 10px;
    }
    
    .gd-streaming-item .gd-performance-actions {
        align-items: center;
        width: 100%;
    }
}
