/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header h1 i {
    color: #667eea;
}

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

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

/* Main content */
.main-content {
    display: grid;
    gap: 30px;
}

/* Audio player container */
.audio-player-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-info {
    text-align: center;
    margin-bottom: 25px;
}

.audio-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.audio-info p {
    color: #718096;
    font-size: 0.9rem;
}

/* Audio controls */
.audio-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-btn {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

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

.control-btn.playing {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-control label {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}

.speed-control select {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #4a5568;
}

/* Progress bar */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
    cursor: pointer;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s ease;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #718096;
}

/* Transcript container */
.transcript-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.transcript-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4a5568;
}

.transcript {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #4a5568;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.transcript .placeholder {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
}

.transcript-word {
    display: inline-block;
    padding: 2px 4px;
    margin: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.transcript-word:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.transcript-word.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.05);
}

.transcript-word.clickable {
    text-decoration: underline;
    text-decoration-color: #667eea;
    text-decoration-thickness: 2px;
}

.transcript-word.interactive {
    cursor: pointer;
    border: 1px dashed #667eea;
    border-radius: 4px;
    padding: 2px 4px;
    transition: all 0.2s ease;
}

.transcript-word.interactive:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #764ba2;
}

.transcript-word.clicked {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    transform: scale(1.05);
}

.control-btn.recording {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Content management */
.content-management {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.content-management h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 20px;
}

.upload-section {
    display: grid;
    gap: 20px;
}

.file-upload, .transcript-upload, .title-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-upload label, .transcript-upload label, .title-input label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.file-upload input, .title-input input {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f7fafc;
    transition: border-color 0.3s ease;
}

.file-upload input:focus, .title-input input:focus {
    outline: none;
    border-color: #667eea;
}

.transcript-controls-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.timestamp-help {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.transcript-upload textarea {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f7fafc;
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.transcript-upload textarea:focus {
    outline: none;
    border-color: #667eea;
}

.save-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    margin-top: 10px;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #app {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .audio-player-container,
    .transcript-container,
    .content-management {
        padding: 20px;
    }
    
    .audio-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .transcript-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .transcript {
        font-size: 1rem;
        max-height: 300px;
    }
    
    .upload-section {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.3rem;
    }
    
    .audio-info h2 {
        font-size: 1.2rem;
    }
    
    .transcript {
        font-size: 0.9rem;
        padding: 15px;
    }
}

/* Scrollbar styling */
.transcript::-webkit-scrollbar {
    width: 6px;
}

.transcript::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.transcript::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.transcript::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
