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

body {
    font-family: 'Cal Sans', system-ui, -apple-system, sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e5e5;
}

.header h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #4a4a4a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.1rem;
    color: #666;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Audio Section */
.audio-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    font-weight: 500;
}

.upload-btn:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
    transform: translateY(-1px);
}

.audio-player {
    margin-top: 1rem;
}

.audio-player audio {
    width: 100%;
    margin-bottom: 1rem;
}

.audio-info {
    display: flex;
    justify-content: space-between;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.audio-debug {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: #999;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

/* Editor Section */
.editor-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.editor-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
}

.lyrics-container {
    max-height: 400px;
    overflow-y: auto;
}

.line-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.timestamp-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.timestamp-btn:hover {
    background: #333;
    transform: scale(1.02);
}

.lyric-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.5rem;
    outline: none;
}

.lyric-input:focus {
    background: white;
    border-radius: 4px;
}

.remove-line {
    background: #dc3545;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-line:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Output Section */
.output-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.output-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.output-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lrc-output {
    width: 100%;
    height: 300px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #f8f9fa;
    resize: vertical;
}

/* Preview Section */
.preview-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e5e5;
}

.preview-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.spotify-preview {
    background: linear-gradient(135deg, #1db954 0%, #191414 100%);
    border-radius: 12px;
    padding: 2rem;
    color: white;
}

.spotify-player {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.album-art {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    flex: 1;
}

.track-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.artist-name {
    font-size: 1rem;
    opacity: 0.8;
}

.control-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.lyrics-display {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.lyrics-scroll {
    max-height: 200px;
    overflow-y: auto;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
}

.lyric-line {
    margin: 0.5rem 0;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.lyric-line.active {
    opacity: 1;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1db954;
}

.lyric-line.preview {
    opacity: 0.7;
    font-size: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn.primary {
    background: #1a1a1a;
    color: white;
}

.btn.primary:hover {
    background: #333;
    transform: translateY(-1px);
}

.btn.secondary {
    background: #f1f3f4;
    color: #1a1a1a;
    border: 1px solid #e5e5e5;
}

.btn.secondary:hover {
    background: #e8eaed;
    transform: translateY(-1px);
}

/* Instructions */
.instructions {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.instructions h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.instructions ol {
    margin-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.5rem;
    color: #666;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

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

.modal h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

#bulkLyricsInput {
    width: 100%;
    height: 200px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Cal Sans', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 1.5rem;
}

#bulkLyricsInput:focus {
    outline: none;
    border-color: #1a1a1a;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Import Modal Styles */
#lrcFileInput {
    margin-bottom: 1rem;
}

#lrcPreview {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #f8f9fa;
    resize: vertical;
}

#importModal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Additional Controls */
.output-controls {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

#selectLRCFile {
    width: 100%;
    margin-bottom: 1rem;
}

/* Responsive Design */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
        padding: 3rem;
    }
    
    .main-content {
        grid-template-columns: 1.2fr 2.5fr 1.3fr;
        gap: 3rem;
    }
    
    .header h1 {
        font-size: 3.5rem;
    }
    
    .header p {
        font-size: 1.25rem;
    }
    
    .lyrics-container {
        max-height: 500px;
    }
    
    .lrc-output {
        height: 400px;
    }
}

/* Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .container {
        max-width: 1200px;
        padding: 2.5rem;
    }
    
    .main-content {
        grid-template-columns: 1fr 2.2fr 1.2fr;
        gap: 2.5rem;
    }
}

/* Medium Desktop (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 100%;
        padding: 2rem;
    }
    
    .main-content {
        grid-template-columns: 1fr 2fr 1fr;
        gap: 2rem;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
}

/* Small Desktop/Large Tablet (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        padding: 1.5rem;
    }
    
    .main-content {
        grid-template-columns: 1fr 1.5fr;
        gap: 1.5rem;
    }
    
    .audio-section {
        grid-column: 1;
        grid-row: 1;
    }
    
    .editor-section {
        grid-column: 2;
        grid-row: 1;
    }
    
    .output-section {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    .header h1 {
        font-size: 2.25rem;
    }
    
    .lyrics-container {
        max-height: 350px;
    }
    
    .lrc-output {
        height: 250px;
    }
    
    .output-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* Tablet (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .container {
        padding: 1.25rem;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .editor-header,
    .output-header,
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .editor-controls,
    .output-controls {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
        width: 100%;
    }
    
    .spotify-player {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .line-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .timestamp-btn {
        min-width: 70px;
        font-size: 0.8rem;
    }
    
    .lyric-input {
        min-width: 200px;
    }
}

/* Mobile (up to 575px) */
@media (max-width: 575px) {
    .container {
        padding: 1rem;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 0.95rem;
    }
    
    .audio-section,
    .editor-section,
    .output-section,
    .preview-section,
    .instructions {
        padding: 1.25rem;
    }
    
    .editor-header,
    .output-header,
    .preview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .editor-controls,
    .output-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .line-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .timestamp-btn {
        align-self: flex-start;
        min-width: auto;
        width: fit-content;
    }
    
    .remove-line {
        align-self: flex-end;
        margin-top: -0.5rem;
    }
    
    .spotify-player {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .album-art {
        width: 60px;
        height: 60px;
        align-self: center;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        align-self: center;
    }
    
    .lyrics-container {
        max-height: 300px;
    }
    
    .lrc-output {
        height: 200px;
        font-size: 0.8rem;
    }
    
    .lyrics-scroll {
        max-height: 150px;
        font-size: 1rem;
    }
    
    .lyric-line.active {
        font-size: 1.1rem;
    }
    
    .modal {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }
    
    #bulkLyricsInput {
        height: 150px;
        font-size: 0.9rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        padding: 0.6rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* Ultra-wide screens (1600px+) */
@media (min-width: 1600px) {
    .container {
        max-width: 1600px;
        padding: 4rem;
    }
    
    .main-content {
        grid-template-columns: 1.3fr 2.8fr 1.4fr;
        gap: 3.5rem;
    }
    
    .header h1 {
        font-size: 4rem;
    }
    
    .header p {
        font-size: 1.3rem;
    }
    
    .lyrics-container {
        max-height: 600px;
    }
    
    .lrc-output {
        height: 450px;
    }
    
    .spotify-preview {
        padding: 3rem;
    }
    
    .lyrics-scroll {
        max-height: 250px;
        font-size: 1.2rem;
    }
}

/* High DPI/Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header h1 {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .timestamp-btn,
    .btn {
        -webkit-font-smoothing: antialiased;
    }
}

/* Print styles */
@media print {
    .container {
        max-width: none;
        padding: 0;
    }
    
    .header,
    .audio-section,
    .preview-section,
    .instructions,
    .modal-overlay {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        page-break-inside: avoid;
    }
    
    .editor-controls,
    .output-controls {
        display: none;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .audio-section {
        grid-column: 1;
    }
    
    .editor-section {
        grid-column: 2;
    }
    
    .output-section,
    .preview-section {
        grid-column: 1 / -1;
    }
    
    .lyrics-container {
        max-height: 200px;
    }
    
    .spotify-player {
        flex-direction: row;
        justify-content: center;
    }
}

/* Hover effects for desktop only */
@media (hover: hover) and (pointer: fine) {
    .upload-btn:hover,
    .btn:hover,
    .timestamp-btn:hover,
    .remove-line:hover,
    .control-btn:hover {
        transform: translateY(-1px);
    }
    
    .line-item:hover {
        transform: translateX(2px);
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .lyric-line {
        scroll-behavior: auto;
    }
}