:root {
    --bg-base: #030000;
    --panel-bg: #0a0101;
    --border-main: #4a0000;
    --border-glow: #ff0000;
    --text-main: #ff4d4d;
    --text-dim: #992222;
    --text-white: #ffdddd;
    --alert: #ff003c;
    --safe: #00ff66;
    --warning: #ffaa00;
    --font-mono: 'Share Tech Mono', monospace;
    --font-head: 'Rajdhani', sans-serif;
}

/* CUSTOM CYBER SCROLLBARS */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); border-left: 1px solid var(--border-main); }
::-webkit-scrollbar-thumb { background: var(--border-main); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--alert); }

body {
    margin: 0; padding: 0; background-color: var(--bg-base);
    color: var(--text-main); font-family: var(--font-mono);
    height: 100vh; overflow: hidden; /* Locked on desktop */
}

/* CRT Scanlines */
.crt-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px; z-index: 9999; pointer-events: none; opacity: 0.3;
}

/* Base Layout */
.dashboard-grid {
    display: grid; grid-template-columns: 280px 1fr;
    height: 100vh; width: 100vw;
}

/* Sidebar */
.sidebar {
    background: var(--panel-bg); border-right: 1px solid var(--border-main);
    padding: 20px; display: flex; flex-direction: column;
    box-shadow: inset -10px 0 20px rgba(255,0,0,0.03); z-index: 10;
    overflow-y: auto; /* Fixes out-of-frame sidebar content */
}
.brand { border-bottom: 1px solid var(--border-main); padding-bottom: 15px; margin-bottom: 20px; }
.glitch { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--alert); text-shadow: 0 0 10px var(--alert); }
.brand-sub { font-size: 0.8rem; color: var(--text-dim); }

.tool-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-btn {
    background: transparent; color: var(--text-dim); border: 1px solid var(--border-main);
    padding: 12px; text-align: left; font-family: var(--font-mono); font-size: 0.9rem;
    cursor: pointer; transition: 0.2s; position: relative;
}
.nav-btn:hover, .nav-btn.active {
    background: rgba(255,0,0,0.1); color: var(--text-white);
    border-color: var(--alert); box-shadow: 0 0 10px rgba(255,0,0,0.2);
}
.nav-btn.active::before { content: '>'; position: absolute; left: 5px; color: var(--alert); }
.nav-btn.active { padding-left: 20px; }

.system-stats { font-size: 0.8rem; color: var(--text-dim); border-top: 1px solid var(--border-main); padding-top: 15px; margin-top: 20px;}
.text-green { color: var(--safe); text-shadow: 0 0 5px var(--safe);}
.text-red { color: var(--alert); }

/* Main Area */
.main-panel { padding: 20px; overflow-y: auto; background: radial-gradient(circle at top, #0a0101 0%, #030000 100%); position: relative;}
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;}
.sys-warning { border: 1px solid var(--alert); padding: 8px 15px; color: var(--alert); font-size: 0.85rem; background: rgba(255,0,0,0.05); flex: 1; text-align: center;}
.blink { animation: blinker 1.5s linear infinite; }
@keyframes blinker { 50% { opacity: 0.2; } }

.error-banner { background: var(--alert); color: #fff; padding: 10px; text-align: center; font-weight: bold; margin-bottom: 20px; border-radius: 4px; z-index: 1000; position: relative; }

/* AdSense Blocks */
.ad-space, .top-ad-space { border: 1px dashed var(--border-main); background: rgba(10,0,0,0.5); position: relative; }
.ad-label { position: absolute; top: -8px; left: 10px; background: var(--bg-base); font-size: 0.6rem; color: var(--text-dim); padding: 0 5px; }
.sidebar-ad { height: 250px; margin: 20px 0; display: flex; align-items: center; justify-content: center;}
.top-ad-space { width: 100%; max-width: 728px; height: 90px; display: flex; align-items: center; justify-content: center; margin: 0 auto;}
.ad-placeholder { color: var(--border-main); font-size: 0.8rem; }

/* Utilities */
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }

/* Module UI */
.tool-view { animation: fadeUp 0.3s ease-out; }
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }
.view-header h2 { font-family: var(--font-head); margin: 0; color: var(--text-white); text-shadow: 0 0 5px rgba(255,50,50,0.3); font-size: 1.8rem;}
.view-header p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 20px; }

/* Drag & Drop */
.drop-zone {
    border: 1px dashed var(--border-main); background: rgba(20, 0, 0, 0.4);
    padding: 60px 20px; text-align: center; cursor: pointer; transition: 0.3s;
}
.drop-zone:hover { border-color: var(--alert); background: rgba(255, 0, 0, 0.05); box-shadow: inset 0 0 20px rgba(255,0,0,0.1); }
.drop-zone h3 { margin: 0 0 10px 0; color: var(--alert); font-size: 1.5rem; letter-spacing: 2px;}

/* Loading Animation */
.cyber-loader { text-align: center; padding: 50px 20px; border: 1px solid var(--border-main); background: rgba(10,0,0,0.8); }
.loader-text { color: var(--alert); margin-bottom: 15px; font-size: 1.2rem; letter-spacing: 2px; }
.loader-bar { width: 100%; max-width: 400px; height: 4px; background: rgba(255,0,0,0.1); margin: 0 auto; position: relative; overflow: hidden; border: 1px solid var(--border-main); }
.loader-fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--alert); width: 0%; box-shadow: 0 0 10px var(--alert); transition: width 0.1s linear; }

/* Results */
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 20px; }
.data-box { border: 1px solid var(--border-main); padding: 15px; background: rgba(5,0,0,0.8); }
.data-box h4 { margin: 0 0 10px 0; color: var(--text-dim); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px; font-size: 0.8rem;}
.highlight { color: var(--text-white); font-size: 1.1rem; word-break: break-all;}
.risk-indicator { font-size: 1.5rem; font-weight: bold; }

.cyber-table { width: 100%; border-collapse: collapse; background: rgba(5,0,0,0.8); border: 1px solid var(--border-main); }
.cyber-table th { background: rgba(255,0,0,0.1); color: var(--text-white); text-align: left; padding: 10px; border-bottom: 1px solid var(--alert); font-size: 0.9rem;}
.cyber-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-main); font-size: 0.85rem; word-break: break-all;} 
.cyber-table td:first-child { color: var(--text-dim); width: 30%;}

.terminal-box { background: #000; border: 1px solid var(--border-main); padding: 15px; height: 300px; overflow-y: auto; color: var(--text-main); line-height: 1.5; font-size: 0.85rem;}
.term-line { margin-bottom: 4px; }
.term-safe { color: var(--safe); }
.term-warning { color: var(--warning); }
.term-danger { color: var(--alert); background: rgba(255,0,0,0.1); }
.hex-grid { font-family: monospace; white-space: pre-wrap; word-wrap: break-word; font-size: 0.8rem; color: var(--text-dim);}

.cyber-btn {
    background: transparent; color: var(--alert); border: 1px solid var(--alert);
    padding: 12px 20px; font-family: var(--font-mono); font-size: 1rem;
    cursor: pointer; transition: 0.3s; width: 100%; text-transform: uppercase; display: block;
}
.cyber-btn:hover { background: var(--alert); color: #000; box-shadow: 0 0 15px var(--alert); }

/* FLAWLESS MOBILE RESPONSIVE FIX */
@media (max-width: 900px) {
    /* Allow native scrolling on mobile */
    body { height: auto; overflow: visible; }
    
    /* Break grid into vertical stack */
    .dashboard-grid { display: flex; flex-direction: column; height: auto; }
    
    .sidebar { border-right: none; border-bottom: 1px solid var(--border-main); padding: 15px; height: auto; overflow: visible;}
    .brand { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: none; padding-bottom: 0;}
    .brand-sub { display: none; }
    .tool-nav { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 5px; }
    .nav-btn { flex: 1 1 48%; padding: 10px 5px; text-align: center; font-size: 0.75rem; }
    .nav-btn.active { padding-left: 5px; }
    .nav-btn.active::before { display: none; }
    .system-stats, .sidebar-ad { display: none; } 
    
    /* Ensure Main Panel doesn't cut off */
    .main-panel { padding: 15px; height: auto; overflow: visible; padding-bottom: 50px;}
    .top-bar { flex-direction: column; }
    .top-ad-space { height: 50px; } 
    .drop-zone { padding: 40px 15px; }
    .view-header h2 { font-size: 1.4rem; }
}
/* SEO DOCUMENTATION & KNOWLEDGE BASE */
.seo-docs {
    margin-top: 60px;
    border-top: 2px dashed var(--border-main);
    padding-top: 30px;
    padding-bottom: 50px;
}
.doc-header h2 {
    font-family: var(--font-head);
    color: var(--text-dim);
    font-size: 1.2rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
}
.doc-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}
/* FLAWLESS MOBILE RESPONSIVE FIX & AD REORDERING */
@media (max-width: 900px) {
    body { height: auto; overflow: visible; }
    
    .dashboard-grid { display: flex; flex-direction: column; height: auto; }
    
    .sidebar { border-right: none; border-bottom: 1px solid var(--border-main); padding: 15px; height: auto; overflow: visible;}
    .brand { margin-bottom: 15px; border-bottom: none; padding-bottom: 0;}
    .brand-sub { display: none; }
    
    .tool-nav { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 5px; }
    .nav-btn { flex: 1 1 48%; padding: 10px 5px; text-align: center; font-size: 0.75rem; }
    .nav-btn.active { padding-left: 5px; }
    .nav-btn.active::before { display: none; }
    .system-stats, .sidebar-ad { display: none; } 
    
    /* --- Main Panel Flex Reordering --- */
    .main-panel { 
        padding: 15px; 
        height: auto; 
        overflow: visible; 
        padding-bottom: 50px;
        display: flex; 
        flex-direction: column; /* Establishes vertical ordering */
    }
    
    /* Unwrap the top bar so we can reorder its children */
    .top-bar { display: contents; } 
    
    /* Define the exact order of elements on mobile */
    .sys-warning { order: 1; width: 100%; margin-bottom: 20px; }
    .error-banner { order: 2; }
    .tool-view { order: 3; width: 100%; }
    
    /* Move Ad below the execution tools */
    .top-ad-space { 
        order: 4; 
        height: auto; 
        margin-top: 30px; 
        margin-bottom: 30px; 
        width: 100%; 
        display: flex; 
        justify-content: center;
    } 
    
    /* Keep SEO docs at the very bottom */
    .seo-docs { order: 5; width: 100%; }
    
    .drop-zone { padding: 40px 15px; }
    .view-header h2 { font-size: 1.4rem; }
}
}
.doc-content article {
    background: rgba(10, 0, 0, 0.5);
    border: 1px solid var(--border-main);
    padding: 20px;
    border-left: 3px solid var(--alert);
    transition: 0.3s;
}
.doc-content article:hover {
    background: rgba(255, 0, 0, 0.05);
    border-left-color: var(--safe);
}
.doc-content h3 {
    color: var(--text-white);
    margin: 0 0 10px 0;
    font-size: 1rem;
    text-transform: uppercase;
}
.doc-content p {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}
.doc-content strong {
    color: var(--alert);
    font-weight: normal;
}
/* ICON STYLING */
.brand-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-icon {
    width: 38px; /* Adjust size as needed */
    height: auto;
    filter: drop-shadow(0 0 5px var(--alert)); /* Red cyber glow */
}
/* --- BLOG PAGE SPECIFIC --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.blog-card {
    background: rgba(10, 0, 0, 0.8);
    border: 1px solid var(--border-main);
    padding: 20px;
    position: relative;
    transition: 0.3s;
}

.blog-card:hover {
    border-color: var(--alert);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.1);
}

.card-header {
    font-size: 0.7rem;
    color: var(--text-dim);
    border-bottom: 1px dashed var(--border-main);
    margin-bottom: 10px;
    padding-bottom: 5px;
}

.blog-card h3 a {
    color: var(--text-white);
    text-decoration: none;
    font-family: var(--font-head);
    font-size: 1.2rem;
}

.blog-card p {
    color: var(--text-main);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 15px 0;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    border-top: 1px dashed var(--border-main);
    padding-top: 10px;
}

.in-feed-ad {
    grid-column: 1 / -1;
    border: 1px solid var(--border-main);
    padding: 10px;
    background: rgba(255, 0, 0, 0.02);
}

/* Ensure links in the nav look like buttons */
nav.tool-nav a.nav-btn {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    line-height: 1.2;
}

/* Mobile Fix for Nav Buttons */
@media (max-width: 900px) {
    .tool-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .nav-btn {
        flex: 1 1 48%; /* Keeps buttons side-by-side on mobile */
        font-size: 0.75rem;
        padding: 10px 5px;
        text-align: center;
    }
}
/* ========================================= */
/* --- BLOG PAGE SPECIFIC & AD FIXES --- */
/* ========================================= */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.blog-card {
    background: rgba(10, 0, 0, 0.8);
    border: 1px solid var(--border-main);
    padding: 20px;
    position: relative;
    transition: 0.3s;
}

.blog-card:hover {
    border-color: var(--alert);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.1);
}

.card-header {
    font-size: 0.7rem;
    color: var(--text-dim);
    border-bottom: 1px dashed var(--border-main);
    margin-bottom: 10px;
    padding-bottom: 5px;
}

.blog-card h3 a {
    color: var(--text-white);
    text-decoration: none;
    font-family: var(--font-head);
    font-size: 1.2rem;
}

.blog-card p {
    color: var(--text-main);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 15px 0;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    border-top: 1px dashed var(--border-main);
    padding-top: 10px;
}

.in-feed-ad {
    grid-column: 1 / -1;
    border: 1px dashed var(--border-main);
    padding: 10px;
    background: rgba(255, 0, 0, 0.02);
}

/* Fix for Top Ad Space to ensure it doesn't collapse */
.top-ad-space {
    min-height: 90px;
    width: 100%;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 0, 0, 0.02);
    border: 1px dashed var(--border-main);
    overflow: hidden;
}

.top-ad-space ins {
    min-width: 320px;
    min-height: 90px;
}

/* Ensure link buttons in nav look identical to standard buttons */
nav.tool-nav a.nav-btn {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    line-height: 1.2;
}

/* Mobile Fix for Nav Buttons */
@media (max-width: 900px) {
    .tool-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .nav-btn {
        flex: 1 1 48%;
        font-size: 0.75rem;
        padding: 10px 5px;
        text-align: center;
    }
}
/* ========================================= */
/* --- IN-HOUSE READER MODAL STYLES --- */
/* ========================================= */

.cyber-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.cyber-modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-main);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.2);
    position: relative;
    animation: fadeUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-main);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.close-btn {
    background: transparent;
    color: var(--alert);
    border: none;
    font-family: var(--font-mono);
    font-size: 1rem;
    cursor: pointer;
}

.close-btn:hover {
    text-shadow: 0 0 5px var(--alert);
}

.modal-content h2 {
    font-family: var(--font-head);
    color: var(--text-white);
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.modal-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.modal-ad-space {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 0, 0, 0.02);
    border: 1px dashed var(--border-main);
}

.modal-body {
    font-size: 1rem;
    color: #ccc;
    line-height: 1.6;
}

.modal-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-main);
    margin: 15px 0;
}

.modal-body a {
    color: var(--safe);
}
/* ========================================= */
/* --- SCROLLING FIX FOR BLOG PAGE --- */
/* ========================================= */

/* 1. Unlock native browser scrolling only on the blog */
body.blog-page {
    overflow-y: auto !important; 
    height: auto !important;
}

/* 2. Allow the grid to expand vertically */
body.blog-page .dashboard-grid {
    height: auto !important;
    min-height: 100vh;
}

/* 3. Let the main panel grow naturally */
body.blog-page .main-panel {
    overflow-y: visible !important;
    height: auto !important;
    min-height: 100vh;
}

/* 4. Keep the sidebar "sticky" on desktop so it stays in view while reading */
@media (min-width: 901px) {
    body.blog-page .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

/* ========================================= */
/* --- CYBER DROPDOWN NAVIGATION --- */
/* ========================================= */

.cyber-dropdown {
    width: 100%;
    margin-bottom: 5px;
}

.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.drop-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: var(--text-dim);
}

.dropdown-toggle.open .drop-icon {
    transform: rotate(180deg);
    color: var(--alert);
}

.dropdown-content {
    display: flex;
    flex-direction: column;
    background: rgba(5, 0, 0, 0.5);
    border-left: 1px dashed var(--border-main);
    border-right: 1px dashed var(--border-main);
    border-bottom: 1px dashed var(--border-main);
    padding: 5px 0;
    margin-left: 10px; /* Slight indent to show hierarchy */
    width: calc(100% - 10px);
    animation: slideDown 0.2s ease-out;
}

.dropdown-content.hidden {
    display: none !important;
}

.sub-btn {
    border: none;
    background: transparent;
    padding: 8px 15px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.sub-btn::before {
    display: none; /* Remove standard nav chevron */
}

.sub-btn:hover, .sub-btn.active {
    background: rgba(255, 0, 0, 0.05);
    color: var(--text-white);
    border-left: 2px solid var(--alert);
}

@keyframes slideDown {
    0% { opacity: 0; transform: translateY(-5px); }
    100% { opacity: 1; transform: translateY(0); }
}