/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a25;
    --accent-primary: #00f5d4;
    --accent-secondary: #9b5de5;
    --accent-warning: #f72585;
    --accent-gold: #fee440;
    --text-primary: #ffffff;
    --text-secondary: #8b8b9a;
    --border-color: #2a2a3a;
    --shadow-glow: 0 0 30px rgba(0, 245, 212, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(ellipse at top, rgba(155, 93, 229, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(0, 245, 212, 0.08) 0%, transparent 50%);
}

/* Header */
.header {
    background: linear-gradient(180deg, rgba(18, 18, 26, 0.95) 0%, rgba(10, 10, 15, 0.9) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 70px;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    min-width: 600px;
}

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

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--accent-primary));
}

.logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation Menu */
.nav-menu {
    display: flex !important;
    align-items: center;
    gap: 8px;
    z-index: 101;
    position: relative;
}

.nav-menu a,
.nav-menu .nav-link {
    display: inline-block;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.nav-menu a:hover,
.nav-menu .nav-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.1);
}

.nav-menu a.active,
.nav-menu .nav-link.active {
    color: var(--accent-primary) !important;
    background: rgba(0, 245, 212, 0.1);
}

.nav-menu a.admin-only,
.nav-menu .nav-link.admin-only {
    color: var(--accent-secondary) !important;
}

.nav-menu a.admin-only:hover,
.nav-menu .nav-link.admin-only:hover {
    color: var(--accent-secondary) !important;
    background: rgba(155, 93, 229, 0.15);
}

/* Header Right (User + Search) */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 16px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.user-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.user-icon {
    font-size: 18px;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.user-menu.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 200;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.logout-item {
    color: #ff4757;
}

.logout-item:hover {
    background: rgba(255, 71, 87, 0.1);
}

.search-container {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

/* Main Content */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filter Container */
.filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 13px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-label input:checked + .toggle-slider {
    background: rgba(0, 245, 212, 0.2);
    border-color: var(--accent-primary);
}

.toggle-label input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--accent-primary);
}

.toggle-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.toggle-label input:checked ~ .toggle-text {
    color: var(--accent-primary);
}

.filter-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-color: transparent;
    color: var(--bg-dark);
    font-weight: 600;
}

/* Popular Games Section */
.popular-section {
    margin-bottom: 40px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-icon {
    font-size: 28px;
}

/* Gallery Section Title */
.gallery-title {
    margin-top: 30px;
    margin-bottom: 25px;
    font-size: 20px;
    border-bottom: 2px solid var(--border-color);
}

.gallery-title .section-icon {
    font-size: 24px;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Popular Game Card */
.popular-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.popular-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-gold);
    box-shadow: 0 0 30px rgba(254, 228, 64, 0.2);
}

/* Rank Badge */
.rank-badge {    
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-gold), #f9a825);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 14px;
    color: var(--bg-dark);
    z-index: 3;
    box-shadow: 0 2px 8px rgba(254, 228, 64, 0.4);
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffb300);
    width: 36px;
    height: 36px;
    font-size: 16px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #9e9e9e);
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
}

.popular-card .game-thumbnail {
    height: 140px;
}

.popular-card .game-info {
    padding: 15px;
}

.popular-card .game-title {
    font-size: 15px;
    margin-bottom: 8px;
}

.popular-card .game-meta {
    gap: 8px;
}

.popular-card .game-category-tag {
    padding: 3px 10px;
    font-size: 11px;
}

.popular-card .game-difficulty-badge {
    padding: 3px 8px;
    font-size: 11px;
}

/* Popular Rating Display */
.popular-rating {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(4px);
    z-index: 2;
}

.popular-rating.positive { color: var(--accent-primary); }
.popular-rating.negative { color: var(--accent-warning); }
.popular-rating.neutral { color: var(--text-secondary); }

/* Empty Popular Section */
.popular-section.hidden {
    display: none;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Game Card */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-card:hover::before {
    opacity: 1;
}

.game-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #1a1a25 0%, #0a0a0f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

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

.game-card:hover .game-thumbnail img {
    transform: scale(1.05);
}

.game-icon {
    font-size: 64px;
    filter: drop-shadow(0 0 20px rgba(0, 245, 212, 0.5));
}

.game-info {
    padding: 20px;
}

.game-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

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

.game-category-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-category-tag.action { background: rgba(247, 37, 133, 0.2); color: #f72585; }
.game-category-tag.puzzle { background: rgba(155, 93, 229, 0.2); color: #9b5de5; }
.game-category-tag.classic { background: rgba(0, 245, 212, 0.2); color: #00f5d4; }
.game-category-tag.arcade { background: rgba(254, 228, 64, 0.2); color: #fee440; }
.game-category-tag.strategy { background: rgba(255, 107, 107, 0.2); color: #ff6b6b; }

.game-difficulty-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.game-difficulty-badge.easy { background: rgba(0, 245, 212, 0.15); color: #00f5d4; }
.game-difficulty-badge.medium { background: rgba(254, 228, 64, 0.15); color: #fee440; }
.game-difficulty-badge.hard { background: rgba(247, 37, 133, 0.15); color: #f72585; }

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-layout {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    gap: 15px;
    animation: slideUp 0.3s ease;
}

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

.modal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 120px;
}

.modal-sidebar-left {
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 20px;
}

.modal-sidebar-right {
    justify-content: flex-start;
    align-items: flex-end;
    padding-top: 20px;
}

.modal-sidebar h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--accent-primary);
    margin: 0 0 15px 0;
    white-space: nowrap;
}

.close-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--accent-warning);
    border-color: var(--accent-warning);
    color: white;
}

.modal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 400px;
}

#gameFrame {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 12px;
    background: #000;
    border: 1px solid var(--border-color);
}

.game-category, .game-difficulty {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.game-category {
    background: rgba(0, 245, 212, 0.15);
    color: var(--accent-primary);
}

.game-difficulty {
    background: rgba(155, 93, 229, 0.15);
    color: var(--accent-secondary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 1024px) {
    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .search-container {
        width: 100%;
    }

    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar {
        justify-content: center;
    }

    .mobile-filter-toggle {
        justify-content: center;
    }

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

    .modal-content {
        height: 95vh;
    }

    .section-title {
        font-size: 18px;
    }

    .gallery-title {
        font-size: 16px;
        margin-top: 20px;
    }
}

@media (max-width: 600px) {
    .popular-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 16px;
    }

    .section-icon {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-thumbnail {
        height: 160px;
    }

    .filter-bar {
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Loading Animation */
.game-card.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
/* Visitor Counter */
.visitor-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: #64748b;
}

.visitor-counter .counter-icon {
    font-size: 16px;
}

.visitor-counter .counter-value {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: #00d4ff;
    font-size: 16px;
    min-width: 60px;
}

/* Rating System */
.rating-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
}

.rating-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 14px;
}

.rating-btn .rating-icon {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.rating-btn:hover:not(.rated-up):not(.rated-down) {
    transform: scale(1.1);
}

.rating-btn:hover:not(.rated-up):not(.rated-down) .rating-icon {
    transform: scale(1.2);
}

/* Thumbs Up Button */
.rating-up:hover:not(.rated-up) {
    border-color: var(--accent-primary);
    background: rgba(0, 245, 212, 0.1);
}

.rating-up.rated-up {
    border-color: var(--accent-primary);
    background: rgba(0, 245, 212, 0.2);
    color: var(--accent-primary);
}

.rating-up.rated-up .rating-icon {
    animation: popIn 0.4s ease;
}

/* Thumbs Down Button */
.rating-down:hover:not(.rated-down) {
    border-color: var(--accent-warning);
    background: rgba(247, 37, 133, 0.1);
}

.rating-down.rated-down {
    border-color: var(--accent-warning);
    background: rgba(247, 37, 133, 0.2);
    color: var(--accent-warning);
}

.rating-down.rated-down .rating-icon {
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.rating-count {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 14px;
    min-width: 30px;
    text-align: center;
}

.rating-count.positive { color: var(--accent-primary); }
.rating-count.negative { color: var(--accent-warning); }
.rating-count.neutral { color: var(--text-secondary); }

.rating-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Game Card Rating Badge */
.game-rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-primary);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.game-rating-badge.positive { color: var(--accent-primary); }
.game-rating-badge.negative { color: var(--accent-warning); }

.game-rating-badge .rating-icon-small {
    font-size: 12px;
}
