/* Audio Identification Component Styles */
/* Designed for unknown song identification with comprehensive history */

/* === ICON MODE STYLES === */
.audio-identifier-icon {
    display: inline-block;
}

.identify-icon-button {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    color: white;
}

.identify-icon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #ff7043);
}

.identify-icon-button:active {
    transform: translateY(0);
}

.identify-icon-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.identify-icon-button.recording {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: recording-pulse 2s infinite;
}

.identify-icon-button.identifying {
    background: linear-gradient(135deg, #5352ed, #3742fa);
}

.identify-icon-button .icon {
    width: 20px;
    height: 20px;
}

.identify-icon-button .icon.pulse {
    animation: pulse-icon 1.5s infinite;
}

.identify-icon-button .icon.spin {
    animation: spin 1s linear infinite;
}

/* === FULL MODE STYLES === */
.audio-identifier-full {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05), rgba(255, 142, 83, 0.05));
    border: 1px solid rgba(255, 107, 107, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin: 16px 0;
}

.identifier-header {
    text-align: center;
    margin-bottom: 20px;
}

.identifier-header h3 {
    color: #ff6b6b;
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.identifier-header p {
    color: #666;
    margin: 0;
    font-size: 0.95rem;
}

.identifier-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
}

.record-button-full {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.record-button-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.4);
}

.record-button-full.recording {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: recording-pulse 2s infinite;
}

.record-button-full.identifying {
    background: linear-gradient(135deg, #5352ed, #3742fa);
}

.or-divider {
    color: #999;
    font-weight: 500;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 1px;
    background: #ddd;
}

.or-divider::before {
    left: -30px;
}

.or-divider::after {
    right: -30px;
}

.file-input {
    display: none;
}

.file-button-full {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
}

.file-button-full:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

.history-access {
    text-align: center;
    margin-top: 16px;
}

.view-history-button {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.view-history-button:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.5);
}

/* === MODAL STYLES === */
.identification-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05), rgba(255, 142, 83, 0.05));
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-button {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-button:hover {
    background: rgba(255, 107, 107, 0.15);
}

.close-button {
    background: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: #ff6b6b;
    color: white;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* === STATUS COMPONENTS === */
.recording-status {
    text-align: center;
    padding: 40px 20px;
}

.pulse-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-circle {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.2);
    animation: pulse-circle 2s infinite;
}

.pulse-animation .mic-icon {
    width: 32px;
    height: 32px;
    color: #ff6b6b;
    z-index: 1;
}

.recording-status h4 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.recording-status p {
    color: #666;
    margin: 0 0 24px 0;
    font-size: 0.95rem;
}

/* Recording tips styling */
.recording-tips {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    text-align: left;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.recording-tips p {
    margin: 0 0 10px 0 !important;
    font-weight: 600 !important;
    color: #667eea !important;
    font-size: 0.9rem !important;
}

.recording-tips ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.recording-tips li {
    margin: 5px 0;
    color: #555;
}

.stop-recording-btn {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.stop-recording-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 71, 87, 0.4);
}

.identifying-status {
    text-align: center;
    padding: 40px 20px;
}

.search-animation {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(83, 82, 237, 0.1), rgba(55, 66, 250, 0.1));
    border-radius: 50%;
}

.search-icon {
    width: 28px;
    height: 28px;
    color: #5352ed;
}

.identifying-status h4 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.identifying-status p {
    color: #666;
    margin: 0;
    font-size: 0.95rem;
}

.identification-start {
    text-align: center;
    padding: 20px;
}

.identification-start p {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

.file-upload-btn {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    cursor: pointer;
    display: inline-block;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.file-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(116, 185, 255, 0.4);
}

/* === RESULTS STYLES === */
.identification-results {
    padding: 0;
}

.identification-results.inline {
    background: rgba(255, 107, 107, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.top-match {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08), rgba(255, 142, 83, 0.08));
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.match-info h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.match-info .artist {
    color: #666;
    margin: 0 0 4px 0;
    font-size: 1rem;
}

.match-info .album {
    color: #888;
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    font-style: italic;
}

.confidence {
    display: inline-block;
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.action-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.play-btn {
    background: linear-gradient(135deg, #00d084, #00b894);
    color: white;
    box-shadow: 0 3px 10px rgba(0, 208, 132, 0.3);
}

.play-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 208, 132, 0.4);
}

.download-btn {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    box-shadow: 0 3px 10px rgba(116, 185, 255, 0.3);
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.4);
}

.ignore-btn {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.ignore-btn:hover {
    background: #e9ecef;
    border-color: #999;
}

.other-matches {
    margin-top: 16px;
}

.other-matches h5 {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
}

.other-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
}

.other-match .match-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.other-match .title {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.other-match .artist {
    color: #666;
    font-size: 0.85rem;
}

.other-match .confidence {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    align-self: flex-start;
    margin-top: 4px;
}

.quick-actions {
    display: flex;
    gap: 4px;
}

.quick-play-btn,
.quick-download-btn {
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-play-btn:hover {
    background: rgba(0, 208, 132, 0.15);
    color: #00d084;
}

.quick-download-btn:hover {
    background: rgba(116, 185, 255, 0.15);
    color: #74b9ff;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-results p {
    margin: 0 0 8px 0;
}

/* === HISTORY STYLES === */
.identification-history {
    max-height: 400px;
    overflow-y: auto;
}

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

.empty-history .empty-icon {
    margin: 0 auto 16px;
    color: #ccc;
}

.empty-history p {
    margin: 0 0 8px 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-entry {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.entry-time {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: #888;
    font-size: 0.85rem;
}

.history-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-match .match-details h5 {
    margin: 0 0 4px 0;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
}

.history-match .match-details p {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 0.9rem;
}

.action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.action-badge.played {
    background: rgba(0, 208, 132, 0.15);
    color: #00d084;
}

.action-badge.downloaded {
    background: rgba(116, 185, 255, 0.15);
    color: #74b9ff;
}

.action-badge.ignored {
    background: rgba(0, 0, 0, 0.1);
    color: #666;
}

.history-actions {
    display: flex;
    gap: 4px;
}

.history-play-btn,
.history-download-btn {
    background: rgba(0, 0, 0, 0.08);
    color: #666;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-play-btn:hover {
    background: rgba(0, 208, 132, 0.15);
    color: #00d084;
}

.history-download-btn:hover {
    background: rgba(116, 185, 255, 0.15);
    color: #74b9ff;
}

.history-no-match {
    color: #888;
    font-style: italic;
    font-size: 0.9rem;
}

/* === INLINE RESULTS FOR SEARCH PAGE === */
.identification-results-inline {
    margin-top: 20px;
}

.no-results-inline {
    text-align: center;
    padding: 20px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 8px;
    color: #856404;
}

.no-results-inline p {
    margin: 0;
}

/* === ANIMATIONS === */
@keyframes recording-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
    }
    50% {
        box-shadow: 0 4px 15px rgba(255, 71, 87, 0.6), 0 0 0 8px rgba(255, 71, 87, 0.2);
    }
}

@keyframes pulse-icon {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

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

@keyframes pulse-circle {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .modal-content {
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
    
    .identifier-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .or-divider::before,
    .or-divider::after {
        display: none;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .other-match {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .quick-actions {
        align-self: flex-end;
    }
    
    .history-match {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .history-actions {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .audio-identifier-full {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .recording-status,
    .identifying-status {
        padding: 30px 15px;
    }
    
    .top-match {
        padding: 16px;
    }
}

/* Identification Results Modal */
.identification-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-color, white);
    border-radius: 16px;
    max-width: 500px;
    width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #1f2937);
}

.close-button {
    background: none;
    border: none;
    color: var(--text-color-secondary, #6b7280);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-button:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-color, #1f2937);
}

.modal-body {
    padding: 24px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.top-match {
    margin-bottom: 24px;
}

.top-match h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #1f2937);
}

.match-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--highlight-bg, #f8fafc);
    border-radius: 12px;
    border: 2px solid var(--brand-color, #6366f1);
}

.track-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.track-details .title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #1f2937);
}

.track-details .artist {
    font-size: 14px;
    color: var(--text-color-secondary, #6b7280);
}

.track-details .album {
    font-size: 12px;
    color: var(--text-color-tertiary, #9ca3af);
}

.track-details .confidence {
    font-size: 12px;
    font-weight: 500;
    color: var(--brand-color, #6366f1);
}

.match-actions {
    display: flex;
    gap: 8px;
}

.play-button, .download-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.play-button {
    background: var(--success-color, #10b981);
    color: white;
}

.play-button:hover {
    background: var(--success-color-hover, #059669);
    transform: translateY(-1px);
}

.download-button {
    background: var(--brand-color, #6366f1);
    color: white;
}

.download-button:hover {
    background: var(--brand-color-hover, #4f46e5);
    transform: translateY(-1px);
}

.all-matches {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: 20px;
}

.all-matches h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color, #1f2937);
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: var(--item-bg, #f9fafb);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.match-item:hover {
    background: var(--item-hover-bg, #f3f4f6);
}

.match-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.match-details .title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color, #1f2937);
}

.match-details .artist {
    font-size: 12px;
    color: var(--text-color-secondary, #6b7280);
}

.match-details .confidence {
    font-size: 11px;
    color: var(--text-color-tertiary, #9ca3af);
}

.match-actions-small {
    display: flex;
    gap: 4px;
}

.small-play-button, .small-download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.small-play-button {
    background: var(--success-color, #10b981);
    color: white;
}

.small-play-button:hover {
    background: var(--success-color-hover, #059669);
    transform: scale(1.05);
}

.small-download-button {
    background: var(--brand-color, #6366f1);
    color: white;
}

.small-download-button:hover {
    background: var(--brand-color-hover, #4f46e5);
    transform: scale(1.05);
}

.no-matches {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-color-secondary, #6b7280);
}

.no-matches p {
    margin: 8px 0;
    font-size: 14px;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-height: 85vh;
    }
    
    .match-info {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .match-actions {
        justify-content: center;
    }
    
    .identifier-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .record-button {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
}
