/* HowTo by Behixo - Frontend Styles */
:root {
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --primary: #0066ff;
    --primary-hover: #0052cc;
    --accent: #ff4500;
    --text: #1a1a1b;
    --text-secondary: #576f76;
    --text-muted: #878a8c;
    --border: #e0e4e8;
    --border-hover: #ccc;
    --tag-bg: #edf2ff;
    --tag-text: #0066ff;
    --success: #46d160;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --container: 1200px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

/* Header */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 0;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav > a {
    padding: 8px 14px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.site-nav > a:hover { background: var(--bg); color: var(--text); }

.nav-dropdown { position: relative; }

.nav-dropdown-toggle {
    padding: 8px 14px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
}

.nav-dropdown-toggle:hover { background: var(--bg); color: var(--text); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    width: 420px;
    padding: 8px;
    z-index: 60;
    flex-wrap: wrap;
}

.nav-dropdown:hover .nav-dropdown-menu { display: flex; }

.nav-dropdown-menu a {
    width: 50%;
    box-sizing: border-box;
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.85rem;
}

.nav-dropdown-menu a:hover { background: var(--bg); color: var(--primary); }

.header-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0 4px 0 14px;
    transition: border-color 0.2s;
}

.header-search:focus-within { border-color: var(--primary); }

.header-search input {
    border: none;
    background: none;
    padding: 8px 0;
    font-size: 0.85rem;
    width: 200px;
    outline: none;
    font-family: var(--font);
}

.header-search button {
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.header-search button:hover { color: var(--primary); }

/* Page layout */
.site-main { padding: 24px 0 60px; }

.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

.main-content { min-width: 0; }

/* Hero */
.hero-section {
    background: linear-gradient(135deg, #0066ff 0%, #5b8def 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 24px;
}

.hero-section h1 { font-size: 1.8rem; margin-bottom: 8px; }
.hero-section p { font-size: 1rem; opacity: 0.9; }

/* Post Cards - Reddit/chat style */
.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.post-card-category {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.post-card-date, .post-card-views { color: var(--text-muted); }

.post-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--primary); }

.post-card-excerpt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

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

.read-more {
    color: var(--primary);
    font-weight: 500;
}

/* Category header */
.category-header {
    background: linear-gradient(135deg, #0066ff 0%, #5b8def 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 40px;
    margin-bottom: 24px;
}

.category-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.category-desc { color: rgba(255,255,255,0.9); font-size: 1rem; margin-bottom: 8px; }
.result-count { font-size: 0.85rem; color: rgba(255,255,255,0.8); }

/* Search */
.search-header { margin-bottom: 24px; }
.search-header h1 { font-size: 1.5rem; margin-bottom: 16px; }

.search-form-large {
    display: flex;
    gap: 10px;
}

.search-form-large input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.search-form-large input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-form-large .btn { white-space: nowrap; }

/* Post article */
.post-article {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 30px;
}

.post-header { margin-bottom: 24px; }

.post-category-tag {
    display: inline-block;
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.post-header h1 {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 12px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-sep { opacity: 0.5; }

.post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.post-content h2 {
    font-size: 1.4rem;
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.post-content h3 {
    font-size: 1.15rem;
    margin: 20px 0 8px;
}

.post-content p { margin-bottom: 16px; }

.post-content ul, .post-content ol {
    margin: 0 0 16px 24px;
}

.post-content li { margin-bottom: 6px; }

.post-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}

.post-content code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.post-content strong { font-weight: 600; }

.post-source {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Post navigation */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 30px;
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1;
    transition: border-color 0.2s;
}

.post-nav-link:hover {
    border-color: var(--primary);
}

.post-nav-next {
    text-align: right;
}

.post-nav-label {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.post-nav-title {
    font-size: 0.9rem;
    color: var(--text);
}

/* Related posts */
.related-posts { margin-bottom: 30px; }
.related-posts h2 { font-size: 1.2rem; margin-bottom: 16px; }

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.sidebar-widget h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 12px;
}

.category-list, .popular-list {
    list-style: none;
}

.category-list li, .popular-list li {
    border-bottom: 1px solid var(--border);
}

.category-list li:last-child, .popular-list li:last-child { border-bottom: none; }

.category-list a, .popular-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--text);
    font-size: 0.88rem;
}

.category-list a:hover, .popular-list a:hover { color: var(--primary); }

.category-list .count {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Ad slots */
.ad-slot {
    margin: 20px 0;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-leaderboard {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
}

.ad-square {
    width: 300px;
    max-width: 100%;
    min-height: 250px;
    margin: 0 auto 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-link { color: var(--primary); }

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-link:hover { background: var(--bg); border-color: var(--border-hover); color: var(--text); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-dots { padding: 8px 4px; color: var(--text-muted); }

/* Legal pages */
.legal-page {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.legal-page h1 { font-size: 1.6rem; margin-bottom: 4px; }
.legal-date { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; }
.legal-page h2 { font-size: 1.2rem; margin: 24px 0 8px; }
.legal-page h3 { font-size: 1.05rem; margin: 16px 0 6px; }
.legal-page p { margin-bottom: 12px; color: var(--text-secondary); }
.legal-page ul { margin: 0 0 12px 24px; color: var(--text-secondary); }
.legal-page li { margin-bottom: 4px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h1, .empty-state h2 { margin-bottom: 8px; color: var(--text); }

/* Footer */
.site-footer {
    background: #1a1a2e;
    color: #a0a0b8;
    padding: 40px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-brand strong { color: #fff; font-size: 1.1rem; display: block; margin-bottom: 8px; }
.footer-brand p { font-size: 0.85rem; line-height: 1.6; }

.footer-links h4 {
    color: #fff;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.footer-links a {
    display: block;
    color: #a0a0b8;
    font-size: 0.85rem;
    padding: 4px 0;
}

.footer-links a:hover { color: #fff; }

.footer-warning {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
    margin-top: 6px;
    line-height: 1.4;
}
.footer-warning a { color: rgba(255,255,255,0.55); text-decoration: underline; }
.footer-warning a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
    }

    .sidebar { display: none; }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .header-inner { flex-wrap: wrap; gap: 10px; }

    .site-nav { display: none; }

    .header-search {
        margin-left: 0;
        width: 100%;
        order: 3;
    }

    .header-search input { width: 100%; }

    .hero-section { padding: 24px; }
    .hero-section h1 { font-size: 1.3rem; }

    .post-article { padding: 20px; }
    .post-header h1 { font-size: 1.3rem; }

    .search-form-large {
        flex-direction: column;
    }
}

/* Text utilities */
.text-muted { color: var(--text-muted); }
