/* YouLoud Chart - List Design */
:root {
    --primary: #007AFF;
    --primary-dark: #0056CC;
    --secondary: #5856D6;
    --success: #34C759;
    --warning: #FF9500;
    --error: #FF3B30;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --bg-card: #ffffff;
    --bg-hover: #f8f9fa;
    
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #8e8e93;
    
    --border: #d2d2d7;
    --border-light: #e5e5ea;
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 5px 0 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}

.header h1 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 auto 1px;
    letter-spacing: -0.02em;
    max-width: 100px;
    text-align: center;
}

.header p {
    font-size: 0.625rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 120px;
    margin: 0 auto 16px;
    text-align: center;
}

/* Style Switcher */
.style-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.switcher-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.style-buttons {
    display: flex;
    gap: 6px;
}

.style-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 60px;
    justify-content: center;
}

.style-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.style-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.style-btn.active:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.style-icon {
    font-size: 0.875rem;
}

.style-name {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Chart Grid - List Layout */
.chart-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Track Card - Spotify Style */
.track-card {
    background: var(--bg-card);
    display: grid;
    grid-template-columns: 40px 40px 60px 1fr 120px 80px 200px;
    align-items: center;
    padding: 12px 20px;
    transition: all 0.2s ease;
    position: relative;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.track-card:last-child {
    border-bottom: none;
}

.track-card:hover {
    background: var(--bg-hover);
}

/* Track Rank */
.track-rank {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Track Position Change */
.track-position-change {
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    padding: 4px 8px;
    border-radius: 12px;
}

.track-position-change.up {
    color: var(--success);
    background: rgba(52, 199, 89, 0.1);
}

.track-position-change.down {
    color: var(--error);
    background: rgba(255, 59, 48, 0.1);
}

.track-position-change.new {
    color: var(--secondary);
    background: rgba(88, 86, 214, 0.1);
}

/* Track Artwork */
.track-artwork {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* Track Info */
.track-info {
    min-width: 0;
}

.track-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.track-artist {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Track Votes Total */
.track-votes-total {
    text-align: center;
}

.votes-number {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Track Votes Daily */
.track-votes-daily {
    text-align: center;
}

.daily-change {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.daily-change.positive {
    color: var(--success);
    background: rgba(52, 199, 89, 0.1);
}

.daily-change.neutral {
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

/* Track Actions */
.track-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.vote-btn {
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    text-align: center;
}

.vote-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.itunes-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    min-width: 60px;
    justify-content: center;
}

.itunes-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.apple-music-logo {
    width: 16px;
    height: 16px;
}

/* Loading & Error States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: var(--error);
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header {
        padding: 15px 0 15px;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .track-card {
        grid-template-columns: 30px 30px 50px 1fr 80px 60px 150px;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .track-artwork {
        width: 50px;
        height: 50px;
    }
    
    .track-name {
        font-size: 0.875rem;
    }
    
    .track-artist {
        font-size: 0.75rem;
    }
    
    .votes-number {
        font-size: 0.875rem;
    }
    
    .daily-change {
        font-size: 0.75rem;
    }
    
    .track-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .vote-btn {
        font-size: 0.75rem;
        padding: 6px 12px;
        min-width: 60px;
    }
    
    .itunes-btn {
        font-size: 0.75rem;
        padding: 6px 8px;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    .track-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .track-content {
        margin-right: 0;
        min-width: auto;
    }
    
    .track-stats {
        margin-right: 0;
        justify-content: space-between;
    }
    
    .track-actions {
        justify-content: center;
    }
}

/* Payment Modal Styles */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.payment-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
}

.payment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.payment-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.payment-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.payment-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.payment-modal-body {
    margin-bottom: 20px;
}

.track-info {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.track-info strong {
    color: var(--text-primary);
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
}

.artist-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.payment-amount {
    margin-bottom: 20px;
}

.payment-amount label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 6px;
}

.payment-amount input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.payment-amount input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.votes-preview {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.2);
    color: var(--primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    font-size: 0.875rem;
}

.payment-methods h4 {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.payment-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.payment-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.payment-options label:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.payment-options input[type="radio"] {
    accent-color: var(--primary);
}

.payment-disclaimer {
    margin-top: 12px;
    text-align: center;
}

.payment-disclaimer small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.payment-modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Focus styles */
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
