@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background: #121212;
    color: white;
    overflow-x: hidden;
    position: relative;
    height: 100%;
}

/* Animated Background */
.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
}

.bg-element {
    position: absolute;
    background: linear-gradient(45deg, #FF5252, #FF7043);
    border-radius: 50%;
    opacity: 0.05;
    filter: blur(8px);
    animation: float-around 25s infinite linear;
}

@keyframes float-around {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30vw, 20vh) scale(1.1); }
    66% { transform: translate(-20vw, 40vh) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Fade in/out animations for category popups */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

/* Main Layout */
.main-container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    height: 100vh;
    overflow: hidden;
    max-width: 1800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Home button */
.home-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(45deg, #FF5252, #FF8A80);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 15px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 15px auto;
    width: 80%;
    box-shadow: 0 4px 10px rgba(255, 82, 82, 0.3);
}

.home-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(255, 82, 82, 0.4);
}

/* Category Sidebar */
.category-sidebar {
    background: #1E1E1E;
    height: 100vh;
    padding: 20px 15px;
    border-right: 1px solid #333;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.category-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 82, 82, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-item:hover::before {
    left: 100%;
}

.category-item:hover {
    background: rgba(255, 82, 82, 0.1);
    transform: translateX(5px);
}

.category-item.active {
    background: linear-gradient(90deg, rgba(255, 82, 82, 0.2), rgba(255, 82, 82, 0.05));
    border-left: 3px solid #FF5252;
}

.category-icon {
    font-size: 20px;
    width: 30px;
    color: #FF5252;
    transition: transform 0.3s ease;
}

.category-item:hover .category-icon {
    transform: scale(1.2);
}

.category-name {
    font-weight: 500;
}

.game-count {
    margin-left: auto;
    background: #FF5252;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.category-item:hover .game-count {
    background: #FF7043;
    transform: scale(1.1);
}

/* Main Content Area */
.content-area {
    padding: 20px;
    overflow-y: auto;
    height: 100vh;
}

/* Game Frame */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #333;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #FF5252;
    transform: translateY(-3px) rotate(5deg);
}

.game-frame-wrapper {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #000;
    aspect-ratio: 16/9;
    height: 70vh;
    max-height: 70vh;
}

.game-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 5;
}

.splash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #232526, #414345);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.5s ease;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-logo {
    width: 180px;
    height: 180px;
    border-radius: 30px;
    background: #FF5252;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 90px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(255, 82, 82, 0.4);
    overflow: hidden;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.game-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 30px;
}

.splash-title {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(90deg, #FF5252, #FFEB3B);
    -webkit-background-clip: text;
    color: transparent;
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 5px rgba(255, 82, 82, 0.5)); }
    to { filter: drop-shadow(0 0 20px rgba(255, 235, 59, 0.8)); }
}

.splash-desc {
    max-width: 500px;
    margin-bottom: 10px;
    color: #ccc;
}

.play-btn {
    padding: 15px 50px;
    background: linear-gradient(90deg, #FF5252, #FF7043);
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 15px rgba(255, 82, 82, 0.3);
}

.play-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 25px rgba(255, 82, 82, 0.4);
}

.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Right Sidebar */
.right-sidebar {
    width: 300px;
    padding: 20px;
    background: #1E1E1E;
    border-left: 1px solid #333;
    height: 100vh;
    overflow-y: auto;
}

/* Featured Game Section */
.featured-game {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.featured-game:hover {
    transform: translateY(-5px);
}

.featured-thumb {
    width: 100%;
    height: 150px;
    background: #333;
    position: relative;
    overflow: hidden;
}

.featured-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.featured-game:hover .featured-thumb img {
    transform: scale(1.1);
}

.featured-info {
    padding: 20px;
    text-align: center;
}

.featured-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
}

.featured-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
}

.featured-play-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #FF5252, #FF7043);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.featured-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(255, 82, 82, 0.4);
}

/* Category Popup */
.category-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.popup-content {
    background: #1E1E1E;
    border-radius: 15px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.popup-title {
    font-size: 24px;
    font-weight: 700;
    color: #FF5252;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #333;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #FF5252;
    transform: rotate(90deg);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    max-width: 1200px;
}

.game-card {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    animation: slideInUp 0.6s ease forwards;
}

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.game-card-thumb {
    width: 100%;
    height: 120px;
    background: #333;
    position: relative;
    overflow: hidden;
}

.game-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.game-card:hover .game-card-thumb img {
    transform: scale(1.1);
}

.game-card-info {
    padding: 15px;
    text-align: center;
}

.game-card-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.game-card-play {
    padding: 8px 16px;
    background: linear-gradient(90deg, #FF5252, #FF7043);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-card-play:hover {
    transform: translateY(-2px) scale(1.05);
}

/* Promo Game Section */
.promo-game-section {
    margin-bottom: 25px;
}

.promo-game-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.promo-game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.4);
}

.promo-thumb {
    width: 100%;
    height: 140px;
    background: #333;
    position: relative;
    overflow: hidden;
}

.promo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.promo-game-card:hover .promo-thumb img {
    transform: scale(1.1);
}

.promo-info {
    padding: 15px;
    text-align: center;
}

.promo-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.promo-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 12px;
}

.promo-btn {
    background: linear-gradient(90deg, #FF5252, #FF7043);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.hot-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #FF5252;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

/* Review System */
.review-system {
    background: #2a2a2a;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.star-rating {
    text-align: center;
    margin-bottom: 15px;
}

.stars {
    font-size: 24px;
    margin-bottom: 15px;
}

.star {
    color: #FFD700;
    cursor: pointer;
    margin: 0 2px;
    transition: all 0.2s ease;
}

.star:hover {
    transform: scale(1.2) rotate(15deg);
}

.rate-now-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #FF5252, #FF7043);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rate-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(255,82,82,0.4);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .games-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1280px) {
    .main-container {
        grid-template-columns: 70px 1fr 250px;
    }
    
    .category-sidebar {
        width: 70px;
    }
    
    .category-name, .game-count {
        display: none;
    }
    
    .sidebar-title {
        text-align: center;
        font-size: 14px;
    }
    
    .category-item {
        justify-content: center;
        padding: 12px 5px;
    }
    
    .home-button {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
    }
    
    .home-button span {
        display: none;
    }
    
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 70px 1fr 220px;
    }
    
    .right-sidebar {
        width: 220px;
        padding: 15px 10px;
    }
    
    .game-frame-wrapper {
        max-height: 55vh;
    }
}

@media (max-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 60px 1fr;
    }
    
    .right-sidebar {
        display: none;
    }
    
    .popup-content {
        max-width: 95%;
        padding: 20px;
    }
    
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}