/* ===== TheEverythingBlog - Compact Responsive Design ===== */

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-hover: #1a1a1a;
    --text: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    --accent: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --header-height: 56px;
    --sidebar-width: 220px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }

/* ===== Layout ===== */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10,10,10,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 0 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.menu-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text);
    position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    left: 0;
}

.menu-toggle span::before { top: -5px; }
.menu-toggle span::after { bottom: -5px; }

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
}

.logo-text span {
    color: var(--text-secondary);
    font-weight: 400;
}

.header-search {
    flex: 1;
    max-width: 300px;
    position: relative;
    display: none;
}

.header-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 13px;
    outline: none;
}

.header-search input:focus {
    border-color: var(--border-hover);
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.search-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text-secondary);
}

.search-toggle svg {
    width: 18px;
    height: 18px;
}

/* Search active state (mobile) */
.header.search-active .header-search {
    display: block;
    position: absolute;
    left: 16px;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    max-width: none;
}

.header.search-active .logo,
.header.search-active .menu-toggle,
.header.search-active .search-toggle {
    display: none;
}

/* ===== Sidebar ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg);
    border-right: 1px solid var(--border);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.2s;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-nav {
    padding: 70px 12px 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: 0.15s;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text);
}

.nav-link.active {
    background: var(--accent);
    color: var(--bg);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-link .cat-emoji {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 11px;
    background: var(--bg-card);
    border-radius: 10px;
}

.nav-link.active .nav-badge {
    background: rgba(0,0,0,0.2);
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.nav-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    padding: calc(var(--header-height) + 16px) 16px 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Hero ===== */
.hero {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    margin-bottom: 24px;
    text-align: center;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10,10,10,0.9) 0%, rgba(10,10,10,0.7) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.hero h1 {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
}

.hero p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto 20px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Section ===== */
.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.section-link {
    font-size: 13px;
    color: var(--text-secondary);
    transition: 0.15s;
}

.section-link:hover {
    color: var(--text);
}

/* ===== Article Cards Grid ===== */
.articles-grid,
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.article-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: 0.2s;
}

.article-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.card-image {
    aspect-ratio: 16/10;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 12px;
    background: var(--bg-hover);
    overflow: hidden;
}

.card-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .card-image img {
    transform: scale(1.05);
}

.card-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    pointer-events: none;
}

.card-category {
    position: relative;
    z-index: 2;
    padding: 4px 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.card-content {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    margin-top: auto;
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Featured card */
.article-card.featured {
    grid-column: span 1;
}

/* ===== Categories Grid ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: 0.2s;
}

.category-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.category-card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.category-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-card-image img {
    transform: scale(1.05);
}

.category-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.category-card-content {
    padding: 14px;
    text-align: center;
}

.category-emoji {
    font-size: 24px;
    display: block;
    margin-bottom: 6px;
}

.category-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.category-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 24px;
}

.page-header-hero {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 48px 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header-bg {
    position: absolute;
    inset: 0;
}

.page-header-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10,10,10,0.85) 0%, rgba(10,10,10,0.7) 100%);
}

.page-header-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.page-emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Load More ===== */
.load-more {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.btn-load-more {
    padding: 12px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 24px;
    transition: 0.2s;
}

.btn-load-more:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

/* ===== Empty/Error State ===== */
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state h2,
.error-state h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

.empty-state p,
.error-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--accent);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
}

/* ===== Article Page ===== */
.article-page {
    max-width: 800px;
    margin: 0 auto;
}

.article-hero {
    position: relative;
    aspect-ratio: 21/9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    background: var(--bg-card);
}

.article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 50%);
}

.article-header {
    margin-bottom: 32px;
}

.article-category-link {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
    transition: 0.15s;
}

.article-category-link:hover {
    background: var(--bg-hover);
}

.article-title {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.meta-sep {
    color: var(--text-muted);
}

/* Article Body */
.article-body {
    font-size: 16px;
    line-height: 1.8;
}

.article-intro {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.article-intro p {
    margin-bottom: 16px;
}

.article-intro p:last-child {
    margin-bottom: 0;
}

/* Table of Contents */
.article-toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 32px;
}

.article-toc h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.article-toc ul {
    padding-left: 0;
}

.article-toc li {
    margin-bottom: 8px;
}

.article-toc a {
    color: var(--text-secondary);
    font-size: 14px;
    transition: 0.15s;
}

.article-toc a:hover {
    color: var(--text);
}

/* Article Sections */
.article-section {
    margin-bottom: 40px;
}

.article-section h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-top: 16px;
}

.article-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
}

.article-section p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.article-section ul,
.article-section ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article-section li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.article-section ul li {
    list-style: disc;
}

.article-section ol li {
    list-style: decimal;
}

/* Article Highlights */
.article-highlight {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    border-left: 3px solid;
}

.article-highlight.info {
    background: rgba(96, 165, 250, 0.1);
    border-color: #60a5fa;
}

.article-highlight.tip {
    background: rgba(74, 222, 128, 0.1);
    border-color: #4ade80;
}

.article-highlight.warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
}

.article-highlight strong {
    display: block;
    margin-bottom: 8px;
}

.article-highlight p {
    margin: 0;
}

.article-highlight ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

/* Article Table */
.article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.article-table th,
.article-table td {
    padding: 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.article-table th {
    background: var(--bg-card);
    font-weight: 600;
}

.article-table td {
    color: var(--text-secondary);
}

/* Formula/Example Box */
.formula-box,
.example-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 20px 0;
    font-size: 14px;
}

.formula-box p,
.example-box p {
    margin-bottom: 8px;
}

.formula-box p:last-child,
.example-box p:last-child {
    margin-bottom: 0;
}

/* FAQs */
.article-faqs {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.article-faqs h2 {
    font-size: 22px;
    margin-bottom: 24px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}

.faq-item h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.faq-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Conclusion */
.article-conclusion {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.article-conclusion h2 {
    font-size: 22px;
    margin-bottom: 16px;
}

.article-conclusion p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Related Articles */
.related-articles {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.related-articles h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

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

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

/* ===== Selection ===== */
::selection {
    background: var(--accent);
    color: var(--bg);
}

/* ===== Responsive - Tablet ===== */
@media (min-width: 640px) {
    .header-search {
        display: block;
    }

    .search-toggle {
        display: none;
    }

    .hero {
        padding: 48px 32px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .main {
        padding: calc(var(--header-height) + 24px) 24px 48px;
    }

    .article-card.featured {
        grid-column: span 2;
    }

    .article-card.featured .card-image {
        aspect-ratio: 21/9;
    }

    .article-card.featured .card-title {
        font-size: 18px;
    }
}

/* ===== Responsive - Desktop ===== */
@media (min-width: 1024px) {
    .menu-toggle {
        display: none;
    }

    .sidebar {
        transform: translateX(0);
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
    }

    .sidebar-nav {
        padding-top: 20px;
    }

    .main {
        margin-left: var(--sidebar-width);
        padding: calc(var(--header-height) + 32px) 32px 64px;
    }

    .hero {
        padding: 60px 48px;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* ===== Responsive - Large ===== */
@media (min-width: 1280px) {
    .header-search {
        max-width: 400px;
    }

    .main {
        max-width: 1100px;
    }
}

/* ===== Sidebar open body lock ===== */
body.sidebar-open {
    overflow: hidden;
}

/* ===== Print ===== */
@media print {
    .header, .sidebar, .sidebar-overlay {
        display: none !important;
    }

    .main {
        margin: 0;
        padding: 20px;
    }
}
