/**
 * BlynKraft - Main Stylesheet
 * Brand Colors: Primary Blue #1E88E5, Accent Orange #FF9800, Success Green #4CAF50
 */

/* ========== CSS Variables ========== */
:root {
    /* Brand Colors */
    --primary: #1E88E5;
    --primary-dark: #1565C0;
    --primary-light: #64B5F6;
    --accent: #FF9800;
    --accent-dark: #F57C00;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    
    /* Neutral Colors */
    --white: #FFFFFF;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Background & Text */
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-100);
    --bg-tertiary: var(--gray-200);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-500);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Container */
    --container-max: 1400px;
    --container-padding: 20px;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #e94560;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ========== Utilities ========== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    padding: var(--space-2xl) 0;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title i {
    color: var(--primary);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--accent-dark);
}

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ========== Header & Navigation ========== */
.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-normal);
}

.header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Search Box */
.search-box {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-sm);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition-fast);
}

/* ========== Hero Section ========== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: var(--space-3xl) 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></svg>');
    background-size: 100px 100px;
    opacity: 0.5;
}

.hero-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: var(--space-md);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
    margin-top: var(--space-2xl);
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.hero-stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========== Game Cards ========== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
}

a.game-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.game-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.game-card-thumb {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.game-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.game-card:hover .game-card-thumb img {
    transform: scale(1.05);
}

.game-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.game-card:hover .game-card-overlay {
    opacity: 1;
}

.game-card-play {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transform: scale(0.8);
    transition: transform var(--transition-fast);
}

.game-card:hover .game-card-play {
    transform: scale(1);
}

.game-card-badge {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
}

.badge-new {
    background: var(--success);
    color: var(--white);
}

.badge-hot {
    background: var(--accent);
    color: var(--white);
}

.badge-top {
    background: var(--warning);
    color: var(--gray-900);
}

.game-card-favorite {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    z-index: 10;
    color: var(--gray-400);
    transition: all var(--transition-fast);
}

.game-card-favorite:hover,
.game-card-favorite.active {
    background: var(--danger);
    color: var(--white);
}

.game-card-info {
    padding: var(--space-md);
}

.game-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.game-card-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--accent);
}

.game-card-category {
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

/* ========== Category Cards ========== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
}

.category-card {
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all var(--transition-normal);
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-md);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

.category-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.category-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== Featured Section ========== */
.featured-section {
    background: var(--bg-secondary);
}

.featured-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
}

.featured-main {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.featured-main-thumb {
    position: relative;
    aspect-ratio: 16/9;
}

.featured-main-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-main-info {
    padding: var(--space-lg);
}

.featured-main-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.featured-main-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.featured-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.featured-side-item {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.featured-side-item:hover {
    box-shadow: var(--shadow-md);
}

.featured-side-thumb {
    width: 100px;
    height: 75px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.featured-side-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-side-info {
    flex: 1;
}

.featured-side-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.featured-side-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== Carousel ========== */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.carousel-track {
    display: flex;
    transition: transform var(--transition-slow);
}

.carousel-slide {
    min-width: 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    aspect-ratio: 21/9;
    object-fit: cover;
}

.carousel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-2xl);
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: var(--white);
}

.carousel-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.carousel-desc {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

.carousel-nav:hover {
    background: var(--white);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev { left: var(--space-md); }
.carousel-next { right: var(--space-md); }

.carousel-dots {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.5);
    transition: all var(--transition-fast);
}

.carousel-dot.active {
    background: var(--white);
    width: 24px;
}

/* ========== Footer ========== */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-md);
}

.footer-desc {
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: var(--space-md);
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* ========== Toast Notifications ========== */
#toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--gray-900);
    color: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-normal);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-info { border-left: 4px solid var(--primary); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-error { border-left: 4px solid var(--danger); }

/* ========== Loading Spinner ========== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Responsive Design ========== */
@media (max-width: 1200px) {
    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 992px) {
    .header-inner {
        height: 60px;
    }
    
    .nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-md);
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .search-box {
        width: 200px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        gap: var(--space-lg);
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .carousel-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 16px;
    }
    
    .section {
        padding: var(--space-xl) 0;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero {
        padding: var(--space-2xl) 0;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-stats {
        flex-wrap: wrap;
        gap: var(--space-md);
    }
    
    .hero-stat-value {
        font-size: 1.5rem;
    }
    
    .search-box {
        display: none;
    }
    
    .carousel-content {
        padding: var(--space-lg);
    }
    
    .carousel-title {
        font-size: 1.25rem;
    }
    
    .carousel-desc {
        font-size: 0.9rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-card-info {
        padding: var(--space-sm);
    }
    
    .game-card-title {
        font-size: 0.85rem;
    }
    
    .btn-lg {
        padding: 12px 20px;
        font-size: 1rem;
    }
}
