:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #f59e0b;
    --text-color: #f8fafc;
    --text-muted: #cbd5e1;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-radius: 12px;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.controls-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.add-controls {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 300px;
}

input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--surface-light);
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.compare-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.compare-controls label {
    font-weight: 600;
    color: var(--text-muted);
}

select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--surface-light);
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: var(--primary-color);
}

.error-container {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: #fca5a5;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.loading-container {
    text-align: center;
    margin: 3rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.dashboard-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}

.main-column {
    flex: 3;
    min-width: 300px;
}

.side-column {
    flex: 1;
    min-width: 300px;
    position: sticky;
    top: 2rem;
}

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

.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: relative;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out forwards;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.4), 0 10px 15px -6px rgba(0, 0, 0, 0.2);
}

.card.highlight {
    border-top-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.remove-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    z-index: 2;
}

.remove-btn:hover {
    background: var(--error-color);
    color: white;
    transform: scale(1.1);
}

.card-image-container {
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    border-radius: 8px;
}

.card-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.card:hover .card-image {
    transform: scale(1.1);
}

.card-title {
    text-transform: capitalize;
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    text-align: center;
}

.card-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-types {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: rgba(255,255,255,0.1);
}

.card-stats {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: var(--text-color);
}

.stat-value.highlighted-value {
    color: var(--accent-color);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.stats-panel {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.stats-panel h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--surface-light);
    font-size: 1.3rem;
}

.winner-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.winner-card h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.winner-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin: 0 auto 0.5rem;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.5));
}

.winner-name {
    text-transform: capitalize;
    font-size: 1.3rem;
    font-weight: 700;
}

.winner-value {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.leaderboard {
    margin-top: 1.5rem;
}

.leaderboard h4 {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.1);
    margin-bottom: 0.25rem;
    border-radius: 4px;
}

.leaderboard-item:first-child {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--accent-color);
}

.item-rank-name {
    display: flex;
    gap: 0.75rem;
}

.item-rank {
    color: var(--text-muted);
    font-weight: bold;
}

.item-name {
    text-transform: capitalize;
    font-weight: 500;
}

.item-value {
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .dashboard-content {
        flex-direction: column;
    }
    
    .side-column {
        width: 100%;
        position: static;
        order: -1;
    }
    
    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-controls {
        flex-direction: column;
    }
}
