/* CoverCraft - Mobile-First CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.app-container {
    position: relative;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    background: #ffffff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background: #ffffff;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.3s ease;
    overflow-y: auto;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6366f1;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
}

.progress-indicator {
    background: #6366f1;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Loading Screen */
#loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.loading-content {
    text-align: center;
    color: white;
}

.logo {
    font-size: 3rem;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

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

/* Welcome Screen */
.welcome-content {
    padding: 2rem 1.5rem;
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-large {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.features-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-item {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    color: #374151;
    border-left: 4px solid #6366f1;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.secondary-btn {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
}

/* Export and Sharing Styles */
.export-content {
    text-align: center;
    padding: 2rem;
}

.export-preview {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.cover-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cover-artwork {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.cover-info h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.cover-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.audio-preview {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.waveform-placeholder {
    height: 60px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 4px;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.playback-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sharing-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.share-btn {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

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

.share-icon {
    font-size: 1.5rem;
}

.download-section {
    margin: 2rem 0;
}

.create-another {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.tracks-remaining {
    color: var(--secondary-color);
    font-weight: 500;
    margin-top: 0.5rem;
}

.app-branding {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-modal:hover {
    background: var(--bg-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

/* Scale Selection Styles */
.scale-selection-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: 8px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--card-bg);
    color: var(--text-primary);
}

.scale-tab {
    display: none;
}

.scale-tab.active {
    display: block;
}

.scale-tab label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.scale-tab select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.scale-tab select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.scale-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.sample-controls {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-top: 1.5rem;
}

.sample-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Manual Selection Button */
.manual-selection {
    text-align: center;
    margin: 1rem 0;
}

.manual-selection button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manual-selection button:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

/* Preview Button Styles */
.preview-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

.preview-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

/* YouTube Preview Styles */
.youtube-preview {
    text-align: center;
    margin: 1rem 0;
}

.youtube-preview iframe {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Length Warning */
.length-warning {
    color: #f59e0b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.result-actions button {
    flex: 1;
    max-width: 150px;
}

/* Enhanced Voice Canvas */
#voice-canvas {
    border-radius: 12px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(59, 130, 246, 0.2);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-message {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
}

.loading-progress {
    width: 300px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Usage Info Styles */
.usage-info {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.usage-stats h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.usage-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-warning {
    color: #f59e0b;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.quota-message, .rate-limit-message {
    text-align: center;
    padding: 1.5rem;
}

.quota-message h4, .rate-limit-message h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Tempo Control Styles */
.tempo-control {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tempo-control h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.tempo-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.tempo-slider-container label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.tempo-slider {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.tempo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tempo-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tempo-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
}

#preview-tempo {
    margin-top: 0.5rem;
}

/* Enhanced Calibration Result */
.calibration-result .result-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.calibration-result .result-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.calibration-result .result-card p {
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calibration-result .result-card p span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Recording Timer Styles */
.recording-timer {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.timer-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) 0%, var(--bg-secondary) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    position: relative;
    transition: background 0.3s ease;
}

.timer-circle::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 50%;
    z-index: 1;
}

.timer-circle span {
    position: relative;
    z-index: 2;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.recording-timer p {
    margin: 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Voice Calibration */
.calibration-content {
    padding: 1.5rem;
}

.instruction-card {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.voice-visualizer {
    background: #1f2937;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

#voice-canvas {
    background: #111827;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 300px;
    height: 150px;
}

.frequency-display {
    display: flex;
    justify-content: space-between;
    color: #e5e7eb;
    font-family: monospace;
}

.calibration-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Upload Methods */
.upload-content {
    padding: 1.5rem;
}

.upload-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.upload-method {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-method.active {
    background: #eff6ff;
    border-color: #3b82f6;
}

.method-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.input-field {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
}

/* Style Selection */
.style-content {
    padding: 1.5rem;
}

.mood-options, .genre-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mood-option, .genre-option {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.mood-option.selected, .genre-option.selected {
    background: #eff6ff;
    border-color: #3b82f6;
}

/* Track Controls */
.customization-content {
    padding: 1.5rem;
}

.track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #6366f1;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Recording */
.recording-content {
    padding: 1.5rem;
}

.recording-studio {
    background: #1f2937;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

#camera-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.record-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Share Buttons */
.share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.share-btn.instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743);
    color: white;
}

.share-btn.whatsapp {
    background: #25d366;
    color: white;
}

.share-btn.facebook {
    background: #1877f2;
    color: white;
}

/* Responsive */
@media (min-width: 640px) {
    .app-container {
        max-width: 640px;
    }
}

.hidden { display: none; }
.form-section { display: none; }
.form-section.active { display: block; }
