/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --spotify-green: #1DB954;
    --twitter-blue: #1da1f2;
    --facebook-blue: #4267B2;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.logo-image {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

/* Card Styles */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card h2 .icon {
    font-size: 1.5rem;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

/* Mood Selection */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mood-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.mood-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.mood-emoji {
    font-size: 2rem;
}

.mood-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Genre Selection */
.genre-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.genre-btn {
    padding: 0.5rem 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.genre-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.genre-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Tempo Control */
.tempo-control {
    text-align: center;
}

.tempo-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.tempo-slider {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.tempo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}

.tempo-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.tempo-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

.tempo-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1rem 0;
}

.tempo-display span {
    font-size: 2.5rem;
}

.tempo-presets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.preset-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

/* Generate Button */
.generate-section {
    text-align: center;
    margin: 2rem 0;
}

.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(99, 102, 241, 0.4);
}

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

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.25rem;
}

/* Playlist Section */
.playlist-section {
    animation: slideUp 0.4s ease;
}

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

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.playlist-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.playlist-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.playlist-tag {
    padding: 0.35rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Playlist Tracks */
.playlist-tracks {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.track-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.track-item:hover {
    background: var(--primary-light);
}

.track-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-duration {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Spotify Section */
.spotify-section {
    padding: 1.25rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.spotify-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.spotify-icon {
    color: var(--spotify-green);
    display: flex;
}

.spotify-description {
    color: #a0a0a0;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.spotify-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--spotify-green);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spotify-btn:hover {
    background: #1ed760;
    transform: scale(1.02);
}

/* Sharing Section */
.sharing-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.copy-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

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

.twitter-btn:hover {
    background: #333;
}

.facebook-btn {
    background: var(--facebook-blue);
    color: white;
}

.facebook-btn:hover {
    background: #365899;
}

.export-btn {
    background: var(--secondary-color);
    color: white;
}

.export-btn:hover {
    background: #059669;
}

.share-notification {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--secondary-color);
    color: white;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.share-notification.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 1.5rem;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .header {
        padding: 2rem 1rem 1.5rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

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

    .mood-emoji {
        font-size: 1.75rem;
    }

    .genre-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .tempo-presets {
        flex-direction: column;
    }

    .preset-btn {
        width: 100%;
    }

    .generate-btn {
        width: 100%;
        justify-content: center;
    }

    .playlist-header {
        flex-direction: column;
    }

    .playlist-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
    }

    .share-buttons {
        flex-direction: column;
    }

    .share-btn {
        width: 100%;
        justify-content: center;
    }

    .logo-image {
        width: 40px;
        height: 40px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .mood-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --border: #334155;
        --primary-light: rgba(99, 102, 241, 0.2);
    }

    .mood-btn,
    .genre-btn,
    .preset-btn,
    .action-btn,
    .copy-btn {
        background: var(--background);
    }

    .track-item {
        background: rgba(255, 255, 255, 0.05);
    }

    .track-item:hover {
        background: rgba(99, 102, 241, 0.2);
    }

    .footer {
        background: var(--surface);
    }
}

/* Print styles */
@media print {
    .header,
    .generate-section,
    .spotify-section,
    .sharing-section,
    .playlist-actions,
    .footer {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
