:root {
    --bg-dark: #0f172a;
    --primary: #1db954;
    --primary-hover: #1ed760;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --error: #ef4444;
    --success: #10b981;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Dynamic Background */
.background-elements {
    position: absolute;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite alternate linear;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4338ca;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #0f766e;
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.1); }
}

/* Glass Container */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.gradient-text {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1db954 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: opacity 0.3s ease;
}

.view.hidden {
    display: none;
    opacity: 0;
}

#unauthenticated-view p {
    text-align: center;
    color: var(--text-muted);
}

.dev-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem;
    border-radius: 12px;
    margin-top: -0.5rem;
    line-height: 1.4;
    text-align: center;
}

.dev-warning strong {
    color: var(--error);
    display: block;
    margin-bottom: 0.25rem;
}

/* Buttons */
.spotify-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: var(--primary);
    color: #fff;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px 0 rgba(29, 185, 84, 0.39);
}

.spotify-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 185, 84, 0.5);
}

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

/* User Area */
.user-greeting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 12px;
}

.highlight {
    font-weight: 600;
    color: var(--primary);
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.text-btn:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* Form */
.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

input[type="url"] {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

input[type="url"]:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.2);
}

input[type="url"]::placeholder {
    color: var(--text-muted);
}

.submit-btn {
    background: white;
    color: var(--bg-dark);
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(255, 255, 255, 0.2);
}

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

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

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(15, 23, 42, 0.3);
    border-radius: 50%;
    border-top-color: var(--bg-dark);
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

.loader.hidden {
    display: none;
}

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

/* Messages */
.message {
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.message.hidden {
    display: none;
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 0;
    border-radius: 999px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* Search Wrapper */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper input {
    width: 100%;
    padding: 1.2rem 3.5rem 1.2rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.search-wrapper input:focus {
    outline: none;
    border-color: rgba(29, 185, 84, 0.5);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.1), inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.search-wrapper input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    position: absolute;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
    border-color: var(--glass-border);
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Search Results Container */
.results-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    margin-top: -0.5rem;
    animation: fadeIn 0.2s ease;
}

.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.track-info {
    flex: 1;
    overflow: hidden;
}

.track-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Submissions View */
.submissions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.submissions-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.submissions-header .icon-btn {
    position: static;
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.submissions-list::-webkit-scrollbar {
    width: 8px;
}
.submissions-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.submission-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: border-color 0.3s, transform 0.2s;
}

.submission-item:hover {
    border-color: var(--glass-border);
    transform: translateX(4px);
}

.submission-meta {
    display: flex;
    flex-direction: column;
    margin-left: auto;
    align-items: flex-end;
}

.submission-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.submission-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.spotify-link-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: rgba(29, 185, 84, 0.15);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 0.35rem;
    border: 1px solid rgba(29, 185, 84, 0.3);
}

.spotify-link-btn:hover {
    background: rgba(29, 185, 84, 0.3);
    color: #fff;
    transform: translateY(-1px);
}

.loading-state, .empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.95rem;
}
