/* --- 1. GLOBAL FONTS & RESET --- */
body, input { 
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
    font-weight: 300; 
}

/* Make bold text pop */
.md-typeset strong, .md-typeset b { 
    font-weight: 800 !important; 
    color: #000 !important; 
}

/* --- 2. HEADER & NAVIGATION --- */
.md-header, .md-tabs { 
    background-color: #004B8D !important; 
    border: none !important; 
}

/* SMART H1 LOGIC */
.hero-text-container + h1, 
.md-content__inner > h1:first-child:has(+ .hero-text-container) {
    display: none !important;
}

/* Style the restored H1 for SOG and Procedure pages */
.md-typeset h1 {
    display: block !important;
    font-size: 1.6rem !important; /* Reduced from 2.2rem */
    line-height: 1.3 !important;  /* Better spacing for multi-line titles */
    font-weight: 800 !important;
    color: #004B8D !important;
    margin-bottom: 0.8rem !important;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.md-header__title, .md-breadcrumb { 
    display: none !important; 
}

.md-header__inner { 
    display: flex !important; 
    align-items: center !important; 
    padding: 0 20px !important; 
}

/* LOGO IN TOP NAV */
.md-header__button.md-logo { 
    margin-right: auto !important; 
}

.md-header__button.md-logo img { 
    filter: brightness(0) invert(1); 
    height: 2.8rem !important; 
}

/* --- 3. SEARCH & DARK MODE (ALIGNED RIGHT) --- */
.md-header__search { 
    width: 340px !important; 
    margin-right: 15px !important; 
    order: 2 !important; 
}

.md-header__option { 
    order: 3 !important; 
    display: flex !important; 
    align-items: center !important; 
}

.md-search__form { 
    background-color: rgba(255,255,255,0.15) !important; 
    border-radius: 24px !important; 
}

.md-search__input { 
    color: white !important; 
    height: 2.2rem !important; 
    padding-left: 2.8rem !important; 
}

/* ECG SEARCH ICON */
.md-search__icon svg { display: none !important; }
.md-search__icon[for="__search"]::before {
    background-color: #FF0000;
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,13H5.79L8,18L13,6L16,13H21V15H15.21L13,10L8,22L5,15H3V13Z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,13H5.79L8,18L13,6L16,13H21V15H15.21L13,10L8,22L5,15H3V13Z"/></svg>');
    content: ""; display: block; width: 1.3rem; height: 1.3rem; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
}

/* --- 4. HERO & LOGO --- */
.hero-text-container {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.hero-logo-small {
    width: 250px !important; 
    display: block;
    margin: 0 auto 15px auto;
}

.hero-welcome {
    font-size: 1.8rem !important;
    font-weight: 800;
    color: #004B8D;
    display: block;
    margin-bottom: 5px;
}

.hero-tagline {
    font-size: 1.1rem;
    font-style: italic;
    color: #666;
    display: block;
}

/* --- 5. SECTION HEADERS (HOME & PROCEDURES) --- */
.md-typeset h2 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #004B8D !important;
    margin-top: 2rem !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* --- 6. CATEGORY LETTERS (SUB-PAGE INDEXES ONLY) --- */
.category-letter {
    display: block !important;
    font-size: 2rem !important;
    font-weight: 900 !important;
    color: #004B8D !important;
    border-bottom: 3px solid #004B8D;
    margin-top: 40px !important;
    margin-bottom: 15px !important;
    padding-bottom: 5px;
}

/* --- 7. INDEX GRID --- */
.index-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px 40px !important;
    margin-bottom: 30px !important;
}

.index-grid a { 
    font-size: 1rem; 
    font-weight: 500; 
    color: #004B8D !important; 
    text-decoration: none !important; 
}


.md-footer, .md-footer-meta { background-color: #004B8D !important; }
.md-copyright { display: none !important; }
.md-footer-meta__inner { 
    display: flex !important; 
    justify-content: center !important; 
    color: white !important; 
    padding: 20px 0 !important; 
}

.md-footer-meta__inner::after { 
    content: "Internal Use Only | © 2026 BC Emergency Health Services"; 
    font-size: 0.85rem; 
}

/* --- 9. SEARCH RESULTS STYLING --- */

/* Decrease the main title in search results */
.md-search-result__article h1 {
    font-size: 1.1rem !important; /* Matches a standard link size */
    font-weight: 700 !important;
    margin-bottom: 0.2rem !important;
    border-bottom: none !important; /* Remove the thick underline from results */
    padding-bottom: 0 !important;
    color: #004B8D !important;
}

/* Decrease the category letters (B, C, etc.) in search results */
.md-search-result__article h2 {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.1rem !important;
    border-bottom: none !important;
    color: #666 !important; /* Use a subtle grey for sub-headers in search */
}

/* Adjust spacing between search items */
.md-search-result__item {
    padding: 10px 0 !important;
    border-bottom: 1px solid #f0f0f0;
}

/* Shrink those tags/keywords in search results */
.md-search-result__meta {
    font-size: 0.75rem !important;
    margin-top: 5px !important;
}

/* Subtle External Link Style */
.external-link {
    color: #004B8D !important;
    text-decoration: underline !important;
    font-weight: 600;
}

.external-link::after {
    content: " ↗"; /* Adds a small arrow so staff know it's external */
    font-size: 0.8rem;
}

/* Center-align tables and prevent them from stretching full-width */
.md-typeset table {
    margin-left: auto !important;
    margin-right: auto !important;
    display: table !important;
    width: auto !important;
}

/* Ensure table headers are also centered if using :---: in Markdown */
.md-typeset th {
    text-align: center !important;
}

/* Indicate that images are clickable/zoomable */
.md-typeset img {
    max-width: 100%;
    height: auto;
    border-radius: 4px; /* Optional: softens the edges of SAR diagrams */
}

.md-typeset img:hover {
    opacity: 0.9;
}

.md-search__input {
    color: rgba(0, 0, 0, 0.87) !important; /* Force black text */
}
[data-md-color-scheme="slate"] .md-search__input {
    color: white !important; /* Keep it white for dark mode users */
}

/* This makes the phone icon red */
.red-icon {
  color: #d32f2f; /* BCEHS Red */
  vertical-align: middle;
}

/* Center alignment for Grid Cards */
.text-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.text-center .md-button {
  margin-top: 10px;
  width: fit-content;
}

/* Force Grid Cards to be identical width and centered */
.grid.cards > ul > li {
    min-width: 320px; /* Adjust this number if you want them wider/narrower */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Ensure the button stays centered within that fixed width */
.grid.cards .md-button {
    margin-left: auto;
    margin-right: auto;
    width: 200px; /* Fixed width for the buttons to match */
}

/* Ensure both cards are the same width */
.grid.cards > ul > li {
    min-width: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Fix the button text stacking and alignment */
.grid.cards .md-button {
    min-width: 220px; /* Forces buttons to be identical width */
    white-space: nowrap; /* Prevents text from wrapping to a second line */
    text-align: center;
    margin-top: 15px;
}


/* Force the grid items to be identical twins */
.grid.cards > ul {
    display: flex !important;
    align-items: stretch !important; /* Forces same height */
    gap: 20px;
}

.grid.cards > ul > li {
    flex: 1; /* Forces same width */
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important; /* Pushes button to bottom */
    padding: 30px !important;
    text-align: center;
}

/* Ensure buttons are identical in size */
.grid.cards .md-button {
    margin: 20px auto 0 auto !important;
    width: 220px !important; /* Fixed width for symmetry */
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make the sidebar look like a clean category menu */
.md-nav__link--active {
    font-weight: bold;
    color: #003366 !important; /* BCEHS Blue */
}

/* Hide the 'Paramedic Specialists' title in the sidebar if it feels redundant */
.md-sidebar--primary .md-nav__title {
    display: none;
}

/* Responsive fix for mobile screens (phones) */
@media screen and (max-width: 76.25em) {
    .grid.cards > ul {
        display: flex !important;
        flex-direction: column !important; /* Stack them vertically */
        align-items: center !important;
    }

    .grid.cards > ul > li {
        width: 100% !important; /* Use the full width of the phone */
        min-width: unset !important; /* Remove the desktop width restriction */
        margin-bottom: 20px;
    }

    .grid.cards .md-button {
        width: 100% !important; /* Make the button easy to tap with a thumb */
        max-width: 300px;
    }
}

/* --- CLINICAL ACCORDION STYLING --- */
details.details {
    border-bottom: 1px solid #eee !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

details.details summary {
    background-color: transparent !important;
    color: #004B8D !important; /* BCEHS Blue */
    font-size: 1.1rem;
    font-weight: 500;
    padding: 15px 0 !important;
}

/* Change the arrow color and position */
details.details summary::after {
    color: #666 !important;
}

/* Remove background color from the expanded content */
details.details[open] {
    background-color: #fafafa;
    padding-bottom: 20px;
}

/* --- Custom PDF Admonition Icon --- */
.md-typeset .pdf > .admonition-title::before,
.md-typeset .pdf > summary::before {
  background-color: #2e7d32; /* Matches the green theme in your photo */
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6m4 18H6V4h7v5h5v11m-10-9h8v2H8v-2m0 4h8v2H8v-2m0 4h5v2H8v-2Z"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6m4 18H6V4h7v5h5v11m-10-9h8v2H8v-2m0 4h8v2H8v-2m0 4h5v2H8v-2Z"/></svg>');
  content: "";
}

/* Optional: Keep the border green to match your screenshot */
.md-typeset .admonition.pdf,
.md-typeset details.pdf {
  border-color: #2e7d32;
}

.md-typeset .pdf > .admonition-title,
.md-typeset .pdf > summary {
  background-color: rgba(46, 125, 50, 0.1);
}

/* --- SEARCH BOX TEXT COLOR FIX --- */
.md-search__input {
    color: white !important;
    /* Fixes text color in Chrome/Edge */
    -webkit-text-fill-color: white !important; 
}

.md-search__input::placeholder {
    /* Makes "Search TangoPulse..." readable but subtle */
    color: rgba(255, 255, 255, 0.7) !important;
}

.md-search__input {
    /* Keeps the blinking typing cursor white */
    caret-color: white !important;
}

/* --- 8. OFFICIAL TOP BUTTON (LEFT ALIGNED) --- */
.md-top {
    left: 20px !important;  /* Pushes it to the left side */
    right: auto !important; /* Disables the default right-side position */
    background-color: #004B8D !important; /* BCEHS Blue */
    color: white !important;
}

/* Ensures the arrow icon inside is white */
.md-top svg {
    fill: white !important;
}