/* Global Styles - Minimal Dark Mode Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors - Muted and less bright */
    --background: 222 15% 8%;
    --foreground: 220 10% 96%;
    
    --card: 222 15% 10%;
    --card-foreground: 220 10% 96%;
    
    --popover: 222 15% 10%;
    --popover-foreground: 220 10% 96%;
    
    --primary: 210 40% 55%;
    --primary-foreground: 220 10% 98%;
    
    --secondary: 222 13% 14%;
    --secondary-foreground: 220 10% 96%;
    
    --muted: 220 10% 20%;
    --muted-foreground: 220 8% 65%;
    
    --accent: 222 13% 14%;
    --accent-foreground: 220 10% 96%;
    
    --destructive: 0 50% 50%;
    --destructive-foreground: 220 10% 98%;
    
    --success: 142 50% 45%;
    --success-foreground: 220 10% 98%;
    
    --border: 220 10% 25%;
    --input: 220 10% 25%;
    --ring: 210 40% 55%;
    
    --radius: 0;
    
    /* Legacy color mapping */
    --primary-color: hsl(var(--primary));
    --secondary-color: hsl(var(--secondary));
    --success-color: hsl(var(--success));
    --danger-color: hsl(var(--destructive));
    --info-color: hsl(210 50% 50%);
    --dark-color: hsl(var(--foreground));
    --light-color: hsl(var(--muted));
    --text-color: hsl(var(--foreground));
    --border-radius: var(--radius);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
}

/* Offset for anchor links to account for fixed header */
section[id] {
    scroll-margin-top: 100px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header & Navigation */
header {
    background-color: hsl(var(--background) / 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid hsl(var(--border));
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    letter-spacing: -0.01em;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: hsl(var(--foreground));
}

/* User Button Container */
.user-button-container {
    display: flex;
    align-items: center;
}

/* Login Section */
.login-section {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.login-content {
    text-align: center;
}

.login-content h3 {
    color: hsl(var(--foreground));
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 500;
}

.login-content p {
    margin-bottom: 1.5rem;
    color: hsl(var(--muted-foreground));
}

.sign-in-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Main Content */
main {
    padding: 3rem 0 2rem;
    min-height: calc(100vh - 200px);
}

/* Hero Section - Combined with info */
.hero {
    background: transparent;
    border: none;
    border-radius: var(--radius);
    padding: 2rem 0;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: clamp(1.875rem, 4vw, 2.5rem);
    margin-bottom: 0.75rem;
    color: hsl(var(--foreground));
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: transparent;
}

.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-primary:active {
    background-color: hsl(var(--primary) / 0.8);
}

.btn-secondary {
    background-color: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
}

.btn-secondary:hover {
    background-color: hsl(var(--muted) / 0.5);
}

.btn-success {
    background-color: hsl(var(--success));
    color: hsl(var(--success-foreground));
    border-color: transparent;
}

.btn-success:hover {
    background-color: hsl(var(--success) / 0.9);
}

.btn-danger {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-color: transparent;
}

.btn-danger:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-info {
    background-color: hsl(210 50% 50%);
    color: white;
    border-color: transparent;
}

.btn-info:hover {
    background-color: hsl(210 50% 45%);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Cards */
.card {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card h2, .card h3 {
    margin-bottom: 0.875rem;
    color: hsl(var(--card-foreground));
    font-weight: 500;
    font-size: 1rem;
}

.info-section {
    background: transparent;
    border: none;
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 2.5rem;
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
    font-weight: 600;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-cards .card {
    text-align: center;
    transition: border-color 0.2s ease;
}

.info-cards .card:hover {
    border-color: hsl(var(--border));
}

.info-cards .card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* Phase Info */
.current-phase {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
}

.phase-info {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.875rem;
}

/* Songs Container */
.songs-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.song-card {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.2s ease;
}

.song-card:hover {
    border-color: hsl(var(--foreground) / 0.3);
}

.song-header {
    margin-bottom: 0.875rem;
}

.song-header h3 {
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 500;
}

.song-artist {
    color: hsl(var(--muted-foreground));
    margin-bottom: 0;
    font-size: 0.875rem;
    font-weight: 400;
}

.song-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.song-player {
    flex: 1;
    min-width: 250px;
}

.song-player audio {
    width: 100%;
    border-radius: var(--radius);
    height: 40px;
}

.song-voting {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.vote-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
    color: hsl(var(--muted-foreground));
    display: flex;
    align-items: center;
    justify-content: center;
}

.vote-btn:hover:not(:disabled) {
    background: hsl(var(--muted) / 0.5);
    border-color: hsl(var(--foreground) / 0.2);
}

.vote-up:hover:not(:disabled) {
    background: hsl(var(--success) / 0.15);
    border-color: hsl(var(--success) / 0.5);
}

.vote-up.active {
    background: hsl(var(--success) / 0.2);
    color: hsl(var(--success));
    border-color: hsl(var(--success));
}

.vote-down:hover:not(:disabled) {
    background: hsl(var(--destructive) / 0.15);
    border-color: hsl(var(--destructive) / 0.5);
}

.vote-down.active {
    background: hsl(var(--destructive) / 0.2);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive));
}

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

.vote-btn.vote-up:disabled.active {
    background: hsl(var(--success));
    opacity: 0.6;
}

.vote-btn.vote-down:disabled.active {
    background: hsl(var(--destructive));
    opacity: 0.6;
}

.voting-closed-text {
    text-align: center;
    color: hsl(var(--muted-foreground));
    font-style: italic;
    padding: 0.5rem;
    margin: 0;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .song-content {
        flex-direction: column;
    }
    
    .song-player {
        width: 100%;
    }
    
    .song-voting {
        justify-content: center;
        width: 100%;
        gap: 1rem;
    }
    
    .vote-btn {
        flex: 1;
        max-width: 150px;
        height: 48px;
    }
}

/* Ranking */
.ranking-container {
    margin-top: 1.5rem;
}

.ranking-item {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s ease;
}

.ranking-item:hover {
    border-color: hsl(var(--foreground) / 0.3);
}

.ranking-position {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    min-width: 50px;
    text-align: center;
}

.ranking-item.position-1 .ranking-position {
    color: #daa520;
    font-size: 1.75rem;
}

.ranking-item.position-2 .ranking-position {
    color: #a8a8a8;
    font-size: 1.625rem;
}

.ranking-item.position-3 .ranking-position {
    color: #b87333;
    font-size: 1.5rem;
}

.ranking-info {
    flex: 1;
}

.ranking-info h3 {
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.ranking-info p {
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
    font-weight: 400;
}

.ranking-votes {
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

/* Voting Status */
.voting-status {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.status-open {
    color: hsl(var(--success));
    font-weight: 500;
}

.status-closed {
    color: hsl(var(--destructive));
    font-weight: 500;
}

/* Message Box */
.message-box {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    max-width: 380px;
    animation: slideIn 0.25s ease;
    backdrop-filter: blur(12px);
    font-size: 0.875rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message-box.hidden {
    display: none;
}

.message-box.success {
    background-color: hsl(var(--success) / 0.15);
    border-color: hsl(var(--success) / 0.5);
    color: hsl(var(--success-foreground));
}

.message-box.error {
    background-color: hsl(var(--destructive) / 0.15);
    border-color: hsl(var(--destructive) / 0.5);
    color: hsl(var(--destructive-foreground));
}

.message-box.info {
    background-color: hsl(210 50% 50% / 0.15);
    border-color: hsl(210 50% 50% / 0.5);
    color: hsl(var(--foreground));
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--primary) / 0.8);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* Footer */
footer {
    background-color: transparent;
    border-top: 1px solid hsl(var(--border));
    color: hsl(var(--muted-foreground));
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
    font-size: 0.8125rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero {
        padding: 1.5rem 0;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .songs-container {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .ranking-item {
        padding: 0.875rem;
    }
    
    .ranking-position {
        min-width: 45px;
        font-size: 1.25rem;
    }
    
    .message-box {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    
    main {
        padding: 2rem 0 1.5rem;
    }
}

/* Public Page Specific Styles */
.public-page {
    max-width: 1100px;
    margin: 0 auto;
}

.explanation-section {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.explanation-section h2 {
    color: hsl(var(--foreground));
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.explanation-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 0.9375rem;
    color: hsl(var(--muted-foreground));
}

.explanation-content p strong {
    color: hsl(var(--foreground));
    font-weight: 500;
}

.ranking-section {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.ranking-section h2 {
    color: hsl(var(--foreground));
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.ranking-info {
    margin-bottom: 1rem;
}

.ranking-type {
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.no-ranking {
    text-align: center;
    color: hsl(var(--muted-foreground));
    padding: 2rem;
    font-style: italic;
    font-size: 0.9375rem;
}

.ranking-score {
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    min-width: 100px;
    text-align: right;
    font-size: 0.8125rem;
}

.voting-section {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.voting-section h2 {
    color: hsl(var(--foreground));
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.voting-message {
    margin-bottom: 1.5rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.875rem;
}

.info-message {
    background-color: hsl(210 50% 50% / 0.1);
    border: 1px solid hsl(210 50% 50% / 0.5);
    color: hsl(var(--foreground));
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
}

.success-message {
    background-color: hsl(var(--success) / 0.1);
    border: 1px solid hsl(var(--success) / 0.5);
    color: hsl(var(--foreground));
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
}

.twitch-username-section {
    background: transparent;
    border: 1px solid hsl(var(--border));
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.twitch-username-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
}

.twitch-username-section input {
    width: 100%;
    max-width: 400px;
    padding: 0.625rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

.twitch-username-section input:focus {
    outline: none;
    border-color: hsl(var(--primary) / 0.8);
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.info-text {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

/* Clerk Dark Mode Styling */
.cl-rootBox,
.cl-card,
.cl-modalContent,
.cl-socialButtonsBlockButton,
.cl-formButtonPrimary,
.cl-footerActionLink,
.cl-internal-b3fm6y {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
}

.cl-rootBox {
    background-color: hsl(var(--background)) !important;
}

.cl-card,
.cl-modalContent,
.cl-signIn-root,
.cl-signUp-root {
    background-color: hsl(var(--card)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    box-shadow: none !important;
}

.cl-headerTitle,
.cl-headerSubtitle,
.cl-socialButtonsBlockButtonText,
.cl-formFieldLabel,
.cl-identityPreviewText,
.cl-profileSectionTitle,
.cl-userButtonPopoverActionButton,
.cl-internal-b3fm6y,
.cl-formFieldLabelRow,
.cl-formFieldLabel__identifier,
.cl-text,
.cl-selectButton__countryCode,
.cl-selectButton__countryCodeText {
    color: hsl(var(--foreground)) !important;
}

.cl-formFieldInput,
.cl-input,
.cl-formFieldInput[type="text"],
.cl-formFieldInput[type="email"],
.cl-formFieldInput[type="password"],
.cl-phoneInputBox {
    background-color: hsl(var(--background)) !important;
    border-color: hsl(var(--border)) !important;
    color: hsl(var(--foreground)) !important;
    border-radius: var(--radius) !important;
}

.cl-formFieldInput::placeholder,
.cl-input::placeholder {
    color: hsl(var(--muted-foreground)) !important;
}

.cl-formFieldInput:focus,
.cl-input:focus {
    border-color: hsl(var(--primary) / 0.8) !important;
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1) !important;
}

.cl-formButtonPrimary {
    background-color: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
    border-radius: var(--radius) !important;
    font-weight: 500 !important;
}

.cl-formButtonPrimary:hover {
    background-color: hsl(var(--primary) / 0.9) !important;
}

.cl-socialButtonsBlockButton,
.cl-socialButtonsIconButton {
    background-color: transparent !important;
    border: 1px solid hsl(var(--border)) !important;
    color: hsl(var(--foreground)) !important;
    border-radius: var(--radius) !important;
}

.cl-socialButtonsBlockButton:hover,
.cl-socialButtonsIconButton:hover {
    background-color: hsl(var(--muted) / 0.5) !important;
    border-color: hsl(var(--foreground) / 0.2) !important;
}

.cl-dividerLine {
    background-color: hsl(var(--border)) !important;
}

.cl-dividerText {
    color: hsl(var(--muted-foreground)) !important;
}

.cl-footerActionLink {
    color: hsl(var(--primary)) !important;
}

.cl-footerActionText {
    color: hsl(var(--muted-foreground)) !important;
}

.cl-footerActionLink:hover {
    color: hsl(var(--primary) / 0.9) !important;
}

.cl-userButtonPopoverCard,
.cl-userButtonPopoverMain {
    background-color: hsl(var(--card)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
}

.cl-userButtonPopoverActionButton,
.cl-userButtonPopoverActionButtonText {
    color: hsl(var(--foreground)) !important;
}

.cl-userButtonPopoverActionButton:hover {
    background-color: hsl(var(--muted) / 0.5) !important;
}

.cl-userPreview,
.cl-userPreviewMainIdentifier,
.cl-userPreviewSecondaryIdentifier,
.cl-userPreviewTextContainer,
.cl-userButtonPopoverActionButtonText,
.cl-avatarBox + div {
    color: hsl(var(--foreground)) !important;
}

.cl-userButtonPopoverFooter {
    border-top: 1px solid hsl(var(--border)) !important;
}

.cl-internal-b3fm6y,
.cl-internal-1m7shwi,
.cl-modalBackdrop {
    background-color: hsl(var(--background) / 0.8) !important;
}

.cl-otpCodeFieldInput {
    background-color: hsl(var(--background)) !important;
    border-color: hsl(var(--border)) !important;
    color: hsl(var(--foreground)) !important;
}

.cl-selectButton,
.cl-selectOptionsContainer {
    background-color: hsl(var(--background)) !important;
    border-color: hsl(var(--border)) !important;
    color: hsl(var(--foreground)) !important;
}

.cl-selectOption:hover {
    background-color: hsl(var(--muted) / 0.5) !important;
}
