/* CRGI Solutions HSQEMS Documentation - Custom Styles */
/* Forest Green (#228B22) theme for HSQE Management System */
/* Based on ISMS framework - adapted for HSQEMS */

:root {
    /* CRGI Forest Green */
    --md-primary-fg-color: #228B22;
    --md-primary-fg-color--light: #2EA62E;
    --md-primary-fg-color--dark: #1A6B1A;
    --md-accent-fg-color: #228B22;
    --md-accent-fg-color--transparent: rgba(34, 139, 34, 0.1);

    /* Typography colours */
    --md-typeset-a-color: #228B22;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] {
    --md-primary-fg-color: #228B22;
    --md-primary-fg-color--light: #2EA62E;
    --md-primary-fg-color--dark: #1A6B1A;
    --md-accent-fg-color: #2EA62E;
    --md-typeset-a-color: #2EA62E;
}

/* Header */
.md-header {
    background-color: #228B22;
}

/* Navigation tabs */
.md-tabs {
    background-color: #228B22;
}

/* Search bar styling */
.md-search__form {
    background-color: rgba(255, 255, 255, 0.15);
}

.md-search__form:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Navigation - active items */
.md-nav__item--active > .md-nav__link {
    color: #228B22;
}

.md-nav__link:hover {
    color: #228B22;
}

/* Sidebar scrollbar */
.md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background-color: #228B22;
}

/* Admonitions - info/note boxes */
.md-typeset .admonition.info,
.md-typeset details.info {
    border-color: #228B22;
}

.md-typeset .info > .admonition-title,
.md-typeset .info > summary {
    background-color: rgba(34, 139, 34, 0.1);
}

.md-typeset .info > .admonition-title::before,
.md-typeset .info > summary::before {
    background-color: #228B22;
}

/* Admonitions - tip boxes */
.md-typeset .admonition.tip,
.md-typeset details.tip {
    border-color: #4CAF50;
}

/* Admonitions - warning boxes */
.md-typeset .admonition.warning,
.md-typeset details.warning {
    border-color: #FF9800;
}

/* ============================================
   COLLAPSIBLE SIDEBARS - Toggle Buttons
   ============================================ */

/* Toggle buttons container - fixed position bottom right */
.sidebar-toggles {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Toggle button base style */
.sidebar-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #228B22;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    font-size: 20px;
    font-family: sans-serif;
}

.sidebar-toggle:hover {
    background-color: #1A6B1A;
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:focus {
    outline: 2px solid #1A6B1A;
    outline-offset: 2px;
}

.sidebar-toggle.active {
    background-color: #424242;
}

.sidebar-toggle.active:hover {
    background-color: #333333;
}

/* ============================================
   COLLAPSIBLE SIDEBARS - Layout Changes
   ============================================ */

/* Smooth transitions for sidebars */
.md-sidebar {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Hide left sidebar (navigation) */
body.hide-nav .md-sidebar--primary {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
    width: 0 !important;
    min-width: 0 !important;
}

/* Hide right sidebar (TOC) */
body.hide-toc .md-sidebar--secondary {
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    width: 0 !important;
    min-width: 0 !important;
}

/* ============================================
   EXPAND CONTENT AREA - Desktop (>1220px)
   ============================================ */

@media screen and (min-width: 76.25em) {
    body.hide-nav .md-grid,
    body.hide-toc .md-grid,
    body.hide-nav.hide-toc .md-grid {
        max-width: 100% !important;
    }

    body.hide-nav .md-main__inner,
    body.hide-toc .md-main__inner,
    body.hide-nav.hide-toc .md-main__inner {
        max-width: 100% !important;
    }

    body.hide-nav .md-content {
        margin-left: 0 !important;
    }

    body.hide-toc .md-content {
        margin-right: 0 !important;
    }

    body.hide-nav.hide-toc .md-content {
        margin-left: 1rem !important;
        margin-right: 1rem !important;
        max-width: calc(100% - 2rem) !important;
    }

    body.hide-nav.hide-toc .md-content__inner {
        max-width: 100% !important;
        margin: 0 auto;
    }

    body.hide-nav .md-sidebar--primary {
        position: absolute;
        left: -9999px;
    }

    body.hide-toc .md-sidebar--secondary {
        position: absolute;
        right: -9999px;
    }
}

/* ============================================
   EXPAND CONTENT AREA - Tablet (960px - 1220px)
   ============================================ */

@media screen and (min-width: 60em) and (max-width: 76.24em) {
    body.hide-nav .md-grid,
    body.hide-toc .md-grid,
    body.hide-nav.hide-toc .md-grid {
        max-width: 100% !important;
    }

    body.hide-toc .md-sidebar--secondary {
        display: none !important;
    }

    body.hide-nav.hide-toc .md-content {
        margin: 0 1rem !important;
        max-width: calc(100% - 2rem) !important;
    }
}

/* ============================================
   TABLES - Full Width & Zebra Striping
   ============================================ */

.md-typeset table:not([class]) {
    width: 100%;
    display: table;
    border-collapse: collapse;
}

.md-typeset table:not([class]) th {
    background-color: #228B22;
    color: white;
    font-weight: 500;
    padding: 0.75rem 1rem;
    text-align: left;
}

.md-typeset table:not([class]) td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.md-typeset table:not([class]) tbody tr:nth-child(odd) {
    background-color: rgba(34, 139, 34, 0.04);
}

.md-typeset table:not([class]) tbody tr:nth-child(even) {
    background-color: white;
}

.md-typeset table:not([class]) tbody tr:hover {
    background-color: rgba(34, 139, 34, 0.12);
}

.md-typeset__scrollwrap {
    margin: 1rem 0;
    overflow-x: auto;
}

.md-typeset__table {
    display: block;
    width: 100%;
}

/* ============================================
   END TABLES
   ============================================ */

/* Code blocks - inline */
.md-typeset code {
    background-color: rgba(34, 139, 34, 0.1);
    border-radius: 3px;
}

/* Links */
.md-typeset a {
    color: #228B22;
}

.md-typeset a:hover {
    color: #1A6B1A;
}

/* Content tabs */
.md-typeset .tabbed-labels > label:hover {
    color: #228B22;
}

.md-typeset .tabbed-labels > .tabbed-label--active {
    color: #228B22;
    border-color: #228B22;
}

/* Footer */
.md-footer {
    background-color: #424242;
}

.md-footer-meta {
    background-color: #353535;
}

/* Classification banner */
.classification-banner {
    background-color: #228B22;
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: bold;
    margin-bottom: 1rem;
    border-radius: 4px;
}

/* Document metadata styling */
.document-meta {
    background-color: rgba(34, 139, 34, 0.08);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #228B22;
}

.document-meta p {
    margin: 0.25rem 0;
}

/* Status indicators */
.status-active {
    color: #4caf50;
    font-weight: bold;
}

.status-draft {
    color: #ff9800;
    font-weight: bold;
}

.status-archived {
    color: #9e9e9e;
    font-weight: bold;
}

/* Policy reference badges */
.policy-ref {
    display: inline-block;
    background-color: #228B22;
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Procedure step styling */
.procedure-step {
    border-left: 3px solid #228B22;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.procedure-step h4 {
    margin-top: 0;
}

/* Grid cards for homepage */
.grid.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.grid.cards > * {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.grid.cards > *:hover {
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.2);
    border-color: #228B22;
}

/* Embedded HTML iframe styling */
.html-embed {
    width: 100%;
    height: 600px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Mermaid diagram container */
.mermaid {
    text-align: center;
    margin: 1.5rem 0;
}

/* Back to top button */
.md-top {
    background-color: #228B22;
}

.md-top:hover {
    background-color: #1A6B1A;
}

/* Search highlighting */
.md-search-result__meta {
    color: #228B22;
}

.md-search-result mark {
    background-color: rgba(34, 139, 34, 0.3);
}

/* Table of contents - active item */
.md-nav__link--active {
    color: #228B22;
}

/* Print Styles */
@media print {
    body { background: white; }
    .md-header { box-shadow: none; }

    .sidebar-toggles {
        display: none !important;
    }

    .classification-banner {
        background-color: #228B22 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .md-typeset table:not([class]) th {
        background-color: #228B22 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .md-typeset table:not([class]) tbody tr:nth-child(odd) {
        background-color: rgba(34, 139, 34, 0.04) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Custom admonition for mandatory items */
.md-typeset .admonition.mandatory,
.md-typeset details.mandatory {
    border-color: #d32f2f;
}

.md-typeset .mandatory > .admonition-title,
.md-typeset .mandatory > summary {
    background-color: rgba(211, 47, 47, 0.1);
}

.md-typeset .mandatory > .admonition-title::before,
.md-typeset .mandatory > summary::before {
    background-color: #d32f2f;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media screen and (max-width: 76.24em) {
    .sidebar-toggle[data-target="nav"] {
        display: none;
    }
}

@media screen and (max-width: 59.99em) {
    .sidebar-toggles {
        display: none;
    }
}
