/* =============================================
   ARMOR Docs — Layout & Markdown Styles
   ============================================= */

/* Override body padding from styles.css — docs has its own layout container */
body {
    padding-top: 0;
}

/* Reduce background contrast for readability over a busier image */
:root {
    --bg-opacity: 0.45;
    --bg-tint-opacity: 0.55;
    --bg-image-tint-opacity: 1.0;
}

/* Override background image from styles.css */
body::before {
    background-image:
        linear-gradient(rgba(var(--bg-image-tint), var(--bg-image-tint-opacity)), rgba(var(--bg-image-tint), var(--bg-image-tint-opacity))),
        url("images/colgante.jpeg");
    background-blend-mode: multiply;
}

/* Two-column layout fills viewport below fixed navbar */
.docs-layout {
    min-height: 100svh;
    padding-top: calc(96px + env(safe-area-inset-top, 0px));
    padding-bottom: 3rem;
    margin-left: 220px;
    transition: margin-left 0.3s ease;
}

/* ---- Sidebar ---- */
.docs-sidebar {
    position: fixed;
    top: calc(80px + env(safe-area-inset-top, 0px));
    left: 0;
    bottom: 0;
    width: 220px;
    background: rgba(19, 17, 49, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 24px 24px 0;
    overflow-y: auto;
    padding: 1rem 0.75rem 1.5rem;
    z-index: 200;
    transition: transform 0.3s ease;
}

/* Sidebar hidden state — toggled via JS */
body.sidebar-hidden .docs-sidebar {
    transform: translateX(-220px);
}

body.sidebar-hidden .docs-layout {
    margin-left: 0;
}

body.sidebar-hidden .footer {
    margin-left: 0;
}

/* Footer also needs to shift with the sidebar */
.footer {
    margin-left: 220px;
    transition: margin-left 0.3s ease;
}

/* Section group heading (e.g. "Tutorials") */
.docs-sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem 0.75rem 0.25rem;
    margin: 0;
}

/* Topic links within a section */
.docs-sidebar a {
    display: block;
    padding: 0.4rem 0.75rem 0.4rem 1.25rem;
    border-radius: 8px;
    color: var(--muted-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.docs-sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.docs-sidebar a.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #34c759;
}

/* ---- Content panel ---- */
.docs-content {
    padding: 2rem 2.5rem;
    min-width: 0;
}

/* ---- Markdown content styling (scoped) ---- */
.docs-content h1 {
    color: var(--text-color);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.docs-content h2 {
    color: var(--text-color);
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.docs-content h3,
.docs-content h4 {
    color: var(--muted-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.docs-content p {
    color: var(--text-color);
    line-height: 1.7;
}

.docs-content ul,
.docs-content ol {
    color: var(--text-color);
    line-height: 1.7;
    padding-left: 1.5rem;
}

.docs-content li {
    margin-bottom: 0.25rem;
}

.docs-content a {
    color: #34c759;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-content a:hover {
    color: #65e57f;
}

.docs-content code {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.875em;
    color: #65e57f;
}

.docs-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.docs-content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    color: #e2e8f0;
}

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.docs-content th,
.docs-content td {
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.5rem 0.75rem;
    text-align: left;
    color: var(--text-color);
}

.docs-content th {
    background: rgba(52, 199, 89, 0.4);
    color: #34c759;
    font-weight: 600;
}

.docs-content tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}

.docs-content blockquote {
    border-left: 3px solid #34c759;
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    color: var(--muted-color);
    background: rgba(52, 199, 89, 0.08);
    border-radius: 0 8px 8px 0;
}

.docs-content hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

/* ---- Prev / Next footer ---- */
.docs-nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 1rem;
}

.docs-nav-footer .btn {
    max-width: 48%;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
}

.docs-nav-footer .btn-next {
    text-align: right;
    margin-left: auto;
}

/* ---- Navbar additions ---- */
.nav-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    align-self: center;
    flex-shrink: 0;
}

.nav-docs-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.5rem;
    align-self: center;
    white-space: nowrap;
    color: var(--muted-color);
    font-size: 0.8rem;
    line-height: 1.2;
}

.nav-docs-app {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    background-image: linear-gradient(
        135deg,
        #ddeee8 0%,
        #ffffff 35%,
        #c5dfd5 65%,
        #e8f4f0 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---- Toggle button ---- */
.btn-sidebar-toggle {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 16px;
    z-index: 300;
    background: rgba(48, 48, 50, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* On mobile, move toggle out of the header so it doesn't overlap the wide nav bar */
@media (max-width: 768px) {
    .btn-sidebar-toggle {
        top: calc(16px + env(safe-area-inset-top, 0px));
        left: 16px;
        bottom: auto;
        right: auto;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        z-index: 9999; /* ensure it floats above everything */
    }
    
    .btn-sidebar-toggle i {
        font-size: 1.25rem;
    }
}

/* ---- Tap-outside backdrop (mobile only) ---- */
.docs-sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    /* Show backdrop when sidebar is open */
    body:not(.sidebar-hidden) .docs-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 199; /* just below sidebar (200) */
        background: rgba(0, 0, 0, 0.4);
    }
}

/* ---- Pagination Buttons ---- */
.docs-pagination-btn {
    flex: 1;
    max-width: 48%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    transition: background-color 0.2s, transform 0.2s;
}

.docs-pagination-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    color: inherit;
}

/* ---- Mobile: sidebar hidden by default, same slide behaviour ---- */
@media (max-width: 768px) {
    .docs-layout {
        margin-left: 0;
        padding-top: calc(72px + env(safe-area-inset-top, 0px)); /* space for the top-left toggle */
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); /* space for floating bottom pill */
    }

    .footer {
        margin-left: 0;
    }

    body.sidebar-hidden .docs-sidebar {
        transform: translateX(-220px);
    }

    /* On mobile, show sidebar open means it overlays the content */
    body:not(.sidebar-hidden) .docs-sidebar {
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    .docs-sidebar {
        /* Stop the sidebar edge from covering the bottom floating pill */
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .docs-content {
        padding: 1.5rem 1.25rem;
        max-width: 100%;
    }

    .docs-nav-footer .btn {
        max-width: 100%;
        font-size: 0.875rem;
    }
}

/* This ensures images never overflow their container */
.docs-content img {
    max-width: 69%;
    height: auto;
    display: block; /* Prevents tiny gaps at the bottom of images */
    margin: 0 auto; /* Centers the image if it's smaller than the screen */
}
