/* =========================================
   HACKER / FINDER THEME - PREMIUM v4.0
   Design: Neon Glassmorphism
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-base: #050505;
    --bg-panel-1: #0a0a0a;
    --bg-panel-2: #111111;
    --bg-panel-3: #080808;
    /* Darker reader bg */

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;

    --accent-primary: #00ff9d;
    /* Neon Green */
    --accent-glow: rgba(0, 255, 157, 0.4);
    --accent-dim: rgba(0, 255, 157, 0.1);

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(20, 20, 20, 0.6);

    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg-base);
    background-image: none !important;
    /* Override macOS wallpaper */
    color: var(--text-primary);
    font-family: var(--font-heading);
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

/* --- LAYOUT STRUCTURE --- */
.desktop-area {
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    flex: 1;
    overflow: hidden;
}

.finder-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 80% 20%, #1a1a1a 0%, #050505 60%);
}

.macos-menubar {
    background: #000 !important;
    border-bottom: 1px solid #222;
    z-index: 100;
    justify-content: space-between;
    /* Ensure 3-column layout works */
}

/* Middle Search Bar */
.menubar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    z-index: 101;
    pointer-events: auto;
}

.header-search-bar {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 250px;
    cursor: text;
    transition: all 0.2s;
    color: #888;
    font-family: var(--font-mono);
    font-size: 12px;
}

.header-search-bar:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ccc;
}

.header-search-bar:active,
.header-search-bar.active {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 10px var(--accent-dim);
}

/* --- COLUMN 1: CATEGORIES (Explorer) --- */
.pane-categories {
    width: 260px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.pane-header {
    padding: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 2px;
    border-bottom: var(--glass-border);
}

.mobile-only-header {
    display: none;
}

.category-list {
    list-style: none;
    padding: 15px;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.cat-item {
    padding: 14px 16px;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.cat-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.cat-item.active {
    background: var(--accent-dim);
    color: var(--accent-primary);
    border-color: rgba(0, 255, 157, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.05);
}

.cat-item i {
    font-size: 16px;
    opacity: 0.8;
}


/* --- COLUMN 2: ARTICLE LIST (Selector) --- */
.pane-list {
    width: 380px;
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(20px);
    /* Heavy Blur */
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.article-list {
    overflow-y: auto;
    flex-grow: 1;
}

.article-item {
    padding: 24px;
    border-bottom: var(--glass-border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.article-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.article-item.active {
    background: rgba(255, 255, 255, 0.04);
}

.article-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

.list-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #e0e0e0;
}

.article-item.active .list-title {
    color: #fff;
}

.list-date {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent-primary);
    margin-bottom: 10px;
    display: inline-block;
    background: rgba(0, 255, 157, 0.08);
    /* Pill style */
    padding: 2px 6px;
    border-radius: 4px;
}

.list-summary {
    font-size: 13px;
    color: #888;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* --- COLUMN 3: CONTENT READER (The "Afilli" Part) --- */
.pane-content {
    flex-grow: 1;
    background: var(--bg-panel-3);
    overflow-y: auto;
    position: relative;
    background-image:
        radial-gradient(circle at 10% 10%, rgba(0, 255, 157, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 90%, rgba(0, 255, 157, 0.03) 0%, transparent 20%);
}

.content-wrapper {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 50px;
    min-height: 100%;
    /* Glass Sheet Effect Removed for Full Page */
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    box-sizing: border-box;
}

.article-view-title {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.1;
    /* Gradient Text */
    background: linear-gradient(135deg, #ffffff 0%, #b0b0b0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
}

.article-meta span:hover {
    color: var(--accent-primary);
}

.article-body {
    font-size: 18px;
    line-height: 1.8;
    color: #d0d0d0;
    font-weight: 300;
}

.article-body h2 {
    font-size: 28px;
    color: #fff;
    margin-top: 50px;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.article-body p {
    margin-bottom: 24px;
}

/* Code Blocks */
.article-body pre,
.article-body code {
    font-family: var(--font-mono);
}

.article-body code {
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--accent-primary);
    font-size: 0.9em;
}

/* Reset code inside pre to avoid "box in a box" look */
.article-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    display: block;
    /* Ensure it behaves well with line breaks */
}

.article-body pre {
    background: #0d0d0d;
    border: none;
    border-radius: 0 0 8px 8px;
    /* Rounded bottom only */
    padding: 20px;
    overflow-x: auto;
    color: #e0e0e0;
    margin: 0;
    /* Wrapper handles margin */
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    /* Clickable */
}

/* Code Block Wrapper & Header */
.code-block-wrapper {
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.code-block-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    border-color: var(--accent-primary);
}

.code-header {
    padding: 8px 15px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

/* Language Specific Header Colors */
.code-block-wrapper.lang-powershell .code-header {
    background: #012456;
    /* classic PS blue */
    border-bottom: 1px solid #004080;
}

.code-block-wrapper.lang-linux .code-header {
    background: #333;
    border-bottom: 1px solid #444;
}

.code-block-wrapper.lang-python .code-header {
    background: #1e415e;
    /* Python blue-ish */
    border-bottom: 1px solid #2b5b84;
}

.code-block-wrapper.lang-default .code-header {
    background: #222;
    border-bottom: 1px solid #333;
}

/* Click-to-Copy Overlay Feedback */
.copy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 255, 157, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(2px);
    z-index: 20;
}

.copy-overlay.active {
    opacity: 1;
}

.copy-overlay-text {
    background: var(--accent-primary);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    transform: scale(0.8);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.copy-overlay.active .copy-overlay-text {
    transform: scale(1);
}

/* Hide original copy button as we now click the whole block */
.copy-btn {
    display: none !important;
}

/* Images */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Blockquotes */
.article-body blockquote {
    border-left: 4px solid var(--accent-primary);
    background: linear-gradient(90deg, rgba(0, 255, 157, 0.05) 0%, transparent 100%);
    margin: 30px 0;
    padding: 20px 30px;
    font-style: italic;
    color: #fff;
    border-radius: 0 8px 8px 0;
}


/* --- EMPTY STATE --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #444;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #222;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.empty-state p {
    font-size: 20px;
    font-weight: 300;
}


/* --- SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}


/* --- MOBILE RESPONSE --- */
@media (max-width: 768px) {
    body {
        /* Fix iOS Safari bounce/scroll issues */
        position: fixed;
        width: 100%;
        height: 100%;
        overscroll-behavior: none;
    }

    .finder-layout {
        position: relative;
        height: 100%;
        width: 100%;
        background: #000;
    }

    /* Global Mobile Pane Styles */
    .pane-categories,
    .pane-list,
    .pane-content {
        width: 100% !important;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 10;
        display: none;
        flex-direction: column;
        background: #050505; /* Solid bg for performance & cleanup */
        padding-top: env(safe-area-inset-top); /* Notch support */
    }

    .pane-visible {
        display: flex !important;
        z-index: 50;
        animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    @keyframes slideInRight {
        from { transform: translateX(20px); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    /* --- Headers (Mobile App Bar) --- */
    .pane-header {
        height: 60px; /* Taller for touch */
        padding: 0 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(10, 10, 10, 0.85); /* Glass */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        position: sticky;
        top: 0;
        z-index: 100;
        font-size: 16px; 
        letter-spacing: 0.5px;
        color: #fff;
    }

    .mobile-only-header {
        display: flex; /* Show in mobile */
    }

    .header-title-truncate {
        font-size: 14px;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 60%;
        color: #e0e0e0;
    }

    .mobile-back-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        color: var(--accent-primary);
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
        padding: 8px 12px 8px 0; /* Touch area */
    }

    /* --- Category Pane Overhaul --- */
    .pane-categories {
        background: linear-gradient(180deg, #111 0%, #000 100%);
    }

    .category-list {
        padding: 20px;
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 Column Grid */
        gap: 15px;
        align-content: start;
    }

    .cat-item {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 20px;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 16px;
        margin: 0;
        height: 100px;
        gap: 12px;
    }

    .cat-item i {
        font-size: 24px;
        color: var(--accent-primary);
        background: rgba(0, 255, 157, 0.1);
        padding: 10px;
        border-radius: 10px;
    }

    .cat-item span {
        font-size: 14px;
        font-weight: 600;
    }

    .cat-item.active {
        background: rgba(0, 255, 157, 0.1);
        border-color: var(--accent-primary);
    }
    
    .cat-item.active i {
        background: transparent;
    }

    /* --- List Pane Overhaul --- */
    .pane-list {
        background: #080808;
    }

    .article-list {
        padding: 0;
    }

    .article-item {
        padding: 20px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .list-title {
        font-size: 17px;
        margin-bottom: 6px;
    }

    .list-summary {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    .list-date {
        font-size: 11px;
        opacity: 0.7;
    }

    /* --- Content Pane Overhaul --- */
    .pane-content {
        background: #000;
    }

    .content-wrapper {
        padding: 24px 20px 80px 20px; /* Bottom padding for safety */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .article-view-title {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 15px;
    }

    .article-meta {
        flex-wrap: wrap;
        gap: 15px;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .article-body {
        font-size: 17px; /* Optimal reading size */
        line-height: 1.6; 
    }
    
    .article-body p {
        margin-bottom: 20px;
    }

    .article-body img {
        margin: 20px -20px; /* Full width images */
        width: calc(100% + 40px);
        max-width: calc(100% + 40px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .macos-menubar {
        display: none !important; /* Hide desktop top bar */
    }
}