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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
}

/* ===== SIDEBAR NAV ===== */
nav {
    background: #1a1a1a;
    width: 220px;
    min-height: 100vh;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.nav-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 0 1rem;
    width: 100%;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e94560;
    text-shadow: 0 0 20px rgba(233,69,96,0.2);
    text-align: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #2a2a2a;
    width: 100%;
    padding-bottom: 1rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.nav-links a {
    color: #b0b0b0;
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1rem;
}

.nav-links a:hover {
    background: #2a2a2a;
    color: #fff;
}

.nav-links a.active {
    background: #e94560;
    color: #fff;
}

/* User block in sidebar */
.user-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    border-top: 1px solid #2a2a2a;
    width: 100%;
    margin-top: auto;
    color: #aaa;
}

.user-block .user-name {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.95rem;
}

#logoutBtn {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #888;
    padding: 0.4rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    width: 100%;
}

#logoutBtn:hover {
    border-color: #e94560;
    color: #e94560;
}

/* ===== MAIN CONTENT ===== */
main {
    flex: 1;
    max-width: calc(100% - 220px);
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: 100vh;
}

.hero {
    text-align: center;
    padding: 3rem 2rem;
    background: #1a1a1a;
    border-radius: 15px;
    margin-bottom: 3rem;
    border: 1px solid #2a2a2a;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #e94560;
}

.hero p {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 2rem;
}

.btn-primary {
    background: #e94560;
    color: white;
    border: none;
    padding: 0.8rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary:hover {
    background: #ff6b6b;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(233,69,96,0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 2rem;
}

.btn-danger:hover {
    background: #c82333;
    transform: scale(1.05);
}

/* Stats Preview */
.stats-preview {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #2a2a2a;
}

.stats-preview h2 {
    margin-bottom: 1.5rem;
    color: #e94560;
}

.matches-grid {
    display: grid;
    gap: 1rem;
}

.match-item {
    background: #111111;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #e94560;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.match-item .match-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.match-item .match-map {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.match-item .match-map img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
}

.match-item .match-type {
    font-weight: bold;
    color: #e94560;
    min-width: 40px;
}

.match-item.win {
    border-left-color: #28a745;
}

.match-item.lose {
    border-left-color: #dc3545;
}

.match-item.tie {
    border-left-color: #ffc107;
}

.match-item .match-result {
    font-size: 1.2rem;
}

.match-item .match-score {
    font-weight: bold;
    min-width: 60px;
}

.match-item .match-kda {
    color: #888;
    font-size: 0.9rem;
}

.match-item .match-date {
    color: #666;
    font-size: 0.85rem;
    margin-left: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1a1a;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
    border: 1px solid #2a2a2a;
    max-height: 90vh;
    overflow-y: auto;
}

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

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close:hover {
    color: #fff;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #aaa;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #e94560;
}

.form-group input::placeholder {
    color: #555;
}

/* Profile */
.profile-container {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #2a2a2a;
}

.profile-container h1 {
    color: #e94560;
    margin-bottom: 1rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.stat-card {
    background: #111111;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    border: 1px solid #2a2a2a;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: #e94560;
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #e94560;
    margin-bottom: 1rem;
}

.rank-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.rank-display img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.rank-display .rank-text {
    font-size: 1rem;
    color: #aaa;
    min-height: 1.5rem;
}

.stat-card .rating {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Leaderboards */
.leaderboards-container {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid #2a2a2a;
}

.leaderboards-container h1 {
    color: #e94560;
    margin-bottom: 1rem;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.8rem 2rem;
    background: #111111;
    border: 2px solid #2a2a2a;
    color: #b0b0b0;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.tab-btn:hover {
    border-color: #e94560;
    color: #fff;
}

.tab-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
}

.leaderboard-list {
    background: #111111;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid #2a2a2a;
    transition: all 0.3s;
    gap: 1rem;
}

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

.leaderboard-item:hover {
    background: #1a1a1a;
}

.leaderboard-item .position {
    font-weight: bold;
    color: #e94560;
    min-width: 50px;
    font-size: 1.1rem;
}

.leaderboard-item .rank-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.leaderboard-item .player-info {
    flex: 1;
    min-width: 100px;
}

.leaderboard-item .player-name {
    font-weight: bold;
    font-size: 1rem;
}

.leaderboard-item .player-rank {
    color: #888;
    font-size: 0.85rem;
}

.leaderboard-item .player-rating {
    font-weight: bold;
    color: #ffd700;
    min-width: 60px;
    text-align: right;
}

/* Nickname Modal */
.nickname-modal .modal-content {
    max-width: 400px;
}

/* Matches List */
.matches-list {
    margin: 2rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    nav {
        width: 100%;
        min-height: auto;
        height: auto;
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #2a2a2a;
        padding: 0.5rem 0;
    }
    
    .nav-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.4rem;
        border-bottom: none;
        padding-bottom: 0;
        width: auto;
        padding: 0;
    }
    
    .nav-links {
        flex-direction: row;
        width: auto;
        gap: 0.3rem;
    }
    
    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .user-block {
        flex-direction: row;
        border-top: none;
        padding: 0;
        width: auto;
        margin-top: 0;
    }
    
    .user-block .user-name {
        font-size: 0.8rem;
    }
    
    #logoutBtn {
        width: auto;
        padding: 0.2rem 0.8rem;
        font-size: 0.8rem;
    }
    
    main {
        max-width: 100%;
        margin: 1rem auto;
        padding: 0 1rem;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
    }
    
    .leaderboard-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .match-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .match-item .match-info {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .match-item .match-date {
        margin-left: 0;
        width: 100%;
        text-align: left;
    }
    
    .leaderboard-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .leaderboard-item .rank-icon {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }
    
    .logo {
        text-align: center;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .user-block {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

/* Nickname display */
.nickname-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #111111;
    border-radius: 10px;
    border: 1px solid #2a2a2a;
    flex-wrap: wrap;
}

.nickname-display .nickname-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e0e0e0;
}

.nickname-display .edit-nickname-btn {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #888;
    padding: 0.3rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.nickname-display .edit-nickname-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

/* Fix for rank images not loading */
.rank-display img[src=""] {
    display: none;
}

.leaderboard-item .rank-icon[src=""] {
    display: none;
}
