/* Base Styles and Variables */
:root {
    /* Warm color scheme */
    --primary-color: #ff6b35;
    --primary-dark: #e55a2b;
    --primary-light: #ff8555;
    --secondary-color: #f7931e;
    --accent-color: #ff9f1c;

    /* Warm neutrals */
    --bg-primary: #fff8f3;
    --bg-secondary: #fef3e8;
    --bg-card: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-light: #95a5a6;

    /* Border and shadows */
    --border-color: #ffe0cc;
    --shadow-sm: 0 2px 4px rgba(255, 107, 53, 0.1);
    --shadow-md: 0 4px 12px rgba(255, 107, 53, 0.15);
    --shadow-lg: 0 8px 24px rgba(255, 107, 53, 0.2);

    /* Layout */
    --max-width: 1200px;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

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

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header and Navigation */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.search-container {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-form {
    display: flex;
    background: rgba(255,255,255,0.2);
    border-radius: 25px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.8);
}

.search-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: rgba(255,255,255,0.3);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--accent-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Sidebar Category Menu */
.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: fit-content;
    position: sticky;
    top: 100px;
    display: block;
    visibility: visible;
    opacity: 1;
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.category-link:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    transform: translateX(5px);
}

.category-link.active {
    background: var(--primary-color);
    color: white;
}

/* Main Content Layout */
.main-layout {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.main-content {
    flex: 1;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.game-card:hover {
    text-decoration: none;
}

.game-card,
.game-card *,
.game-card:hover,
.game-card:hover * {
    text-decoration: none !important;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.game-image-container {
    position: relative;
    padding-bottom: 75%;
    overflow: hidden;
    background: var(--bg-secondary);
}

.game-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.game-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
}

.badge {
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-hot {
    background: #e74c3c;
    color: white;
}

.badge-new {
    background: #27ae60;
    color: white;
}

.game-info {
    padding: 1rem;
}

.game-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    text-decoration: none;
}

.game-category {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.game-rating {
    color: var(--accent-color);
}

/* Game Detail Page */
.game-detail {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.game-header {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.game-cover {
    width: 200px;
    height: 200px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    flex-shrink: 0;
}

.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-info-detail {
    flex: 1;
}

.game-title-detail {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.game-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.play-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    margin-top: 1rem;
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.game-description {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

.game-description h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Search Results */
.search-results {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-title {
    color: var(--text-primary);
    font-size: 1.3rem;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-btn {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.pagination-btn:hover:not(.active):not(.disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ranking Page */
.ranking-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

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

.ranking-list {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.ranking-item:hover {
    background: var(--bg-secondary);
}

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

.ranking-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    width: 50px;
    text-align: center;
}

.ranking-game-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin: 0 1rem;
}

.ranking-game-info {
    flex: 1;
}

.ranking-game-title {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.ranking-game-category {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ranking-stats {
    display: flex;
    gap: 2rem;
    align-items: center;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

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

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .search-container {
        display: none;
    }

    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        display: none !important;
    }

    .search-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .search-input {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }

    /* Search page specific styles */
    .search-results form button[type="submit"] {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
    }

    .search-results form input[type="text"] {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }

    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .game-cover {
        margin: 0 auto;
    }

    .game-title-detail {
        font-size: 1.5rem;
    }

    .search-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .ranking-filters {
        flex-direction: column;
    }

    .ranking-item {
        padding: 1rem;
    }

    .ranking-game-image {
        display: none;
    }

    .ranking-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .sidebar {
        display: none !important;
    }

    /* Header search button for very small screens */
    .search-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    .search-input {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    /* Search page main search button for very small screens */
    .search-results form button[type="submit"] {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.8rem !important;
    }

    .search-results form input[type="text"] {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .game-title {
        font-size: 0.85rem;
    }

    .game-category {
        font-size: 0.75rem;
    }

    .game-stats {
        font-size: 0.7rem;
    }

    .game-header {
        padding: 1rem;
    }

    .game-cover {
        width: 150px;
        height: 150px;
    }

    .game-title-detail {
        font-size: 1.3rem;
    }

    .play-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .pagination {
        gap: 0.5rem;
    }

    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden {
    display: none;
}

.show {
    display: block;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.error-message {
    background: #fee;
    color: #c33;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #fcc;
    margin: 1rem 0;
}

.success-message {
    background: #efe;
    color: #3c3;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #cfc;
    margin: 1rem 0;
}

/* Mobile Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.bottom-nav-list {
    display: flex;
    justify-content: space-around;
    list-style: none;
}

.bottom-nav-item {
    flex: 1;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.8rem;
}

.bottom-nav-link:hover,
.bottom-nav-link.active {
    color: white;
}

.bottom-nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }

    .main-content {
        padding-bottom: 80px;
    }
}