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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --success: #10b981;
    --error: #ef4444;
    --border-radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-top: env(safe-area-inset-top, 20px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
header {
    text-align: center;
    padding: 20px 0;
    position: relative;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.settings-btn {
    position: absolute;
    top: 20px;
    right: 0;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.settings-btn:hover {
    opacity: 1;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

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

/* Listen Button */
#listen-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.listen-button {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.listen-button:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.4);
}

.listen-button:active {
    transform: scale(0.98);
}

.listen-button.listening {
    animation: pulse 1.5s infinite;
}

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

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--primary-light);
    opacity: 0;
}

.listening .pulse-ring {
    animation: ring 1.5s infinite;
}

@keyframes ring {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.listen-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.listen-text {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.status {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

.status.listening {
    color: var(--primary-light);
}

/* Song Card */
.song-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.album-art {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-card-hover);
}

.song-details {
    flex: 1;
    min-width: 0;
}

#song-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#song-artist {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.album-name {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Movies Section */
#movies-section {
    margin-bottom: 24px;
}

#movies-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.movies-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.movie-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: background 0.2s;
}

.movie-card:hover {
    background: var(--bg-card-hover);
}

.movie-poster {
    width: 60px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-card-hover);
}

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

.movie-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.movie-year {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.movie-rating .star {
    color: #fbbf24;
}

.movie-scene {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    border-left: 3px solid var(--primary-color);
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

/* Buttons */
.btn {
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

/* Error Card */
.error-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

#error-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    margin-bottom: 8px;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.api-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--primary-light);
    text-decoration: none;
}

.api-link:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--primary-light);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 380px) {
    .app-container {
        padding: 16px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .listen-button {
        width: 150px;
        height: 150px;
    }

    .listen-icon {
        font-size: 2.5rem;
    }
}

/* Dark mode scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 3px;
}
