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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
    color: #fff;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: #f5576c;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 15px;
}

.loading-progress {
    width: 200px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin: 0 auto 10px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #f5576c);
    width: 0%;
    transition: width 0.3s ease;
}

.loading-detail {
    font-size: 0.9rem;
    color: #888;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.header .tagline {
    color: #a0a0a0;
    font-size: 1.1rem;
}

.header .lang-switch {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.lang-btn {
    padding: 6px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    color: #a0a0a0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

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

.lang-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.header .quote {
    margin-top: 15px;
    padding: 15px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border-left: 3px solid #f5576c;
    font-style: italic;
    color: #c0c0c0;
    font-size: 0.95rem;
}

/* Control Panel */
.control-panel {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-20px);
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s ease,
                transform 0.5s ease,
                padding 0.5s ease,
                margin 0.5s ease;
    padding: 0 30px;
    margin: 0;
}

.control-panel.expanded {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
    padding: 30px;
    margin-bottom: 25px;
}

.control-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.control-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.control-btn.primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.control-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
}

.control-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.control-btn.secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mode selector */
.mode-section {
    margin-bottom: 15px;
}

.mode-section-label {
    font-size: 0.95rem;
    color: #a0a0a0;
    margin-bottom: 12px;
}

.mode-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 14px 24px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 120px;
    position: relative;
}

.mode-btn .mode-icon {
    font-size: 1.5rem;
}

.mode-btn .mode-info {
    font-size: 0.75rem;
    opacity: 0.7;
}

.mode-btn:hover:not(:disabled):not(.active) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mode-btn.active:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
}

.mode-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.mode-btn .mode-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    background: rgba(255, 87, 108, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.mode-btn .mode-remove:hover {
    opacity: 1;
}

.mode-btn.caching::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    animation: loading-pulse 1s ease-in-out infinite;
}

@keyframes loading-pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Custom Upload Section */
.custom-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 15px 0 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.custom-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    transition: all 0.3s ease;
}

.custom-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.custom-upload-info {
    font-size: 0.8rem;
    color: #888;
}

/* Caching Indicator */
.caching-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #a0a0ff;
}

.caching-indicator.show {
    display: flex;
}

.caching-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #a0a0ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.stat-value.highlight {
    color: #f5576c;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 25px;
}

.progress-bar {
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    width: 0%;
    transition: width 0.1s;
    border-radius: 5px;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 500;
    color: #c0c0c0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

.setting-item input[type="number"] {
    padding: 10px 15px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 1rem;
}

.setting-item .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Volume Display */
.volume-display {
    margin-top: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.volume-display.active {
    opacity: 1;
}

.volume-label {
    font-size: 0.85rem;
    color: #a0a0a0;
    margin-bottom: 6px;
}

.volume-label strong {
    color: #667eea;
    font-size: 1rem;
}

.volume-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.volume-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #f5576c);
    width: 100%;
    transition: width 0.15s ease;
    border-radius: 3px;
}

/* Audio List */
.audio-list-section {
    margin-top: 25px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.audio-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.audio-list-title {
    font-size: 1rem;
    color: #c0c0c0;
}

.audio-list-toggle {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.audio-list-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.audio-list-container {
    display: none;
    max-height: 350px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 15px;
}

.audio-list-container.show {
    display: block;
}

.audio-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.audio-list-item {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.9rem;
}

.audio-list-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.audio-list-item.playing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.audio-list-item.cached::after {
    content: '✓';
    display: block;
    font-size: 0.7rem;
    color: #2ecc71;
    margin-top: 4px;
}

/* Info Section */
.info-section {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.info-section h3 {
    color: #f5576c;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 8px 0;
    color: #a0a0a0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-section li::before {
    content: '💡';
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    display: none;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.status-bar.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .control-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mode-btn {
        padding: 12px 18px;
        min-width: 100px;
    }

    .audio-list-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .control-panel {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.4rem;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 20px;
}

.footer a {
    display: inline-flex;
    align-items: center;
    color: #a0a0a0;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    padding: 10px 20px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.footer a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.footer a svg {
    fill: currentColor;
}
