* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Background Gradient === */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    background-color: #f4f6fb;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

.container {
    max-width: 960px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    margin: 0 auto;
    padding: 40px 50px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    position: relative;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Header === */
header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid #e8eaf6;
}

h1 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.subtitle {
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #1e293b;
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e8eaf6;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.5);
    padding: 8px;
    border-radius: 12px;
}

.tab {
    flex: 1;
    padding: 14px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    color: #64748b;
}

.tab:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* === Tab Content === */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Form === */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    width: 100%;
}

label {
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
    color: #334155;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input,
select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1e293b;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

input:hover,
select:hover {
    border-color: #cbd5e1;
}

select[multiple] {
    min-height: 200px;
    padding: 12px;
}

/* === Buttons === */
.buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 35px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex: 1;
    min-width: 200px;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-green:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-blue:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* === Footer === */
.footer {
    text-align: center;
    color: #64748b;
    font-size: 15px;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid #e8eaf6;
}

.footer p {
    margin: 0;
}

/* === Loading Overlay === */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
}

/* === Results Container === */
.results-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.results-header {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#results-count {
    color: #667eea;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* === Player Cards === */
.player-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 24px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.player-card:hover::before {
    opacity: 1;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}

.player-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.player-id {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.player-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
}

/* WN8 Color Classes - zgodne z XVM */
/* 0-244: Szary (tomato/below average) */
.wn8-stat.wn8-poor,
.player-card.wn8-poor {
    border-left: 4px solid #9e9e9e;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.wn8-stat.wn8-poor .stat-value {
    color: #616161;
}

/* 245-649: Czerwony */
.player-card.wn8-red {
    border-left: 4px solid #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.player-card.wn8-red::before {
    background: linear-gradient(90deg, #f44336 0%, #e91e63 100%);
    opacity: 0;
}

.player-card.wn8-red:hover::before {
    opacity: 1;
}

/* 650-899: Pomarańczowy */
.player-card.wn8-orange {
    border-left: 4px solid #ff9800;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.player-card.wn8-orange::before {
    background: linear-gradient(90deg, #ff9800 0%, #ff5722 100%);
    opacity: 0;
}

.player-card.wn8-orange:hover::before {
    opacity: 1;
}

/* 900-1249: Żółty */
.player-card.wn8-avg {
    border-left: 4px solid #ffeb3b;
    background: linear-gradient(135deg, #fffde7 0%, #fff59d 100%);
}

.player-card.wn8-avg::before {
    background: linear-gradient(90deg, #ffeb3b 0%, #ffc107 100%);
    opacity: 0;
}

.player-card.wn8-avg:hover::before {
    opacity: 1;
}

.wn8-stat.wn8-avg .stat-value {
    color: #f57f17;
}

/* 1250-1599: Zielony (dobry) */
.player-card.wn8-good {
    border-left: 4px solid #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.player-card.wn8-good::before {
    background: linear-gradient(90deg, #4caf50 0%, #66bb6a 100%);
    opacity: 0;
}

.player-card.wn8-good:hover::before {
    opacity: 1;
}

.wn8-stat.wn8-good .stat-value {
    color: #2e7d32;
}

/* 1600-1899: Niebieski (bardzo dobry) */
.player-card.wn8-blue {
    border-left: 4px solid #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.player-card.wn8-blue::before {
    background: linear-gradient(90deg, #2196f3 0%, #42a5f5 100%);
    opacity: 0;
}

.player-card.wn8-blue:hover::before {
    opacity: 1;
}

.wn8-stat.wn8-blue .stat-value {
    color: #1565c0;
}

/* 1900+: Fioletowy (unicum) */
.player-card.wn8-unicum {
    border-left: 4px solid #9c27b0;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.player-card.wn8-unicum::before {
    background: linear-gradient(90deg, #9c27b0 0%, #ba68c8 100%);
    opacity: 0;
}

.player-card.wn8-unicum:hover::before {
    opacity: 1;
}

.wn8-stat.wn8-unicum {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.wn8-stat.wn8-unicum .stat-value {
    color: #7b1fa2;
}

.wn8-stat.wn8-blue {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.wn8-stat.wn8-blue .stat-value {
    color: #1565c0;
}

.wn8-stat.wn8-orange {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.wn8-stat.wn8-orange .stat-value {
    color: #e65100;
}

.wn8-stat.wn8-red {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.wn8-stat.wn8-red .stat-value {
    color: #c62828;
}

/* Winrate Color Classes */
.winrate-stat.winrate-high {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.winrate-stat.winrate-high .stat-value {
    color: #059669;
}

.winrate-stat.winrate-medium {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.winrate-stat.winrate-medium .stat-value {
    color: #2563eb;
}

.winrate-stat.winrate-low {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.winrate-stat.winrate-low .stat-value {
    color: #dc2626;
}

/* Player Actions */
.player-actions {
    margin-top: 16px;
}

.btn-profile {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-profile:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* No Results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border: 2px dashed #cbd5e1;
}

.no-results p {
    font-size: 20px;
    color: #64748b;
    font-weight: 600;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 25px 20px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        min-width: auto;
    }
    
    .tabs {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 14px;
    }
}
