/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --teal: #2bbcc0;
    --teal-dark: #1e9a9d;
    --teal-bg: rgba(43, 188, 192, 0.1);
    --navy: #1e3a5f;
    --navy-light: #2d4a6f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-light: #334155;
    --border-medium: #475569;
    --teal: #2bbcc0;
    --teal-dark: #3dd4d8;
    --teal-bg: rgba(43, 188, 192, 0.15);
    --navy: #0f172a;
    --navy-light: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

a {
    color: var(--teal);
    text-decoration: none;
    transition: color 0.2s ease;
}

    a:hover {
        color: var(--teal-dark);
    }

img {
    max-width: 100%;
    height: auto;
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

    .nav-brand:hover {
        color: var(--text-primary);
    }

    .nav-brand svg {
        width: 30px;
        height: 30px;
        color: var(--teal);
    }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

    .nav-link:hover {
        color: var(--teal);
    }

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

    .theme-toggle:hover {
        border-color: var(--teal);
        color: var(--teal);
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }

/* Mobile Nav */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

    .nav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        transition: all 0.3s ease;
    }

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-light);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

        .nav-menu.open {
            display: flex;
        }
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    padding: 4rem 0;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-weight: 600;
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
}

.hero p,
.hero-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ===== SEARCH ===== */
.search-container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-box {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
}

    .search-box svg {
        width: 20px;
        height: 20px;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .search-box input {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 1rem;
        color: var(--text-primary);
        outline: none;
    }

        .search-box input::placeholder {
            color: var(--text-muted);
        }

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s ease;
}

    .search-result-item:last-child {
        border-bottom: none;
    }

    .search-result-item:hover {
        background: var(--bg-hover);
    }

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.search-result-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== SECTIONS ===== */
.section {
    padding: 3.5rem 0;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* ===== CATEGORY CARDS ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

    .category-card:hover {
        border-color: var(--teal);
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

.category-icon {
    width: 48px;
    height: 48px;
    background: var(--teal-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--teal);
}

    .category-icon svg {
        width: 24px;
        height: 24px;
    }

.category-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.category-count {
    font-size: 0.85rem;
    color: var(--teal);
    font-weight: 500;
}

/* ===== GUIDE CARDS ===== */
.guides-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .guide-card:hover {
        border-color: var(--teal);
    }

.guide-card-content {
    flex: 1;
}

.guide-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--teal);
    background: var(--teal-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.guide-card h3,
.guide-card h4 {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.guide-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.guide-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

    .guide-meta svg {
        width: 15px;
        height: 15px;
    }

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 2rem 0;
    text-align: center;
}

    .footer p {
        color: var(--text-secondary);
        font-size: 0.9rem;
    }

    .footer a {
        color: var(--teal);
    }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

    .empty-state svg {
        width: 48px;
        height: 48px;
        color: var(--text-muted);
        margin-bottom: 1rem;
    }

    .empty-state h3 {
        color: var(--text-primary);
        margin-bottom: 0.5rem;
    }

/* ===== LOADING ===== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 404 PAGE ===== */
.not-found {
    text-align: center;
    padding: 6rem 2rem;
}

    .not-found h1 {
        font-size: 6rem;
        font-weight: 700;
        color: var(--teal);
        margin-bottom: 1rem;
    }

    .not-found h2 {
        font-size: 1.5rem;
        color: var(--text-primary);
        margin-bottom: 1rem;
    }

    .not-found p {
        color: var(--text-secondary);
        margin-bottom: 2rem;
    }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--teal);
    color: #ffffff;
}

    .btn-primary:hover {
        background: var(--teal-dark);
        color: #ffffff;
    }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

    .btn-outline:hover {
        border-color: var(--teal);
        color: var(--teal);
    }

/* ===== HERO SMALL ===== */
.hero-sm {
    padding: 2.5rem 0;
    text-align: left;
}

    .hero-sm h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

    .back-link:hover {
        color: #ffffff;
    }

    .back-link svg {
        width: 16px;
        height: 16px;
    }

.hero-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.hero-icon {
    width: 64px;
    height: 64px;
    background: rgba(43, 188, 192, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    flex-shrink: 0;
}

    .hero-icon svg {
        width: 32px;
        height: 32px;
    }

.hero-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

    .hero-meta span {
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

/* ===== GUIDE DETAIL ===== */
.guide-container {
    max-width: 900px;
}

.guide-content-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.guide-main-image {
    margin: -2.5rem -2.5rem 2rem -2.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
}

    .guide-main-image img {
        width: 100%;
        height: auto;
        display: block;
    }

.guide-content {
    line-height: 1.8;
    font-size: 1.05rem;
}

    .guide-content h2 {
        margin-top: 2.5rem;
        margin-bottom: 1rem;
        font-size: 1.5rem;
        color: var(--text-primary);
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--border-light);
    }

    .guide-content h3 {
        margin-top: 2rem;
        margin-bottom: 0.75rem;
        font-size: 1.25rem;
        color: var(--text-primary);
    }

    .guide-content p {
        margin-bottom: 1.25rem;
    }

    .guide-content ul,
    .guide-content ol {
        margin-bottom: 1.25rem;
        padding-left: 1.5rem;
    }

    .guide-content li {
        margin-bottom: 0.5rem;
    }

    .guide-content table {
        width: 100%;
        border-collapse: collapse;
        margin: 1.5rem 0;
        font-size: 0.95rem;
    }

    .guide-content th,
    .guide-content td {
        padding: 0.75rem 1rem;
        border: 1px solid var(--border-light);
        text-align: left;
    }

    .guide-content th {
        background: var(--bg-secondary);
        font-weight: 600;
    }

    .guide-content img {
        max-width: 100%;
        height: auto;
        border-radius: var(--radius-md);
        margin: 1.5rem 0;
        box-shadow: var(--shadow-md);
    }

    .guide-content pre,
    .guide-content code {
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        font-family: 'Consolas', 'Monaco', monospace;
        font-size: 0.9rem;
    }

    .guide-content code {
        padding: 0.2rem 0.4rem;
    }

    .guide-content pre {
        padding: 1rem;
        overflow-x: auto;
        margin: 1.5rem 0;
    }

        .guide-content pre code {
            padding: 0;
            background: none;
        }

.guide-images {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-light);
}

.guide-image-item {
    margin-bottom: 2.5rem;
}

    .guide-image-item:last-child {
        margin-bottom: 0;
    }

.guide-image-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.guide-image-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

    .guide-image-wrapper img {
        width: 100%;
        height: auto;
        display: block;
    }

.guide-image-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

    .guide-image-description p {
        margin-bottom: 0.75rem;
    }

        .guide-image-description p:last-child {
            margin-bottom: 0;
        }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero {
        padding: 3rem 0;
    }

        .hero h1 {
            font-size: 1.85rem;
        }

    .section {
        padding: 2.5rem 0;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .guide-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .guide-meta {
        margin-left: 0;
        margin-top: 0.75rem;
    }

    .hero-sm h1 {
        font-size: 1.5rem;
    }

    .hero-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .hero-icon {
        width: 56px;
        height: 56px;
    }

    .guide-content-wrapper {
        padding: 1.5rem;
        border-radius: var(--radius-md);
    }

    .guide-main-image {
        margin: -1.5rem -1.5rem 1.5rem -1.5rem;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .guide-content {
        font-size: 1rem;
    }
}
