/* 
 * Game Portal CSS Styles
 * Responsive design for both desktop and mobile
 */

/* General Styles & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

a {
    text-decoration: none;
    color: #007bff;
    transition: color 0.3s ease;
}

a:hover {
    color: #0056b3;
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.btn:hover {
    background-color: #0056b3;
    color: #fff;
}

.section-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background-color: #007bff;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    width: 100%;
}

.loading-spinner i {
    font-size: 40px;
    color: #007bff;
    margin-bottom: 10px;
}

/* Header Styles */
header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo h1 {
    font-size: 24px;
    color: #007bff;
}

.main-menu {
    display: flex;
}

.main-menu li {
    margin-right: 20px;
}

.main-menu li:last-child {
    margin-right: 0;
}

.main-menu a {
    color: #333;
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.main-menu a.active, 
.main-menu a:hover {
    color: #007bff;
}

.main-menu a.active::after,
.main-menu a:hover::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #007bff;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1;
    border-radius: 5px;
    padding-top: 10px;
    margin-top: 0;
    
    transform-origin: top center;
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    display: block !important;
    transition: all 0.3s ease;
}

/* 创建一个不可见的填充区域，使之更容易移动到下拉菜单 */
.dropdown:before {
    content: "";
    position: absolute;
    width: 100%;
    height: 20px;
    bottom: -10px;
    left: 0;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    display: block;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

/* 鼠标悬停或者active类都显示下拉菜单 */
.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    width: 200px;
}

.search-box button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #0072ff 0%, #00c6ff 100%);
    color: #fff;
    padding: 80px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 20px;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero .btn {
    background-color: #fff;
    color: #007bff;
    font-size: 18px;
    padding: 12px 30px;
}

.hero .btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Game Cards Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.game-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.game-card a {
    color: #333;
}

.game-thumbnail {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.game-card:hover .game-thumbnail img {
    transform: scale(1.05);
}

.game-info {
    padding: 15px;
}

.game-title {
    font-size: 18px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    color: #777;
    font-size: 14px;
}

.game-category {
    background-color: #e9f5ff;
    color: #007bff;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.play-overlay i {
    font-size: 48px;
    color: #fff;
    background-color: rgba(0, 123, 255, 0.8);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.game-card:hover .play-overlay {
    opacity: 1;
}

/* Categories Section */
.categories {
    padding: 60px 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    text-align: center;
    padding: 25px 15px;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-card a {
    color: #333;
}

.category-icon {
    font-size: 36px;
    color: #007bff;
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 18px;
}

/* Featured, Newest, Popular Sections */
.featured, .newest, .popular {
    padding: 60px 0;
}

.view-more {
    text-align: center;
    margin-top: 30px;
}

/* Game Page Styles */
.game-page {
    padding: 40px 0;
}

.game-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 40px;
}

.game-details {
    margin-bottom: 20px;
}

.game-details h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.game-details .game-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.game-iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    margin-bottom: 20px;
}

.game-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.fullscreen-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.fullscreen-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.game-description, .game-controls {
    margin-bottom: 20px;
}

.game-description h3, .game-controls h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.related-games h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* Category Page Styles */
.category-header, .popular-header, .new-header, .about-header {
    background: linear-gradient(135deg, #0072ff 0%, #00c6ff 100%);
    color: #fff;
    padding: 40px 0;
    text-align: center;
}

.category-header h1, .popular-header h1, .new-header h1, .about-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.category-filter, .popular-filter, .new-filter {
    background-color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.filter-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-options label {
    font-weight: 500;
}

.filter-options select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.category-games, .popular-games, .new-games {
    padding: 0 0 60px 0;
}

.pagination {
    margin-top: 40px;
    text-align: center;
}

/* About Page Styles */
.about-content {
    padding: 60px 0;
}

.about-section {
    background-color: #ffffff;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.about-section h1 {
    color: #2c3e50;
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
}

.about-section section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.about-section section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.about-section h2 {
    color: #3498db;
    font-size: 1.5em;
    margin-bottom: 15px;
}

.about-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.about-section ul {
    list-style: none;
    padding-left: 20px;
    margin-bottom: 15px;
}

.about-section ul li {
    color: #666;
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.about-section ul li:before {
    content: "•";
    color: #3498db;
    position: absolute;
    left: 0;
}

.welcome-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
}

.why-choose ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 0;
}

.why-choose ul li {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 0;
}

.why-choose ul li:before {
    display: none;
}

@media (max-width: 768px) {
    .about-section {
        padding: 20px;
    }

    .about-section h1 {
        font-size: 1.75em;
    }

    .about-section h2 {
        font-size: 1.25em;
    }

    .why-choose ul {
        grid-template-columns: 1fr;
    }
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.feature-card {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 40px;
    color: #007bff;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

/* Footer Styles */
footer {
    background-color: #2c3e50;
    color: #fff;
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 20px;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background-color: #007bff;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #ccc;
}

.footer-section a:hover {
    color: #fff;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-icons a {
    display: inline-block;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.social-icons a:hover {
    background-color: #007bff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #ccc;
}

/* Responsive Styles */
@media screen and (max-width: 992px) {
    .hero-content h2 {
        font-size: 36px;
    }
    
    .hero-content p {
        font-size: 18px;
    }
    
    .search-box input {
        width: 160px;
    }
}

@media screen and (max-width: 768px) {
    header .container {
        flex-wrap: wrap;
    }
    
    .main-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 20px;
    }
    
    .main-menu.active {
        display: flex;
    }
    
    .main-menu li {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .search-box {
        margin-left: auto;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero-content h2 {
        font-size: 32px;
    }
    
    .hero-content p {
        font-size: 16px;
    }
    
    .dropdown-content {
        position: static;
        box-shadow: none;
        transform: none;
        opacity: 1;
        display: none !important;
        visibility: visible;
        transition: none;
        padding-left: 20px;
        margin-top: 5px;
        padding-top: 0;
    }
    
    .dropdown:hover .dropdown-content {
        display: none !important;
    }
    
    .dropdown.active .dropdown-content {
        display: block !important;
    }
    
    .dropdown-content a {
        padding: 8px 0;
    }
    
    .dropdown:before {
        display: none;
    }
    
    .filter-options {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-options select {
        width: 100%;
    }
}

@media screen and (max-width: 576px) {
    header .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-box {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .hero-content h2 {
        font-size: 28px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .logo, .mobile-menu-toggle {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .about-section h2, .section-title {
        font-size: 24px;
    }
}

/* 错误消息样式 */
.loading-error {
    text-align: center;
    padding: 30px;
    background-color: #fff8f8;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #ffcccc;
}

.loading-error p {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 16px;
}

.loading-error .btn {
    background-color: #e74c3c;
    color: white;
    border: none;
}

.loading-error .btn:hover {
    background-color: #c0392b;
}

.game-controls {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
}

.game-controls h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.game-controls ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.game-controls li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-size: 0.95em;
    line-height: 1.4;
}

.game-controls li:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .game-controls {
        padding: 12px 15px;
    }
    
    .game-controls li {
        font-size: 0.9em;
    }
} 