/* ============================================================
   global.css — Shared styles for all pages
   Multi-Game Portal Website
   ============================================================ */

/* ------------------------------------------------------------
   CSS Variables
   ------------------------------------------------------------ */
:root {
    --primary-color: #ff6b00;
    --accent-red: #ff6b6b;
    --accent-orange: #ffa500;
    --accent-purple: #667eea;
    --accent-green: #4adf86;
    --bg-dark: #1e1f22;
    --bg-secondary: #2f3136;
    --text-light: #f5f5f5;
    --text-dark: #333;
    --text-muted: #666;
    --border-radius: 8px;
    --transition: 0.3s ease;
}

/* ------------------------------------------------------------
   CSS Reset
   ------------------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Verdana, Geneva, Tahoma, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

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

ul,
ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
}

/* ------------------------------------------------------------
   Site Header
   ------------------------------------------------------------ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #ff6b6b 0%, #ffa500 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

/* Logo */
.site-logo .logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

/* Main Nav */
.main-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

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

.nav-link {
    display: inline-block;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    transition: background var(--transition);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

/* Nav Search */
.nav-search {
    position: relative;
}

#search-input {
    width: 200px;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 20px;
    background: #fff;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    transition: width var(--transition), box-shadow var(--transition);
}

#search-input:focus {
    width: 240px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

#search-input::placeholder {
    color: #aaa;
}

/* Search Results Dropdown */
.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.search-results.visible {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: background var(--transition);
    border-bottom: 1px solid #f0f0f0;
}

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

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eee;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-no-results {
    padding: 1.2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

/* Hamburger active state */
.nav-open .hamburger span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-open .hamburger span:nth-child(2) {
    opacity: 0;
}

.nav-open .hamburger span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ------------------------------------------------------------
   Breadcrumb
   ------------------------------------------------------------ */
.breadcrumb {
    background: #f5f5f5;
    padding: 0.8rem 2rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #e8e8e8;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity var(--transition);
}

.breadcrumb a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #aaa;
    margin: 0 0.4rem;
}

.breadcrumb-current {
    color: var(--text-dark);
    font-weight: 500;
}

/* ------------------------------------------------------------
   Game Grid
   ------------------------------------------------------------ */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ------------------------------------------------------------
   Game Card
   ------------------------------------------------------------ */
.game-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

/* Card Thumbnail */
.game-card-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background-color: #f0f0f0;
}

.game-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--cat-color, #667eea) 0%, color-mix(in srgb, var(--cat-color, #667eea) 70%, #000) 100%);
    padding: 1rem;
    text-align: center;
}

.placeholder-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.placeholder-title {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Badge */
.badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-new {
    background: var(--accent-green);
}

.badge-featured {
    background: var(--accent-orange);
}

/* Card Info */
.game-card-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.game-card-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.game-card-category {
    font-size: 0.75rem;
    color: var(--cat-color, var(--primary-color));
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ------------------------------------------------------------
   Section Title
   ------------------------------------------------------------ */
.section-title {
    font-size: 2rem;
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #ff6b6b 0%, #ffa500 100%);
}

/* ------------------------------------------------------------
   Layout Utilities
   ------------------------------------------------------------ */
.alt-bg {
    background: #f8f9fa;
}

.games-section {
    padding: 3rem 2rem;
}

.legal-section {
    padding: 3rem 2rem;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

/* ------------------------------------------------------------
   Legal Section Typography
   ------------------------------------------------------------ */
.legal-section h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.legal-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #ff6b6b;
    padding-left: 1rem;
}

.legal-section p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.legal-section ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: #555;
    margin-bottom: 1rem;
}

.legal-section ul li {
    margin-bottom: 0.4rem;
    line-height: 1.7;
}

.legal-date {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 2rem;
}

/* ------------------------------------------------------------
   Site Footer
   ------------------------------------------------------------ */
.site-footer {
    background: #2c3e50;
    color: #fff;
    padding: 3rem 2rem 1rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

.site-footer h3,
.site-footer h4 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.site-footer p {
    color: #bdc3c7;
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: #bdc3c7;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: #ff6b6b;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 2px solid #bdc3c7;
    border-radius: 50%;
    color: #bdc3c7;
    font-size: 1rem;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.social-icon:hover {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    padding-top: 2rem;
    opacity: 0.8;
    font-size: 0.85rem;
    color: #bdc3c7;
}

.footer-bottom a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color var(--transition);
}

.footer-bottom a:hover {
    color: #ff6b6b;
}

/* ------------------------------------------------------------
   Responsive — 768px
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    /* Header */
    .header-inner {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .site-logo {
        flex: 1;
    }

    .hamburger {
        display: flex;
    }

    .main-nav {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        /* Hidden by default on mobile */
        display: none;
        padding-bottom: 0.75rem;
    }

    /* When nav-open class is on a parent (e.g., body or header) */
    .nav-open .main-nav {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.4rem;
    }

    .nav-link {
        width: 100%;
        border-radius: 8px;
    }

    .nav-search {
        width: 100%;
    }

    #search-input {
        width: 100%;
    }

    #search-input:focus {
        width: 100%;
    }

    .search-results {
        width: 100%;
        right: auto;
        left: 0;
    }

    /* Game Grid */
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
        padding: 0 1rem;
    }

    /* Section Title */
    .section-title {
        font-size: 1.5rem;
    }

    /* Legal */
    .legal-section h1 {
        font-size: 1.8rem;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* ------------------------------------------------------------
   Tags Grid (tags index page)
   ------------------------------------------------------------ */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tag-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform var(--transition), box-shadow var(--transition);
    border-left: 4px solid var(--cat-color, #667eea);
}

.tag-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.tag-card-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.tag-card-info {
    flex: 1;
    min-width: 0;
}

.tag-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.tag-card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0;
}

/* ------------------------------------------------------------
   Tag Cloud (related tags on tag pages)
   ------------------------------------------------------------ */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

.tag-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: #fff;
    border: 2px solid var(--cat-color, #667eea);
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    transition: all var(--transition);
}

.tag-link:hover {
    background: var(--cat-color, #667eea);
    color: #fff;
}

.tag-icon {
    font-size: 1.1rem;
}

.tag-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.tag-link:hover .tag-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ------------------------------------------------------------
   Tag Pills (on games-like pages)
   ------------------------------------------------------------ */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.9rem;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    transition: all var(--transition);
    border: 1px solid transparent;
}

a.tag-pill:hover {
    border-color: var(--cat-color, #667eea);
    background: #fff;
    color: var(--cat-color, #667eea);
}

.original-game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

/* ------------------------------------------------------------
   Original Game Card (games-like hero)
   ------------------------------------------------------------ */
.original-game-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #e8e8e8;
}

.original-game-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    border-left: 4px solid #ff6b6b;
    padding-left: 1rem;
}

.original-game-card p {
    color: #555;
    line-height: 1.7;
    font-size: 0.95rem;
}

.play-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.7rem 2rem;
    background: linear-gradient(90deg, var(--cat-color, #ff6b6b), color-mix(in srgb, var(--cat-color, #ff6b6b) 70%, #000));
    color: #fff;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ------------------------------------------------------------
   SEO Content Sections
   ------------------------------------------------------------ */
.seo-content {
    background: #fff;
}

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #ff6b6b;
    padding-left: 1rem;
    color: var(--text-dark);
}

.seo-content h2:first-child {
    margin-top: 0;
}

.seo-content p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.seo-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: rgba(255, 107, 0, 0.3);
    transition: text-decoration-color var(--transition);
}

.seo-content a:hover {
    text-decoration-color: var(--primary-color);
}

.seo-game-list {
    list-style: none;
    padding: 0;
}

.seo-game-list li {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

.seo-game-list li:last-child {
    border-bottom: none;
}

.seo-game-list li a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.seo-game-list li a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Responsive — 480px
   ------------------------------------------------------------ */
@media (max-width: 480px) {
    .game-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .games-section,
    .legal-section {
        padding: 2rem 1rem;
    }

    .breadcrumb {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

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

    .legal-section h1 {
        font-size: 1.5rem;
    }

    .legal-section h2 {
        font-size: 1.2rem;
    }

    .tags-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .tag-cloud {
        padding: 0 1rem;
    }

    .original-game-card {
        padding: 1.2rem;
    }
}

@media (max-width: 768px) {
    .tags-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        padding: 0 1rem;
    }
}
