/* ============================================
   PLAYBITE - MODERN GAMING PORTAL STYLES
   AdSense-Ready & Premium Design
   ============================================ */

/* CSS Variables - Modern Color Palette */
:root {
    /* Primary Colors - Gaming Purple/Blue */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --primary-glow: rgba(99, 102, 241, 0.5);

    /* Accent Colors */
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Dark Theme */
    --bg-darker: #0a0a0f;
    --bg-dark: #0f0f17;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2a;
    --bg-sidebar: #0d0d14;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Borders & Effects */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    --gradient-dark: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%);

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--primary-glow);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at top right, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ============================================
   BUTTONS - MODERN STYLE
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-accent {
    background: var(--gradient-accent);
    color: white;
}

/* ============================================
   GLASSMORPHISM CARDS
   ============================================ */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   GAME CARDS - MODERN DESIGN
   ============================================ */

.game-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid transparent;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.game-card .thumbnail-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.game-card .thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.game-card:hover .thumbnail-wrapper img {
    transform: scale(1.1);
}

.game-card .play-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.game-card:hover .play-overlay {
    opacity: 1;
}

.game-card .play-button {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.8);
    transition: var(--transition);
    box-shadow: var(--shadow-glow);
}

.game-card:hover .play-button {
    transform: scale(1);
}

.game-card .play-button i {
    color: white;
    font-size: 1.5rem;
    margin-left: 4px;
}

.game-card .card-content {
    padding: 1rem;
}

.game-card .game-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.game-card .category-tag {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    border: 1px solid var(--primary);
    z-index: 10;
}

/* ============================================
   SIDEBAR - MODERN STYLE
   ============================================ */

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    width: 260px;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo img {
    max-height: 40px;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.sidebar-section-title {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* ============================================
   HEADER - STICKY & MODERN
   ============================================ */

.main-header {
    background: rgba(15, 15, 23, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    gap: 1rem;
}

/* Search Bar - Modern */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar button,
.search-bar .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
    padding: 3rem 0;
    position: relative;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-image {
    position: relative;
}

.hero-image img {
    max-width: 100%;
    filter: drop-shadow(0 20px 40px rgba(99, 102, 241, 0.3));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ============================================
   SECTION STYLES
   ============================================ */

.section {
    padding: 3rem 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.view-all-link:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   GAME GRID
   ============================================ */

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (min-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ============================================
   FOOTER - MODERN & ADSENSE READY
   ============================================ */

.main-footer {
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   AD CONTAINERS - ADSENSE READY
   ============================================ */

.ad-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 90px;
    margin: 1.5rem 0;
}

.ad-container.header-ad {
    min-height: 90px;
}

.ad-container.sidebar-ad {
    min-height: 250px;
}

.ad-container.content-ad {
    min-height: 250px;
}

/* ============================================
   BREADCRUMB
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    color: var(--text-muted);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   RESPONSIVE - MOBILE FIRST
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .section {
        padding: 2rem 0;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 1rem;
    background: var(--primary);
    color: white;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Focus styles */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {

    .sidebar,
    .main-header,
    .ad-container,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ============================================
   ANIMATIONS - DYNAMIC CONTENT
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
    animation: slideInUp 0.6s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Staggered animation for game cards */
.game-card {
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.game-card:nth-child(1) {
    animation-delay: 0.05s;
}

.game-card:nth-child(2) {
    animation-delay: 0.1s;
}

.game-card:nth-child(3) {
    animation-delay: 0.15s;
}

.game-card:nth-child(4) {
    animation-delay: 0.2s;
}

.game-card:nth-child(5) {
    animation-delay: 0.25s;
}

.game-card:nth-child(6) {
    animation-delay: 0.3s;
}

.game-card:nth-child(7) {
    animation-delay: 0.35s;
}

.game-card:nth-child(8) {
    animation-delay: 0.4s;
}

.game-card:nth-child(9) {
    animation-delay: 0.45s;
}

.game-card:nth-child(10) {
    animation-delay: 0.5s;
}

.game-card:nth-child(11) {
    animation-delay: 0.55s;
}

.game-card:nth-child(12) {
    animation-delay: 0.6s;
}

/* Gradient text effect for hero */
.gradient-text {
    background: linear-gradient(135deg, #fff 0%, #a78bfa 50%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hover scale effect */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ============================================
   MOBILE OPTIMIZATION
   ============================================ */

/* Improved Touch Targets */
@media (max-width: 768px) {

    /* Larger touch targets for mobile */
    .btn,
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
    }

    /* Better tap highlighting */
    .game-card,
    .sidebar-link,
    a {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.3);
    }

    /* Optimized game cards for mobile */
    .game-card {
        transform: none !important;
    }

    .game-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease;
    }

    /* Show play button always on mobile */
    .game-card .play-overlay {
        opacity: 1;
        background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
    }

    .game-card .play-button {
        transform: scale(0.8);
        width: 40px;
        height: 40px;
    }

    /* Mobile navigation improvements */
    .sidebar-link {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    /* Smaller section titles on mobile */
    h2 {
        font-size: 1.25rem;
    }

    /* Full-width buttons on mobile */
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Better spacing for mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Game of the Day mobile layout */
    .md\:col-span-2 {
        grid-column: span 1;
    }

    /* Trending numbers smaller on mobile */
    .game-card .absolute.w-6.h-6 {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.65rem;
    }
}

/* Small phone optimizations */
@media (max-width: 380px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .game-card-title {
        font-size: 0.75rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-section p {
        font-size: 0.875rem;
    }
}

/* Smooth scroll for mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality on mobile */
.overflow-y-auto::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Prevent zoom on input focus (iOS) */
input,
select,
textarea {
    font-size: 16px;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .main-footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .game-card:hover .thumbnail-wrapper img,
    .game-card:hover .play-button {
        transform: none;
    }
}

/* Image lazy loading placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

img[loading="lazy"][src] {
    animation: none;
    background: none;
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}