/* Design System & Variables */
:root {
    /* Colors */
    --primary-color: #007bff;
    /* Vibrant Blue */
    --primary-dark: #0056b3;
    --secondary-color: #00d4ff;
    /* Cyan accent */
    --bg-dark: #0f172a;
    /* Deep Slate */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Glassy dark */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.1);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #007bff 0%, #00d4ff 100%);
    --gradient-bg: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    background-image: var(--gradient-bg);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

/* Typography Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Glassmorphism Utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Header */
header {
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

header.scrolled {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
}

.nav-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo img {
    height: 50px;
    /* Adjust as needed */
    width: auto;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    padding: calc(var(--header-height) + 2rem) 0 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-bottom: 2.5rem;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.6);
}

/* Categories Grid */
.categories {
    padding: 2rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 212, 255, 0.5);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-muted);
}

/* Latest Articles List */
.latest-articles {
    padding: 2rem 0;
}

.article-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-radius: 12px;
}

.article-content h4 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.article-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.5);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

/* Responsiveness */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Hide for now, can implement mobile menu later */
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 0 1.5rem;
    }
}

/* YouTube Link in Nav */
.youtube-link {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.youtube-link:hover {
    color: #ff0000 !important;
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.4) !important;
}

.youtube-section {
    margin: 1.5rem 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

/* ══════════════════════════════════════
   GLOBAL SEARCH
══════════════════════════════════════ */

/* Search trigger button in nav */
.search-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.search-trigger .search-hint {
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    padding: 1px 6px;
    color: #475569;
    font-family: monospace;
}

/* Full-screen overlay */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(7, 11, 22, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.search-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.search-box {
    width: 100%;
    max-width: 680px;
    padding: 0 1.5rem;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    padding: 14px 20px;
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.05), 0 20px 50px -10px rgba(0, 0, 0, 0.8);
    transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1), 0 20px 50px -10px rgba(0, 0, 0, 0.8);
}

.search-input-wrap i {
    font-size: 1.2rem;
    color: #38bdf8;
}

#global-search-input {
    flex: 1;
    min-width: 0;
    text-overflow: ellipsis;
    background: none;
    border: none;
    outline: none;
    font-size: 1.15rem;
    color: var(--text-main);
    font-family: var(--font-main);
}

#global-search-input::placeholder {
    color: #475569;
}

.search-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.search-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}

/* Results */
.search-results {
    width: 100%;
    max-width: 680px;
    padding: 12px 1.5rem 0;
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-results::-webkit-scrollbar {
    width: 4px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.18s ease;
}

.search-result-item:hover,
.search-result-item.active {
    background: rgba(0, 212, 255, 0.07);
    border-color: rgba(0, 212, 255, 0.2);
    transform: translateX(3px);
}

.result-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(0, 212, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    color: #38bdf8;
}

.result-icon.script {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
}

.result-icon.page {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.result-icon.video {
    background: rgba(249, 115, 22, 0.12);
    color: #fb923c;
}

.result-body {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.result-title mark {
    background: transparent;
    color: #38bdf8;
    font-weight: 700;
}

.result-meta {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.result-type-badge.article {
    background: rgba(0, 212, 255, 0.12);
    color: #38bdf8;
}

.result-type-badge.script {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
}

.result-type-badge.video {
    background: rgba(249, 115, 22, 0.12);
    color: #fb923c;
}

.result-type-badge.page {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.result-cat {
    color: #334155;
}

.result-snippet {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-empty {
    text-align: center;
    padding: 3rem 0;
    color: #475569;
    font-size: 0.95rem;
}

.search-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.search-footer {
    margin-top: 14px;
    display: flex;
    gap: 20px;
    font-size: 0.75rem;
    color: #334155;
}

.search-footer kbd {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 1px 6px;
    font-family: monospace;
    color: #64748b;
    margin-right: 4px;
}

/* ── Mobile Responsiveness ── */
@media (max-width: 768px) {

    /* Header & Logo */
    header {
        height: 65px;
    }

    :root {
        --header-height: 65px;
    }

    .logo {
        gap: 8px;
        font-size: 1.1rem;
        white-space: nowrap;
    }

    .logo img {
        height: 32px;
    }

    /* Hero Section */
    .hero {
        padding: calc(var(--header-height) + 1.5rem) 0 1.5rem;
        min-height: auto;
    }

    .hero h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Sections & Grids */
    .categories,
    .latest-articles,
    .youtube-section {
        padding: 1.5rem 0;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .grid {
        gap: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Search UI tweaks for mobile */
    .search-input-wrap {
        padding: 10px 14px;
        gap: 10px;
    }

    .search-input-wrap input {
        font-size: 1rem;
    }

    #global-search-input::placeholder {
        font-size: 0.95rem;
    }

    .search-footer {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

@media (max-width: 480px) {

    /* For very small devices like iPhone SE */
    .logo {
        font-size: 1rem;
    }

    .logo img {
        height: 28px;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .search-trigger {
        padding: 6px 12px;
    }

    .search-trigger .search-hint {
        display: none;
    }

    /* Hide the Ctrl-K shortcut on small phones */
}