//! CSS styles for markdown content rendering

/// Generate CSS styles for content pages
pub fn get_default_css_styles() -> String {
    r#"
        :root {
            --bg-color: #ffffff;
            --text-color: #333333;
            --border-color: #e5e7eb;
            --blockquote-color: #6b7280;
            --meta-bg: #f9fafb;
            --meta-text: #374151;
            --meta-border: #d1d5db;
        }

        @media (prefers-color-scheme: dark) {
            :root {
                --bg-color: #1f2937;
                --text-color: #f9fafb;
                --border-color: #374151;
                --blockquote-color: #9ca3af;
                --meta-bg: #374151;
                --meta-text: #d1d5db;
                --meta-border: #4b5563;
            }
        }

        html {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            background-color: var(--bg-color);
        }

        body {
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem 1rem;
            font-size: 16px;
        }

        h1, h2, h3, h4, h5, h6 {
            margin-top: 2rem;
            margin-bottom: 1rem;
            font-weight: 600;
            line-height: 1.25;
        }

        h1 { font-size: 2.25rem; }
        h2 { font-size: 1.875rem; }
        h3 { font-size: 1.5rem; }
        h4 { font-size: 1.25rem; }
        h5 { font-size: 1.125rem; }
        h6 { font-size: 1rem; }

        p {
            margin-bottom: 1rem;
            line-height: 1.7;
        }

        a {
            color: #3b82f6;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        blockquote {
            border-left: 4px solid #e5e7eb;
            margin: 1.5rem 0;
            padding-left: 1rem;
            color: var(--blockquote-color);
            font-style: italic;
        }

        code {
            background-color: #f3f4f6;
            padding: 0.125rem 0.25rem;
            border-radius: 0.25rem;
            font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
            font-size: 0.875em;
        }

        pre {
            background-color: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 0.375rem;
            padding: 1rem;
            overflow-x: auto;
            margin: 1rem 0;
        }

        pre code {
            background-color: transparent;
            padding: 0;
            border-radius: 0;
        }

        @media (prefers-color-scheme: dark) {
            code {
                background-color: #374151;
            }
            pre {
                background-color: #1f2937;
                border-color: #374151;
            }
        }

        ul, ol {
            margin-bottom: 1rem;
            padding-left: 2rem;
        }

        li {
            margin-bottom: 0.5rem;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin: 1rem 0;
        }

        th, td {
            border: 1px solid var(--border-color);
            padding: 0.75rem;
            text-align: left;
        }

        th {
            background-color: #f9fafb;
            font-weight: 600;
        }

        @media (prefers-color-scheme: dark) {
            th {
                background-color: #374151;
            }
        }

        img {
            max-width: 100%;
            height: auto;
            border-radius: 0.375rem;
        }

        hr {
            border: none;
            border-top: 1px solid var(--border-color);
            margin: 2rem 0;
        }

        .back-link {
            margin-bottom: 2rem;
            display: block;
        }

        .back-link a {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            text-decoration: none;
            color: #ffffff;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 0.75rem 1.5rem;
            border-radius: 8px;
            font-weight: 500;
            transition: all 0.2s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            border: none;
            cursor: pointer;
        }

        .back-link a:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
            background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
        }

        .back-link a:active {
            transform: translateY(0);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .content-meta {
            background: var(--meta-bg);
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 2rem;
            border: 1px solid var(--meta-border);
        }

        .content-meta strong {
            color: var(--meta-text);
        }

        .enhanced-content-meta {
            background: #f8f9fa;
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 2rem;
            border: 1px solid #e9ecef;
            color: #495057;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .enhanced-content-meta strong {
            color: #212529;
            font-weight: 600;
        }

        @media (prefers-color-scheme: dark) {
            .enhanced-content-meta {
                background: #2d3748;
                border-color: #4a5568;
                color: #cbd5e0;
            }
            .enhanced-content-meta strong {
                color: #f7fafc;
            }
        }

        /* Design system styles for metadata boxes */
        .ds-bg { background: var(--bg-color); }
        .ds-rounded-lg { border-radius: 0.5rem; }
        .ds-shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
        .ds-border { border-color: var(--border-color); }
        .ds-text-muted { color: var(--blockquote-color); }
        .ds-rounded-full { border-radius: 9999px; }

        /* Utility classes for flex and spacing */
        .flex { display: flex; }
        .items-center { align-items: center; }
        .flex-wrap { flex-wrap: wrap; }
        .gap-1 { gap: 0.25rem; }
        .gap-2 { gap: 0.5rem; }
        .gap-4 { gap: 1rem; }
        .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
        .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
        .p-6 { padding: 1.5rem; }
        .mb-3 { margin-bottom: 0.75rem; }
        .mb-6 { margin-bottom: 1.5rem; }
        .text-sm { font-size: 0.875rem; }
        .font-medium { font-weight: 500; }
        .inline-flex { display: inline-flex; }
        .border { border-width: 1px; }
        .cursor-pointer { cursor: pointer; }
        .no-underline { text-decoration: none; }
        .transition-colors { transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; }

        /* Category button styles */
        .bg-blue-500\/10 { background-color: rgba(59, 130, 246, 0.1); }
        .text-blue-400 { color: rgb(96, 165, 250); }
        .border-blue-500\/20 { border-color: rgba(59, 130, 246, 0.2); }

        /* Hover effects */
        a.inline-flex:hover {
            background-color: rgba(59, 130, 246, 0.2);
        }

        /* SVG icon sizing */
        .w-4 { width: 1rem; }
        .h-4 { height: 1rem; }

        @media (max-width: 768px) {
            body {
                padding: 1rem 0.5rem;
            }
        }
    "#.to_string()
}

/// Generate full CSS styles for content pages with enhanced metadata
pub fn get_full_css_styles() -> String {
    format!(
        "{}\n{}",
        get_default_css_styles(),
        get_enhanced_metadata_styles()
    )
}

/// Generate enhanced metadata styles for content pages
fn get_enhanced_metadata_styles() -> String {
    r#"
        /* Enhanced metadata styles for content pages */
        .enhanced-content-meta {
            background: #f8f9fa;
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 2rem;
            border: 1px solid #e9ecef;
            color: #495057;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .enhanced-content-meta strong {
            color: #212529;
            font-weight: 600;
        }

        @media (prefers-color-scheme: dark) {
            .enhanced-content-meta {
                background: #2d3748;
                border-color: #4a5568;
                color: #cbd5e0;
            }
            .enhanced-content-meta strong {
                color: #f7fafc;
            }
        }
    "#
    .to_string()
}
