/* Modern Documentation Styles - 2024 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --accent: #8b5cf6;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-code: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-page);
    font-size: 14px;
}

/* Hide header/footer when loaded in iframe */
html.in-iframe .tool-header,
html.in-iframe footer,
html.in-iframe .back-link {
    display: none !important;
}
html.in-iframe main {
    padding-top: 0.5rem !important;
}
html.in-iframe body {
    background: white;
}

/* Tool Header */
.tool-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.tool-header h1 {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.breadcrumb {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
}

.breadcrumb a:hover {
    opacity: 1;
}

.tool-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.category-badge, .library-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.category-badge {
    background: rgba(255,255,255,0.2);
}

.library-badge {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Main Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem 1.5rem;
}

/* Section Cards */
.section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.section h2 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bg-subtle);
}

/* Description */
.description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

/* Usage Notes */
.usage-notes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.usage-notes li {
    position: relative;
    padding: 0.25rem 0 0.25rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.usage-notes li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 600;
}

/* Chat Dialog Examples */
.example {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.625rem;
    border: 1px solid var(--border);
}

.example h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* PROMPT Box */
.prompt-box {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.5rem;
}

.prompt-box strong {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.25rem;
    font-weight: 700;
}

/* CONTEXT Box */
.context-box {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.context-box strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ANSWER Box (THINKING - same style as CONTEXT) */
.answer-box {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.answer-box strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* OUTPUT/RESULT Box */
.output-box {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.output-box strong {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #166534;
    margin-bottom: 0.25rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

/* Details Link */
.details-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: 0.25rem;
}

.details-link:hover {
    text-decoration: underline;
}

/* Technical Details */
.technical-detail {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.technical-detail h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.detail-section {
    margin-bottom: 0.5rem;
}

.detail-section strong {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* Code Blocks */
.code-block {
    background: var(--bg-code);
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Verified Test Output */
.technical-detail[style*="background: #f0fdf4"] {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
    border-color: #86efac !important;
}

/* Technical Reference Section */
.lib-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.lib-doc-link:hover {
    background: var(--primary-dark);
}

/* Parameters Table */
.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.params-table th {
    text-align: left;
    padding: 0.5rem 0.625rem;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}

.params-table td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.params-table tr:hover {
    background: var(--bg-subtle);
}

.param-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.8rem;
}

.param-required {
    color: var(--secondary);
    font-weight: 600;
}

.param-optional {
    color: var(--text-muted);
}

/* Related Tools */
.related-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-tool {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.related-tool:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-subtle);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.back-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Molecule Display */
.molecule-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #fafbfc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.molecule-img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    background: white;
    padding: 0.5rem;
    border: 1px solid var(--border);
}

.molecule-formula {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.result-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    border-left: 3px solid #4caf50;
}

.heteroatom {
    display: inline-block;
    background: #ff5722;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Reaction Display */
.reaction-display {
    margin: 0.75rem 0;
    padding: 1rem;
    background: #fafbfc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-align: center;
}

.reaction-img {
    max-width: 100%;
    max-height: 200px;
}

.reaction-equation {
    font-size: 1rem;
    margin-top: 0.5rem;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .tool-header {
        padding: 1rem;
    }
    
    .tool-header h1 {
        font-size: 1.2rem;
    }
    
    .container {
        padding: 0 0.75rem 1rem;
    }
    
    .section {
        padding: 0.875rem;
    }
}

/* Output example images */
.output-examples {
    margin-top: 1rem;
}

.output-examples h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.output-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.output-gallery figure {
    margin: 0;
    flex: 1 1 280px;
    max-width: 100%;
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.output-gallery figure img {
    width: 100%;
    height: auto;
    display: block;
}

.output-gallery figcaption {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    text-align: center;
    background: #f5f5f5;
    border-top: 1px solid var(--border-color);
}
