:root {
    --primary-color: #3b82f6;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --success-dark: #059669;
    --warning-color: #f59e0b;
    --warning-dark: #d97706;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --purple-color: #8b5cf6;
    --purple-dark: #7c3aed;
    --info-color: #06b6d4;
    --info-dark: #0891b2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #333e50 0%, #1a202c 100%);
    min-height: 100vh;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
    border: none;
}

.btn-info:hover {
    background-color: var(--info-dark);
    color: white;
}

.github-footer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.footer-bottom-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.master-volume-control {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

.master-volume-control:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.master-volume-control > i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.master-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 6px;
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    background: #ddd;
}

.master-volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

.master-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    margin-top: -5px;
}

.master-volume-slider::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
}

.master-volume-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
}

.master-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.master-volume-slider::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.15);
}

.master-volume-display {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.75rem;
    min-width: 38px;
    text-align: right;
}

.github-link,
.scroll-top-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-decoration: none;
    color: #333;
    border: none;
    cursor: pointer;
}

.github-link:hover,
.scroll-top-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    color: var(--primary-color);
}

.github-link i,
.scroll-top-btn i {
    font-size: 1.5rem;
}

.scroll-top-btn {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.backup-status {
    padding: 0.5rem 0.75rem;
    background: #d1f4e0;
    border-left: 3px solid var(--success-color);
    border-radius: 6px;
}

.backup-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.backup-info i {
    font-size: 1rem;
}

.controls-panel {
    background: white;
    border-radius: 15px;
    border: none;
}

.controls-panel .card-body {
    padding: 2rem;
}

.btn-purple {
    background-color: var(--purple-color);
    color: white;
    border: none;
}

.btn-purple:hover {
    background-color: var(--purple-dark);
    color: white;
    transform: translateY(-2px);
}

.btn {
    transition: all 0.3s ease;
    font-weight: 600;
}

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

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

.btn-play-single,
.btn-pause-single {
    position: relative;
    overflow: hidden;
}

.btn-play-single.active {
    background-color: var(--success-dark);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.btn-pause-single.active {
    background-color: var(--warning-dark);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.btn-mute.active {
    background-color: #ff0909;
    color: white;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.3);
}

.btn-group-control[data-action="mute"].active {
    background-color: #ff0909;
    color: white;
}

.btn-group-control[data-action="playlist"].active {
    background-color: var(--info-dark);
    color: white;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.3);
}

.btn-group-control[data-action="playlist-loop"].active {
    background-color: var(--purple-dark);
    color: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

.playlist-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: rgba(6, 182, 212, 0.2);
    color: #333;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.4rem;
    animation: playlistPulse 2s ease-in-out infinite;
}

.playlist-indicator i {
    font-size: 0.8rem;
}

@keyframes playlistPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.add-audio-section,
.group-management,
.backup-section,
.global-controls-section,
.search-section-wrapper,
.filter-section-wrapper {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.add-audio-section {
    border-left: 4px solid var(--success-color);
}

.group-management {
    border-left: 4px solid var(--primary-color);
}

.backup-section {
    border-left: 4px solid var(--warning-color);
}

.global-controls-section {
    border-left: 4px solid var(--purple-color);
}

.search-section-wrapper {
    border-left: 4px solid var(--info-color);
}

.filter-section-wrapper {
    border-left: 4px solid #e91e63;
}

.groups-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.group-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.group-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.group-tag.active {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.group-tag i {
    font-size: 0.9rem;
    color: #333;
}

.group-tag .group-count {
    background: rgba(0, 0, 0, 0.15);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #333;
}

.group-tag .btn-delete-group {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 0;
    margin-left: 0.2rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.group-tag .btn-delete-group:hover {
    opacity: 1;
}

.audio-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.group-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.group-section:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.group-header {
    padding: 0.65rem 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.group-header:hover {
    filter: brightness(0.95);
}

.group-header.highlight-group {
    animation: highlightGroupPulse 1.5s ease;
}

@keyframes highlightGroupPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
    50% {
        box-shadow: 0 0 20px 5px var(--primary-color);
        transform: scale(1.01);
    }
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
}

.group-collapse-icon {
    font-size: 1rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.group-header.collapsed .group-collapse-icon {
    transform: rotate(-90deg);
}

.group-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.group-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.group-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.group-controls {
    display: flex;
    gap: 0.3rem;
}

.btn-group-control {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.group-content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #fafbfc;
}

.group-content.collapsed {
    display: none;
}

.audio-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    scroll-margin-top: 20px;
}

.audio-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    background: #fafbfc;
}

.audio-item.playing {
    border-left-color: var(--success-color);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.03) 0%, white 3%);
}

.audio-item.playing.looping {
    border-left-color: var(--purple-color);
    background: linear-gradient(to right, rgba(139, 92, 246, 0.05) 0%, white 3%);
}

.audio-item.paused {
    border-left-color: var(--warning-color);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.03) 0%, white 3%);
}

.audio-item.looping {
    background: linear-gradient(to right, rgba(139, 92, 246, 0.03) 0%, white 3%);
}

.audio-item.error {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.audio-item.highlight {
    animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 0 20px 5px var(--primary-color);
        transform: scale(1.02);
    }
}

.audio-item .card-body {
    padding: 0.6rem 0.8rem;
}

.audio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.4rem;
}

.audio-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-status {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-shrink: 0;
}

.audio-time {
    font-size: 0.7em;
    color: #666;
    padding: 0.15rem 0.35rem;
}

.status-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    animation: fadeIn 0.3s ease;
    color: white !important;
}

.status-badge i {
    font-size: 0.75rem;
    color: white !important;
}

.bg-purple {
    background-color: var(--purple-color) !important;
    color: white;
}

.loop-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    background-color: var(--purple-color);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.loop-indicator i {
    font-size: 0.8rem;
    animation: rotate 2s linear infinite;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.audio-controls {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.btn-small {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    min-width: 32px;
    justify-content: center;
}

.audio-group-selector {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.audio-group-selector select {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    background-color: white;
}

.loop-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem;
    background: #bbb7b773;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.loop-toggle:hover {
    background: #e9ecef;
}

.loop-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.loop-toggle label {
    cursor: pointer;
    user-select: none;
    color: #464545;
    margin: 0;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.progress-container {
    margin: 0.5rem 0;
}

.progress {
    height: 5px;
    cursor: pointer;
    border-radius: 3px;
    overflow: visible;
    background-color: #e5e7eb;
}

.progress-bar {
    background-color: var(--primary-color);
    transition: width 0.1s linear;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #bbb7b773;
    border-radius: 5px;
}

.volume-label {
    font-size: 0.75rem;
    color: #414040;
    font-weight: 500;
    min-width: auto;
}

.volume-slider {
    flex: 1;
    cursor: pointer;
    height: 4px;
    border-radius: 3px;
}

.volume-display {
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    font-size: 0.75rem;
}

.volume-display.boosted {
    color: var(--danger-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.empty-state {
    padding: 3rem;
}

#playingCounter {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

input[type="file"] {
    cursor: pointer;
    background-color: #f8f9ff;
    transition: all 0.3s;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: rgba(148, 147, 172, 0.527);
    color: rgb(0, 0, 0);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 1rem;
    transition: all 0.3s;
}

input[type="file"]::file-selector-button:hover {
    background-color: var(--primary-dark);
}

input[type="file"]:hover {
    background-color: #dce4ff;
    border-color: var(--primary-dark);
}

.filter-section {
    margin-top: 1.5rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 20px;
    border: 2px solid transparent;
    background: #d1d5db;
    color: #374151;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-btn:hover {
    background: #9ca3af;
    color: #1f2937;
    transform: translateY(-1px);
}

.filter-btn.active {
    color: white;
    border-color: currentColor;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-btn.active.filter-all {
    background: var(--primary-color);
}

.filter-btn.active.filter-playing {
    background: var(--success-color);
}

.filter-btn.active.filter-paused {
    background: var(--warning-color);
}

.filter-btn.active.filter-stopped {
    background: #6b7280;
}

.filter-btn.active.filter-loop {
    background: var(--purple-color);
}

.filter-btn i {
    font-size: 0.9rem;
}

.history-panel {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.history-header h6 {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-header i {
    color: var(--primary-color);
}

#historyCounter {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 0.5rem;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.history-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid var(--success-color);
}

.history-item:hover {
    transform: translateX(3px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.history-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-time {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.history-item-time i {
    color: var(--success-color);
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #999;
    text-align: center;
    height: 100%;
    min-height: 200px;
}

.history-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.history-empty p {
    margin: 0;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .controls-panel .card-body {
        padding: 1rem;
    }
    
    .audio-item .card-body {
        padding: 0.6rem 0.75rem;
    }
    
    .audio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    
    .audio-status {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .audio-name {
        font-size: 0.9em;
    }
    
    .filter-buttons {
        justify-content: flex-start;
    }
    
    .group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .group-info {
        width: 100%;
        justify-content: space-between;
    }

    .github-footer {
        bottom: 10px;
        right: 10px;
    }
}
