/*
Theme Name: GamesAndTools Magazine
Theme URI: https://gamesandtools.com
Description: Premium Magazine Style Theme with Ad Banner
Version: 3.2
*/

/* --- 1. Define Color Variables (Light Mode Default) --- */
:root {
    --primary: #D92525;
    --dark: #111111;
    --light: #ffffff;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #111111;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    
    /* Category Colors */
    --cat-tech: #3b5998;
    --cat-game: #10b981;
    --cat-tool: #f59e0b;
}

/* --- 2. Dark Mode Overrides --- */
body.dark-mode {
    --bg-body: #0f172a;       /* Deep Dark Blue/Gray */
    --bg-card: #1e293b;       /* Lighter Blue/Gray for cards */
    --text-main: #f8fafc;     /* White text */
    --text-muted: #94a3b8;    /* Light gray text */
    --border-color: #334155;  /* Dark borders */
    --shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* --- 3. Global Styles --- */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 15px; }

/* Apply Variables to specific elements */
.mag-card, .sidebar-widget, article, .site-header, .main-navigation ul ul {
    background-color: var(--bg-card) !important;
    color: var(--text-main);
    border-color: var(--border-color) !important;
}

h1, h2, h3, h4, h5, h6, a { color: var(--text-main); }

/* Dark Mode Borders */
body.dark-mode .mag-card, 
body.dark-mode .sidebar-widget {
    box-shadow: none;
    border: 1px solid var(--border-color);
}

/* --- Top Bar --- */
.top-bar { background: #000; color: #fff; padding: 8px 0; font-size: 12px; }
.top-flex { display: flex; justify-content: space-between; }

/* --- Main Header (Logo & Banner Ad) --- */
header { background: #fff; padding: 25px 0; }
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.logo h1 { margin: 0; font-size: 36px; font-weight: 900; color: var(--dark); text-transform: uppercase; letter-spacing: -1px; }
.logo span { color: var(--primary); }

.header-ad { flex-grow: 1; text-align: right; }
.header-ad img { max-width: 100%; max-height: 90px; border-radius: 4px; display: inline-block; }

/* --- NAVIGATION BAR (Desktop) --- */
.main-nav-wrapper { 
    background: #111111; 
    border-top: 2px solid #D92525; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); 
    height: 60px;
}

.nav-flex-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.main-nav ul { display: flex; list-style: none; margin: 0; padding: 0; }
.main-nav ul li { position: relative; }
.main-nav ul li a { 
    display: block; 
    padding: 0 20px; 
    line-height: 60px; 
    color: #ffffff; 
    font-weight: 700; 
    font-size: 14px; 
    text-transform: uppercase; 
    text-decoration: none; 
}
.main-nav ul li a:hover, .main-nav ul li.current-menu-item > a { background: #D92525; color: #fff; }

/* Desktop Dropdowns */
.main-nav ul ul {
    position: absolute; top: 100%; left: 0;
    width: 220px; background: #1a1a1a;
    display: block; visibility: hidden; opacity: 0;
    transform: translateY(10px); transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-top: 2px solid #D92525;
    flex-direction: column;
}
.main-nav ul li:hover > ul { visibility: visible; opacity: 1; transform: translateY(0); }
.main-nav ul ul li { border-bottom: 1px solid rgba(255,255,255,0.05); }
.main-nav ul ul li a { line-height: 1.5; padding: 12px 20px; font-size: 13px; text-transform: none; color: #ccc; }
.main-nav ul ul ul { top: 0; left: 100%; margin-top: -2px; }

/* --- Header Controls (Search & Dark Mode) --- */
.nav-right-controls { display: flex; align-items: center; gap: 15px; }

/* Dark Mode Toggle Button */
#dark-mode-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#dark-mode-toggle svg { width: 18px; height: 18px; color: #fff; }

/* Header Search */
.header-search { display: flex; align-items: center; }
.search-form {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}
.search-form:focus-within { background: #fff; border-color: #D92525; }
.search-field {
    background: transparent; border: none; padding: 8px 15px;
    font-size: 14px; color: #fff; outline: none; width: 150px;
}
.search-form:focus-within .search-field { color: #111; width: 200px; }
.search-submit { background: #D92525; border: none; padding: 0 15px; cursor: pointer; display: flex; align-items: center; }
.search-submit svg { width: 16px; height: 16px; fill: #fff; }

/* --- Layouts & Components --- */
.home-layout { display: grid; grid-template-columns: 70% 28%; justify-content: space-between; margin-top: 30px; gap: 2%; }
.main-column, .sidebar-column { display: flex; flex-direction: column; }

/* Hero */
.hero-large { position: relative; height: 450px; border-radius: 8px; overflow: hidden; }
.hero-overlay { position: absolute; bottom: 0; left: 0; width: 100%; background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); padding: 20px; color: #fff; }

/* Section Heads */
.section-head { border-left: 5px solid var(--primary); padding-left: 15px; margin: 40px 0 20px; }
.section-head h3 { margin: 0; font-size: 20px; text-transform: uppercase; font-weight: 800; }

/* Grid & Cards */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 25px; }
.mag-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.3s; }
.mag-card:hover { transform: translateY(-5px); }
.card-thumb { height: 180px; position: relative; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.mag-card:hover img { transform: scale(1.1); }
.card-body { padding: 15px; }
.card-body h3 { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }

/* Badges & Buttons */
.badge { position: absolute; top: 15px; left: 15px; padding: 4px 10px; font-size: 10px; font-weight: bold; text-transform: uppercase; color: #fff; border-radius: 3px; z-index: 10; }
.bg-game, .btn-play { background: var(--cat-game); }
.bg-tool, .btn-tool { background: var(--cat-tool); }
.bg-news { background: var(--cat-tech); }
.bg-edu, .btn-edu { background-color: #8b5cf6; color: #fff; }
.bg-soft, .btn-soft { background-color: #0ea5e9; color: #fff; }
.btn-sm { display: inline-block; padding: 6px 12px; font-size: 12px; font-weight: bold; color: #fff; border-radius: 4px; margin-top: 5px; }

/* Archive Layout (Sidebar Ad) */
.archive-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    margin-top: 30px;
    margin-bottom: 60px;
    align-items: start;
}
.vertical-ad-box {
    position: sticky; top: 90px;
    background: #fff; padding: 15px;
    border-radius: 8px; border: 1px solid #e2e8f0;
    text-align: center;
}

/* Sidebar Widgets */
.sidebar-widget { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 30px; }
.social-grid-vertical { display: flex; flex-direction: column; gap: 15px; }
.s-box { padding: 15px; color: #fff; text-align: center; border-radius: 4px; font-weight: bold; }
.s-fb { background: #3b5998; } .s-tw { background: #1da1f2; } .s-yt { background: #ff0000; }


/* =========================================
   MOBILE RESPONSIVE FIXES (THE IMPORTANT PART)
   ========================================= */

/* 1. Mobile Menu & Header Fix (Locked Height) */
#mobile-menu-toggle { display: none; }

@media (max-width: 992px) {
    /* Lock Header Height */
    .main-nav-wrapper { 
        height: 60px !important; 
        min-height: 60px !important;
        max-height: 60px !important;
        padding: 0 15px !important;
        overflow: visible !important;
        position: sticky; top: 0;
    }

    /* Force Horizontal Row */
    .nav-flex-container { 
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        height: 60px !important;
        width: 100% !important;
    }

    /* Hamburger Icon */
    #mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: none; border: none; cursor: pointer;
        padding: 10px; margin-right: auto;
        height: 40px; width: 40px;
    }
    #mobile-menu-toggle span {
        display: block; width: 25px; height: 3px;
        background: #fff; border-radius: 2px;
    }

    /* Hide Menu by Default */
    .main-nav {
        display: none; /* Hidden */
        position: absolute; top: 60px; left: 0;
        width: 100%; background: #111;
        border-top: 2px solid #D92525;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
        padding: 0; z-index: 9998;
    }
    /* Show Menu when Active */
    .main-nav.active { display: block !important; }

    .main-nav ul { flex-direction: column; width: 100%; }
    .main-nav ul li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .main-nav ul li a { padding: 15px 20px; line-height: normal; }
    
    /* Layout Stacking */
    .header-inner, .home-layout, .archive-layout { grid-template-columns: 1fr; }
    .header-inner { flex-direction: column; text-align: center; }
    .header-ad { display: none !important; }
    .sidebar-right { display: none; }
    
    /* Search Bar Compact */
    .search-field { width: 0px !important; padding: 0 !important; opacity: 0; }
    .search-form:focus-within .search-field {
        width: 160px !important; padding: 5px 10px !important;
        opacity: 1; background: #fff !important; color: #111 !important;
        position: absolute; right: 50px; top: 10px; z-index: 9999;
    }
}


/* 2. Universal Tool Width Fix (Prevents Black Screen Overflow) */
@media (max-width: 768px) {
    .tax-calc-wrapper, 
    #neon-reader-app, 
    .tool-container, 
    .password-generator-wrapper,
    div[style*="width: 800px"], 
    div[style*="width:800px"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        overflow-x: hidden !important;
    }
    
    /* Fix Hero Height on Mobile */
    .hero-large { height: 250px; }
}
/* --- CRITICAL LAYOUT FIX FOR MOBILE --- */
@media (max-width: 768px) {
    /* Force all layouts to be Single Column */
    .home-layout, 
    .archive-layout, 
    .single-page-layout {
        display: block !important; /* Disables Grid */
        width: 100% !important;
    }

    /* Force Main Content to take full width */
    .main-column, 
    .main-content, 
    .main-content-area {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 10px !important;
    }

    /* Hide Sidebars/Ads on Mobile to prevent squishing */
    .sidebar-column, 
    .sidebar-right, 
    .ad-column {
        display: none !important;
    }
}
/* Container that holds both the Main Content and the Sidebar */
.site-content-container {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* The Main Content Area (takes up 70% width) */
.site-main {
    flex: 3; 
}

/* The Sidebar Area (takes up remaining space) */
.widget-area {
    flex: 1; 
    background-color: #f4f4f4; /* Light gray background for visibility */
    padding: 15px;
    border-radius: 5px;
}

/* Mobile Responsive: Stack them on small screens */
@media (max-width: 768px) {
    .site-content-container {
        flex-direction: column;
    }
}

/* =========================================
   GLOSSY NEON HEADER (SUPER ANIMATED)
   ========================================= */

/* 1. Header Background with Breathing Glow */
@keyframes bg-breathe {
    0%, 100% { box-shadow: 0 5px 25px rgba(255, 0, 255, 0.2); border-bottom-color: #ff00ff; }
    50% { box-shadow: 0 5px 40px rgba(0, 243, 255, 0.3); border-bottom-color: #00f3ff; }
}
.neon-header-area {
    background: linear-gradient(135deg, #06020c 0%, #130424 100%) !important;
    padding: 35px 0 !important;
    border-bottom: 2px solid #ff00ff; 
    animation: bg-breathe 6s infinite ease-in-out;
}

/* 2. Logo Layout */
.neon-logo-wrapper { display: flex; align-items: center; }
.neon-logo-link { display: flex; align-items: center; gap: 15px; text-decoration: none; }
.neon-text-container { position: relative; display: inline-block; }

/* 3. The Continuous Moving & Color-Shifting Text */
@keyframes text-alive {
    0% {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff00ff, 0 0 40px #ff00ff;
        transform: translateY(0px) scale(1);
        color: #ffffff;
    }
    50% {
        /* Color shifts to Cyan and text floats up slightly */
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #00f3ff, 0 0 40px #00f3ff, 0 0 60px #00f3ff;
        transform: translateY(-5px) scale(1.02); 
        color: #e0ffff; 
    }
    100% {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px #ff00ff, 0 0 40px #ff00ff;
        transform: translateY(0px) scale(1);
        color: #ffffff;
    }
}
.neon-text {
    margin: 0 !important;
    font-size: 42px !important;
    font-weight: 900 !important;
    font-family: 'Arial Black', Impact, sans-serif !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1;
    display: inline-block; /* Required for movement */
    animation: text-alive 3s infinite ease-in-out; /* Continuous Animation */
}

/* 4. Completely Hide the Middle Line (Slice) */
.neon-slice {
    display: none !important;
}

/* 5. Glowing Icons with Animations */
.neon-icon { width: 36px; height: 36px; transition: all 0.4s ease; }

/* Cyan Icon - Always Spinning */
@keyframes spin-cyan { 100% { transform: rotate(360deg); } }
.cyan-glow {
    color: #00f3ff;
    filter: drop-shadow(0 0 8px #00f3ff) drop-shadow(0 0 15px rgba(0, 243, 255, 0.6));
    animation: spin-cyan 6s linear infinite; 
}

/* Magenta Icon - Always Pulsing & Tilting */
@keyframes pulse-magenta {
    0%, 100% { transform: rotate(15deg) scale(1); filter: drop-shadow(0 0 8px #ff00ff) drop-shadow(0 0 15px rgba(255, 0, 255, 0.6)); }
    50% { transform: rotate(-15deg) scale(1.15); filter: drop-shadow(0 0 15px #ff00ff) drop-shadow(0 0 30px rgba(255, 0, 255, 0.9)); }
}
.magenta-glow {
    color: #ff00ff;
    animation: pulse-magenta 3s ease-in-out infinite;
}

/* 6. Dynamic Interactive Hover Effects (When mouse is over it) */
.neon-logo-link:hover .cyan-glow { animation: spin-cyan 1s linear infinite; }
.neon-logo-link:hover .magenta-glow { animation: pulse-magenta 0.5s ease-in-out infinite; }

/* 7. Mobile Adjustments */
@media (max-width: 768px) {
    .neon-header-area { padding: 20px 0 !important; }
    .neon-text { font-size: 22px !important; letter-spacing: 0px; }
    .neon-icon { width: 22px; height: 22px; }
    .neon-logo-link { gap: 8px; justify-content: center; }
}