/* ===========================================
   GAME HUB - SHARED STYLES
   =========================================== */

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

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #8b6f47;
    --secondary-dark: #6d5535;
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--dark);
}

/* ===========================================
   PORTAL LAYOUT
   =========================================== */

.portal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
}

.logo h1 {
    font-size: 1.8em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Auth Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: bold;
    color: var(--dark);
}

.auth-warning {
    color: var(--warning);
    font-size: 0.9em;
}

/* User Stats */
.user-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.user-stats.hidden {
    display: none;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

/* ===========================================
   GAMES SECTION
   =========================================== */

.games-section {
    margin-bottom: 40px;
}

.games-section h2 {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Game Card */
.game-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.game-card.coming-soon {
    opacity: 0.7;
    cursor: default;
}

.game-card.coming-soon:hover {
    transform: none;
}

.game-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.game-icon svg {
    width: 100%;
    height: 100%;
}

.game-info {
    text-align: center;
}

.game-info h3 {
    font-size: 1.4em;
    margin-bottom: 8px;
    color: var(--dark);
}

.game-info p {
    color: #666;
    font-size: 0.95em;
}

.game-meta {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.difficulty-badge,
.players-badge,
.coming-soon-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
}

.difficulty-badge {
    background: linear-gradient(135deg, var(--success), #27ae60);
    color: white;
}

.players-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.coming-soon-badge {
    background: #95a5a6;
    color: white;
}

.game-highscore {
    text-align: center;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

.highscore-label {
    display: block;
    font-size: 0.8em;
    color: #999;
}

.highscore-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--warning);
}

/* ===========================================
   LEADERBOARD SECTION
   =========================================== */

.leaderboard-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.leaderboard-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--dark);
}

.leaderboard-container {
    max-width: 600px;
    margin: 0 auto;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 25px;
    border: 2px solid var(--primary);
    border-radius: 25px;
    background: white;
    color: var(--primary);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--primary);
    color: white;
}

.leaderboard-content {
    min-height: 200px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    gap: 15px;
}

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

.leaderboard-entry .rank {
    font-weight: bold;
    width: 40px;
    color: #999;
}

.leaderboard-entry .rank.gold { color: #f1c40f; }
.leaderboard-entry .rank.silver { color: #95a5a6; }
.leaderboard-entry .rank.bronze { color: #cd6133; }

.leaderboard-entry .player-name {
    flex: 1;
    font-weight: 500;
}

.leaderboard-entry .player-score {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1em;
}

.leaderboard-entry .player-mode {
    font-size: 0.85em;
    color: #999;
    padding: 3px 10px;
    background: #f0f0f0;
    border-radius: 10px;
}

.leaderboard-loading,
.leaderboard-empty,
.leaderboard-error {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ===========================================
   BUTTONS
   =========================================== */

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--dark);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-full {
    width: 100%;
}

/* ===========================================
   MODALS
   =========================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

/* Auth Modal */
.auth-modal {
    padding-top: 50px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
}

.auth-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    font-size: 1em;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--dark);
}

.form-group input {
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-error {
    padding: 10px 15px;
    background: #fdeaea;
    color: var(--danger);
    border-radius: 10px;
    font-size: 0.9em;
}

.auth-error.hidden {
    display: none;
}

/* ===========================================
   FOOTER
   =========================================== */

.portal-footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
}

/* ===========================================
   UTILITIES
   =========================================== */

.hidden {
    display: none !important;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 768px) {
    .portal-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .user-stats {
        flex-direction: column;
        align-items: center;
    }

    .stat-card {
        width: 100%;
        max-width: 300px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }
}
