/* ============================================
 * OpenCan.ai Theme - Unified Stylesheet
 * Version 1.0
 * ============================================ */

/* --- 1. CSS Custom Properties --- */
:root {
    --bg-100: #0a0a0f;
    --bg-200: #12121a;
    --bg-300: #1a1a25;
    --bg-400: #252532;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --border: #27272a;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

/* --- 2. Global Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    background: var(--bg-100);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* --- 3. Typography --- */
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 1rem 0 1rem 1.5rem; }
li { margin-bottom: 0.5rem; }

/* --- 4. Code & Pre Blocks --- */
code {
    background: var(--bg-300);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'SFMono-Regular', Consolas, Monaco, monospace;
    font-size: 0.9em;
    color: #f0abfc;
}
pre {
    background: var(--bg-300);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
    line-height: 1.5;
}
pre code { background: none; padding: 0; color: #e2e8f0; }

/* --- 5. Tables --- */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg-200); font-weight: 600; color: var(--accent-light); }
tr:hover { background: var(--bg-200); }

/* --- 6. Header --- */
.header {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.logo {
    font-size: 1.3rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
}
.logo span { color: var(--accent); }

/* --- 7. Back Link / Button --- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-btn {
    background: var(--bg-300);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
}
.back-btn:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

/* --- 8. Containers --- */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem 1.5rem;
    margin: 0 auto;
}
.content-wrapper {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    gap: 2rem;
}
.main-content { flex: 1; max-width: 900px; }

/* --- 9. Content Box --- */
.content-box {
    background: var(--bg-200);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.content-box h2 {
    color: var(--accent-light);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.content-box p { color: var(--text); margin-bottom: 1rem; }

/* --- 10. Highlight / Alert Boxes --- */
.highlight-box {
    background: var(--bg-200);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.highlight-box h4 { margin-bottom: 0.75rem; color: var(--text); }
.highlight-box ul { margin-top: 0.5rem; }
.highlight-box.warning { border-color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.highlight-box.info { border-color: var(--accent); background: rgba(99, 102, 241, 0.1); }
.highlight-box.success { border-color: var(--success); background: rgba(16, 185, 129, 0.1); }
.highlight-box.error { border-color: var(--error); background: rgba(239, 68, 68, 0.1); }

/* --- 11. TOC --- */
.toc {
    background: var(--bg-200);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}
.toc h3 { margin-top: 0; color: var(--text); margin-bottom: 0.75rem; }
.toc ul { list-style: none; margin-left: 0; }
.toc li { margin-bottom: 0.4rem; }
.toc a { color: var(--text-muted); }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* --- 12. Forms --- */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-300);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group textarea { min-height: 120px; resize: vertical; }

/* --- 13. Buttons --- */
.submit-btn, .btn-primary {
    padding: 0.9rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.submit-btn:hover, .btn-primary:hover { background: var(--accent-light); }
.submit-btn:disabled, .btn-primary:disabled { background: var(--bg-300); cursor: not-allowed; }
.btn-danger {
    padding: 0.9rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background: #dc2626; }

/* --- 14. Status Messages --- */
.form-status {
    text-align: center;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: none;
}
.form-status.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}
.form-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* --- 15. Footer --- */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
.footer a { color: var(--text-muted); text-decoration: none; margin: 0 0.5rem; }
.footer a:hover { text-decoration: underline; }

/* --- 16. Misc --- */
.tagline { color: var(--text-muted); font-size: 1.1rem; }
.subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: 1.1rem; }
.last-updated { color: var(--text-muted); margin-bottom: 2rem; font-size: 0.9rem; }
.version-badge {
    display: inline-block;
    background: var(--bg-300);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* --- 17. Article Layout (ai_* blog pages) --- */
.article {
    background: var(--bg-200);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 2rem;
}
.article h1 { font-size: 2rem; margin-bottom: 1.5rem; color: var(--accent); line-height: 1.3; }
.article h2 { font-size: 1.4rem; margin: 2rem 0 1rem; color: #fff; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.article h3 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; color: var(--accent-light); }
.article p { margin-bottom: 1rem; color: var(--text); }
.article ul, .article ol { margin: 1rem 0 1rem 1.5rem; }
.article li { margin-bottom: 0.5rem; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* --- 18. Sidebar Ads (ai_* blog pages) --- */
.sidebar-ads { width: 300px; flex-shrink: 0; }
.ad-unit {
    background: var(--bg-200);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    min-height: 250px;
    text-align: center;
}
.ad-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.article-ad {
    background: var(--bg-300);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 2rem 0;
    min-height: 100px;
    text-align: center;
}
.sources-list { background: var(--bg-300); padding: 1.5rem; border-radius: 0.5rem; }
.sources-list li { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* --- 19. Responsive --- */
@media (max-width: 1024px) {
    .sidebar-ads { display: none; }
    .content-wrapper { padding: 1rem; }
}
@media (max-width: 768px) {
    .article { padding: 1.25rem; }
    .article h1 { font-size: 1.5rem; }
    .container { padding: 1rem; }
}
