/* === Variables & Base Styles === */
:root {
    --primary: #4a6ee0;
    --primary-hover: #365ac1;
    --secondary: #ff3b3b;
    --bg-color: #f0f2f5;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --border-color: #e4e6eb;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: 0.2s ease-in-out;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-y: scroll;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd0d5;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0a5aa;
}

/* === Navbar === */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 26px;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 230px; /* Aligns with sidebar */
}
.logo i { color: var(--secondary); }

/* Search Wrapper w/ Suggestions */
.search-wrapper {
    flex: 1;
    max-width: 650px;
    margin: 0 20px;
    position: relative;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 20px;
    padding: 0 15px;
    border: 2px solid transparent;
    transition: var(--transition);
}

.search-bar.focused {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 5px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

.search-bar button {
    background: transparent;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
}

.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 2px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    padding: 10px 0;
    box-shadow: var(--shadow-lg);
    z-index: 101;
}

.sugg-title {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.search-suggestions a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-weight: 600;
    transition: background 0.2s;
}
.search-suggestions a:hover {
    background: var(--bg-color);
    color: var(--primary);
}
.search-suggestions a i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
    font-weight: 700;
}

.nav-links a {
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
    position: relative;
}
.nav-links a:hover { color: var(--primary); }

.badge-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
}

.btn-login {
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 20px;
}
.btn-login:hover {
    background: #e4e6eb;
}

/* === Layout === */
.layout-wrapper {
    display: flex;
    max-width: 1700px;
    margin: 0 auto;
}

/* === Sidebar === */
.sidebar {
    width: 250px;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px 15px;
    flex-shrink: 0;
}

.menu-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 10px;
    text-transform: uppercase;
    font-weight: 800;
}
.mt-4 { margin-top: 25px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: var(--radius-md);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    transition: var(--transition);
}
.menu-item i {
    width: 24px;
    text-align: center;
    font-size: 18px;
    color: var(--text-muted);
}
.menu-item:hover {
    background: var(--bg-color);
}
.menu-item.active {
    background: rgba(74, 110, 224, 0.1);
    color: var(--primary);
}
.menu-item.active i { color: var(--primary); }

/* Sidebar Grid Categories */
.grid-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 5px;
}
.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-color);
    padding: 12px 5px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    transition: var(--transition);
}
.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* === Main Content === */
.main-content {
    flex: 1;
    padding: 20px 30px;
    min-width: 0; /* Prevents flexbox horizontal overflow */
    padding-bottom: 100px;
}

/* Quick Tags */
.quick-tags {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 15px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.quick-tags::-webkit-scrollbar { display: none; }

.tag {
    white-space: nowrap;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* === Game Sections === */
.game-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-all {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(74, 110, 224, 0.1);
    padding: 6px 14px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.view-all:hover {
    background: var(--primary);
    color: white;
}

/* Base Grid system */
.game-grid {
    display: grid;
    gap: 15px;
}

/* Hero Grid Pattern */
.hero-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 160px;
}
.hero-card { grid-column: span 4; grid-row: span 2; }
.block-card { grid-column: span 2; grid-row: span 1; }
.vertical-card { grid-column: span 2; grid-row: span 2; }
.square-card { grid-column: span 2; grid-row: span 2; }

/* Dense Grid for massive lists */
.dense-grid {
    /* 150px min width for tiny packed squares */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.dense-grid .small-square {
    height: 160px; /* Force small square shape */
}

/* Duel Grid */
.duel-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.duel-grid .wide-card {
    height: 180px;
}


/* === Game Card Styling === */
.game-card {
    position: relative;
    border-radius: var(--radius-lg);
    background-size: cover;
    background-position: center;
    background-color: #ddd;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.game-card:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

/* Cards With Outside Text (Dense Grid Style) */
.small-square {
    border-radius: var(--radius-md);
}
.title-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    z-index: 5;
    transform: translateY(100%);
    transition: transform 0.2s;
}
.small-square:hover .title-bar {
    transform: translateY(0);
}


/* Interior Overlay content */
.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: background 0.3s;
}

.small-square .overlay {
    background: rgba(0,0,0,0);
}
.small-square:hover .overlay {
    background: rgba(0,0,0,0.2);
}

.game-info {
    position: relative;
    z-index: 2;
}

.game-info h2 {
    color: white;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}
.hero-card .game-info h2 { font-size: 32px; }

.game-info h3 {
    color: white;
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.badge.new { background: #00e676; color: #000; }
.badge.hot { background: #ff3d00; }


/* Play Button */
.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(255,255,255,0.9);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--primary);
    opacity: 0;
    transition: var(--transition);
}
.hero-card .play-btn { width: 80px; height: 80px; font-size: 30px; }
.play-btn-small {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: var(--primary);
    width: 40px; height: 40px; border-radius: 50%;
    color: white; font-size: 16px; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: var(--transition);
}

.game-card:hover .play-btn, .game-card:hover .play-btn-small {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* === Footer === */
footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
}
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}
.footer-main-info h3 {
    color: var(--text-main);
    font-size: 22px;
    margin-bottom: 15px;
    display: flex; align-items: center; gap: 8px;
}
.footer-main-info h3 i { color: var(--primary); }
.footer-main-info p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.footer-links-group {
    display: flex;
    justify-content: flex-end;
    gap: 60px;
}
.link-col h4 {
    color: var(--text-main);
    margin-bottom: 15px;
}
.link-col a {
    display: block;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}
.link-col a:hover { color: var(--primary); }

.footer-bottom {
    background: #f4f5f8;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .hero-grid { grid-template-columns: repeat(4, 1fr); }
    .hero-card { grid-column: span 4; }
    .footer-links-group { gap: 30px; }
}

@media (max-width: 900px) {
    .sidebar { display: none; } /* Hide sidebar on mobile */
    .nav-container { padding: 10px; }
    .logo { width: auto; font-size: 20px; }
    .search-wrapper { margin: 0 10px; }
    .footer-content { grid-template-columns: 1fr; }
    .footer-links-group { justify-content: flex-start; }
}

@media (max-width: 600px) {
    .nav-links { display: none; }
    .main-content { padding: 15px; }
    .hero-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 120px; }
    .hero-card { grid-column: span 2; }
    .block-card, .vertical-card, .square-card { grid-column: span 1; grid-row: span 1; }
    .dense-grid { grid-template-columns: repeat(3, 1fr); }
    .small-square { height: 100px; }
}
