/* ===============================================
   OpenClaw Book - Custom Styles
   Desktop & Mobile Responsive Optimizations
   =============================================== */

/* ==================== Desktop Styles ==================== */

/* Content Width & Typography */
.content {
    max-width: 900px !important;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 17px;
    line-height: 1.8;
}

/* Paragraph Spacing */
.content p {
    margin-bottom: 1.2em;
}

/* Headings - Better Visual Hierarchy */
.content h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: #2c3e50;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.3em;
}

.content h2 {
    font-size: 1.8em;
    font-weight: 600;
    color: #34495e;
    margin-top: 1.3em;
    margin-bottom: 0.6em;
    border-bottom: 2px solid #95a5a6;
    padding-bottom: 0.2em;
}

.content h3 {
    font-size: 1.4em;
    font-weight: 600;
    color: #555;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}

.content h4 {
    font-size: 1.2em;
    font-weight: 500;
    color: #666;
    margin-top: 1em;
    margin-bottom: 0.4em;
}

/* Code Blocks */
.content pre {
    font-size: 14px;
    line-height: 1.5;
    border-radius: 8px;
    padding: 1em;
    margin: 1.5em 0;
    overflow-x: auto;
}

.content code {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
}

.content :not(pre) > code {
    background-color: #f0f0f0;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #c7254e;
}

/* Tables - Beautiful Styling */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.content table thead {
    background-color: #3498db;
    color: white;
}

.content table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.content table td {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}

/* Zebra Striping */
.content table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Hover Effect */
.content table tbody tr:hover {
    background-color: #e8f4f8;
    transition: background-color 0.2s ease;
}

/* Blockquotes - Base Style */
.content blockquote {
    margin: 1.5em 0;
    padding: 1em 1.2em;
    border-left: 5px solid #ccc;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-style: normal;
}

/* AI Callout Boxes with Emoji */
.content blockquote.callout-tip {
    background-color: #e7f3ff;
    border-left-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.content blockquote.callout-error {
    background-color: #fff4e6;
    border-left-color: #e67e22;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.15);
}

.content blockquote.callout-learn {
    background-color: #e8f8f5;
    border-left-color: #27ae60;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.15);
}

.content blockquote strong:first-child {
    display: block;
    margin-bottom: 0.5em;
    font-size: 1.05em;
}

/* Links */
.content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s ease;
}

.content a:hover {
    border-bottom-color: #3498db;
}

/* Footnotes */
.content .footnote-definition {
    font-size: 0.9em;
    color: #666;
    border-top: 1px solid #ddd;
    padding-top: 0.5em;
    margin-top: 2em;
}

.content .footnote-definition sup {
    font-weight: bold;
    color: #3498db;
}

/* Lists */
.content ul, .content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.content li {
    margin-bottom: 0.5em;
}


/* ==================== Tablet Styles (768px-1024px) ==================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .content {
        max-width: 700px !important;
        font-size: 16px;
        padding: 0 20px;
    }

    .content h1 {
        font-size: 2em;
    }

    .content h2 {
        font-size: 1.6em;
    }

    .content h3 {
        font-size: 1.3em;
    }

    .content pre {
        font-size: 13px;
    }

    .content table {
        font-size: 0.9em;
    }
}


/* ==================== Mobile Styles (max-width: 768px) ==================== */

@media (max-width: 768px) {
    .content {
        font-size: 15px !important;
        line-height: 1.7;
        padding: 0 16px !important;
    }

    /* Headings - Smaller on Mobile */
    .content h1 {
        font-size: 1.8em;
        margin-top: 1.2em;
    }

    .content h2 {
        font-size: 1.5em;
        margin-top: 1em;
    }

    .content h3 {
        font-size: 1.3em;
        margin-top: 0.9em;
    }

    .content h4 {
        font-size: 1.1em;
    }

    /* Code Blocks - Horizontal Scroll */
    .content pre {
        font-size: 13px !important;
        padding: 0.8em;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables - Horizontal Scroll */
    .content table {
        display: block;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85em;
    }

    .content table th,
    .content table td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* Images - Responsive */
    .content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Sidebar Width */
    .sidebar {
        max-width: 280px;
    }

    /* Blockquotes - Smaller Padding */
    .content blockquote {
        padding: 0.8em 1em;
        margin: 1em 0;
    }

    /* Lists - Less Indent */
    .content ul, .content ol {
        padding-left: 1.5em;
    }
}


/* ==================== Dark Theme Support ==================== */

.navy .content h1,
.coal .content h1,
.ayu .content h1 {
    color: #9eb7d4;
    border-bottom-color: #3498db;
}

.navy .content h2,
.coal .content h2,
.ayu .content h2 {
    color: #b8c5d6;
    border-bottom-color: #5a6c7d;
}

.navy .content h3,
.coal .content h3,
.ayu .content h3 {
    color: #c0cad6;
}

.navy .content :not(pre) > code,
.coal .content :not(pre) > code,
.ayu .content :not(pre) > code {
    background-color: #2b3e50;
    color: #ff6b9d;
}

.navy .content table thead,
.coal .content table thead,
.ayu .content table thead {
    background-color: #2c3e50;
}

.navy .content table tbody tr:nth-child(even),
.coal .content table tbody tr:nth-child(even),
.ayu .content table tbody tr:nth-child(even) {
    background-color: #1e2736;
}

.navy .content table tbody tr:hover,
.coal .content table tbody tr:hover,
.ayu .content table tbody tr:hover {
    background-color: #2a3f54;
}

.navy .content blockquote,
.coal .content blockquote,
.ayu .content blockquote {
    background-color: #1e2736;
    border-left-color: #5a6c7d;
}

.navy .content blockquote.callout-tip,
.coal .content blockquote.callout-tip,
.ayu .content blockquote.callout-tip {
    background-color: #1a2835;
    border-left-color: #3498db;
}

.navy .content blockquote.callout-error,
.coal .content blockquote.callout-error,
.ayu .content blockquote.callout-error {
    background-color: #2a2218;
    border-left-color: #e67e22;
}

.navy .content blockquote.callout-learn,
.coal .content blockquote.callout-learn,
.ayu .content blockquote.callout-learn {
    background-color: #1a2822;
    border-left-color: #27ae60;
}


/* ==================== Print Styles ==================== */

@media print {
    .content {
        max-width: 100% !important;
        font-size: 12pt;
        line-height: 1.5;
    }

    .content h1 {
        page-break-after: avoid;
        font-size: 24pt;
    }

    .content h2 {
        page-break-after: avoid;
        font-size: 18pt;
    }

    .content h3 {
        page-break-after: avoid;
        font-size: 14pt;
    }

    .content pre {
        page-break-inside: avoid;
        border: 1px solid #ddd;
    }

    .content table {
        page-break-inside: avoid;
    }

    .content a {
        color: #000;
        text-decoration: underline;
    }

    .content a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    /* Hide navigation elements */
    .sidebar,
    .nav-chapters,
    .mobile-nav-chapters {
        display: none !important;
    }
}
