/* Custom CSS for Tapestry documentation */

/* Improve code block appearance */
.highlight {
    background: #f8f8f8 !important;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 0;
    margin: 1em 0;
}

.highlight pre {
    padding: 1em;
    margin: 0;
    overflow-x: auto;
}

/* Better inline code styling */
code.literal {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    padding: 0.1em 0.3em;
    font-size: 0.95em;
    color: #d73a49;
}

/* Improve admonition boxes */
.admonition {
    border-radius: 6px;
    border-left: 4px solid #2980b9;
    background-color: #f0f7ff;
    padding: 12px;
    margin: 1.5em 0;
}

.admonition.note {
    border-left-color: #2980b9;
    background-color: #e7f2ff;
}

.admonition.warning {
    border-left-color: #f0ad4e;
    background-color: #fcf8e3;
}

.admonition.tip {
    border-left-color: #5cb85c;
    background-color: #dff0d8;
}

.admonition.important {
    border-left-color: #d9534f;
    background-color: #f2dede;
}

/* Better parameter and return type formatting */
.sig-param {
    font-style: italic;
}

.sig-return {
    color: #666;
}

.sig-return-icon {
    color: #999;
    margin: 0 0.3em;
}

/* Improve method signature appearance */
.sig {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5em 1em;
    margin-bottom: 1em;
    font-family:
        "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.sig-name {
    color: #0969da;
    font-weight: 600;
}

/* Better table styling */
table.docutils {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

table.docutils th {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table.docutils td {
    border: 1px solid #ddd;
    padding: 8px;
}

table.docutils tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Improve navigation sidebar */
.wy-nav-content {
    max-width: 1200px;
}

.wy-side-nav-search {
    background-color: #2980b9;
}

.wy-side-nav-search > a {
    color: #fff !important;
    font-size: 1.3em;
    font-weight: bold;
}

.wy-side-nav-search input[type="text"] {
    border-color: #2472a4;
}

/* Fix sidebar text visibility */
.wy-menu-vertical a {
    color: #404040 !important;
    padding: 0.5em 1em;
}

.wy-menu-vertical a:hover {
    background-color: #e3f2fd;
    color: #2980b9 !important;
}

.wy-menu-vertical a:active {
    background-color: #2980b9;
    color: #fff !important;
}

.wy-menu-vertical a.current {
    background-color: #e3f2fd;
    color: #2980b9 !important;
    border-right: 3px solid #2980b9;
}

/* Fix sidebar heading visibility */
.wy-menu-vertical p.caption {
    color: #555 !important;
    font-weight: bold;
    margin: 1em 0 0.5em 1em;
}

/* Fix nested menu items */
.wy-menu-vertical li.toctree-l1.current > a {
    background-color: #fcfcfc;
    color: #404040 !important;
    border: none;
    border-top: solid 1px #c9c9c9;
    border-bottom: solid 1px #c9c9c9;
}

.wy-menu-vertical li.toctree-l2 > a {
    color: #404040 !important;
}

.wy-menu-vertical li.toctree-l2.current > a {
    background-color: #e3f2fd;
    color: #2980b9 !important;
}

.wy-menu-vertical li.toctree-l2 a:hover {
    background-color: #d6ebff;
}

.wy-menu-vertical li.toctree-l3 > a {
    color: #666 !important;
}

/* Fix scrollbar in sidebar */
.wy-side-scroll {
    width: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Improve sidebar background */
.wy-nav-side {
    background-color: #fcfcfc;
}

/* Improve example blocks */
.highlight-python,
.highlight-python3 {
    position: relative;
}

.highlight-python::before,
.highlight-python3::before {
    content: "Python";
    position: absolute;
    top: 0;
    right: 0;
    padding: 2px 8px;
    background: #326ce5;
    color: white;
    font-size: 0.8em;
    border-bottom-left-radius: 4px;
}

/* Better API reference formatting */
.class > dt {
    background: #f0f7ff;
    border-left: 3px solid #2980b9;
    padding: 0.5em;
    margin-top: 2em;
}

.method > dt,
.function > dt {
    background: #f8f9fa;
    border-left: 3px solid #6c757d;
    padding: 0.5em;
    margin-top: 1.5em;
}

/* Improve search results */
.search-results {
    padding: 1em;
}

.search-results .context {
    color: #666;
    font-size: 0.9em;
}

/* Better typography */
.rst-content {
    font-size: 16px;
    line-height: 1.6;
}

.rst-content h1 {
    margin-top: 0;
    padding-bottom: 0.3em;
    border-bottom: 2px solid #e1e4e8;
}

.rst-content h2 {
    margin-top: 2em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid #e1e4e8;
}

.rst-content h3 {
    margin-top: 1.5em;
}

/* Improve copy button appearance */
.copybtn {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    opacity: 0.3;
    transition: opacity 0.3s;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 6px;
}

.copybtn:hover {
    opacity: 1;
}

/* Better blockquote styling */
blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1em;
    margin-left: 0;
    color: #666;
    font-style: italic;
}

/* Responsive improvements */
@media screen and (max-width: 768px) {
    .wy-nav-content {
        padding: 1em;
    }

    .rst-content {
        font-size: 14px;
    }
}
