/* ============================================================
   Procare Pay Documentation — Shared Stylesheet
   Used by: /doc/index.html, hpp/*, integration-service/*, scheduled-payments/*
   ============================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #313131;
    background-color: #f8f9fa;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
header {
    background-color: #ffffff;
    color: #313131;
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 2rem;
}

header .logo {
    height: 50px;
    width: auto;
}

header .header-content {
    flex: 1;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: #007cba;
    font-weight: 600;
}

header p {
    font-size: 0.95rem;
    color: #555;
    margin: 0;
}

/* ── Content Wrapper ── */
.content-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ── Sidebar Navigation ── */
.sidebar {
    width: 250px;
    background-color: #f8f9fa;
    border-right: 1px solid #eee;
    padding: 2rem 0;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: #e9ecef; }
.sidebar::-webkit-scrollbar-thumb { background: #adb5bd; border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #6c757d; }

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin: 0;
}

.sidebar a {
    display: block;
    color: #313131;
    text-decoration: none;
    padding: 0.75rem 2rem;
    transition: all 0.3s;
    border-left: 4px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar a:hover {
    background-color: #e9ecef;
    border-left-color: #0693e3;
    color: #007cba;
}

.sidebar a.active {
    background-color: #e7f4f9;
    border-left-color: #007cba;
    color: #007cba;
    font-weight: 600;
}

.sidebar .section-header {
    padding: 0.75rem 2rem;
    font-weight: 700;
    color: #007cba;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1rem;
}

.sidebar a.indent   { padding-left: 3rem; }
.sidebar a.indent-2 { padding-left: 4rem; font-size: 0.85rem; }

/* ── Main Content ── */
main {
    flex: 1;
    padding: 3rem 2.5rem;
    overflow-y: auto;
    max-width: none;
}

/* ── Typography ── */
h1 {
    color: #007cba;
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #0693e3;
    font-weight: 600;
}

h2 {
    color: #007cba;
    font-size: 2rem;
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0693e3;
    font-weight: 600;
}

h3 {
    color: #007cba;
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    font-weight: 600;
}

h4 {
    color: #313131;
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
}

p { margin-bottom: 1rem; }

ul, ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

li { margin-bottom: 0.5rem; }

/* ── Links ── */
a {
    color: #0693e3;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #007cba;
    text-decoration: underline;
}

/* ── Code ── */
code {
    background-color: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #c7254e;
}

pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
    border: 1px solid #ddd;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: #fff;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #007cba;
    color: white;
    font-weight: 600;
}

tbody tr:hover { background-color: #f8f9fa; }

td code {
    background-color: #e9ecef;
    color: #495057;
}

/* ── Alert Boxes ── */
.info, .info-box {
    background-color: #e7f4f9;
    border-left: 4px solid #0693e3;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.info strong, .info-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #007cba;
}

.warning, .warning-box {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.warning strong, .warning-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #721c24;
}

.note, .note-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.note strong, .note-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #856404;
}

.success {
    background-color: #d4f4dd;
    border-left: 4px solid #00d084;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.success strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* ── Parameters ── */
.parameter {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
}

.parameter-name {
    font-weight: bold;
    color: #007cba;
}

.required { color: #dc3545; font-size: 0.9em; font-weight: 600; }
.optional  { color: #27ae60; font-size: 0.9em; font-weight: 600; }

/* ── Endpoint & Method Badges ── */
.endpoint {
    background-color: #ecf0f1;
    padding: 1rem;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    margin: 1rem 0;
    font-size: 0.95em;
}

.method {
    background-color: #e67e22;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 3px;
    font-weight: bold;
    display: inline-block;
    margin-right: 0.75rem;
    font-size: 0.85em;
}

.method-get    { background-color: #27ae60; }
.method-post   { background-color: #e67e22; }
.method-put    { background-color: #f39c12; }
.method-delete { background-color: #e74c3c; }

.method-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
    margin-right: 8px;
    color: white;
}

/* ── Code Tabs ── */
.code-tabs-container { margin: 1.5rem 0; }

.code-tabs {
    display: flex;
    border-bottom: 2px solid #0693e3;
    margin-bottom: 0;
    background-color: #ecf0f1;
    border-radius: 5px 5px 0 0;
    overflow: hidden;
}

.code-tab {
    padding: 12px 24px;
    cursor: pointer;
    background-color: #ecf0f1;
    border: none;
    font-size: 14px;
    font-weight: bold;
    color: #313131;
    transition: background-color 0.2s, color 0.2s;
    flex: 1;
    text-align: center;
}

.code-tab:hover { background-color: #d5dbdb; }
.code-tab.active { background-color: #0693e3; color: white; }

.code-content { display: none; }
.code-content.active { display: block; }
.code-content pre { margin-top: 0; border-radius: 0 0 5px 5px; }

/* ── Section Layout ── */
.intro-section {
    margin-bottom: 3rem;
}

.intro-section ul {
    margin-left: 2rem;
}

.section {
    margin-bottom: 3rem;
}

/* ── Quick Links (sub-doc index pages) ── */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.quick-link-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #0693e3;
}

.quick-link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.quick-link-card h3 { color: #007cba; margin: 0.5rem 0; font-size: 1.3em; }
.quick-link-card p  { color: #666; margin-bottom: 15px; font-size: 0.95em; }

.quick-link-card a {
    display: inline-block;
    background-color: #0693e3;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.quick-link-card a:hover { background-color: #007cba; text-decoration: none; }

.category-icon { font-size: 2em; margin-bottom: 5px; }

/* ── Doc List ── */
.doc-list {
    list-style: none;
    margin-left: 0;
}

.doc-list li { margin-bottom: 12px; padding-left: 0; }
.doc-list a  { color: #0693e3; font-size: 1.05em; }
.doc-list a:hover { color: #007cba; }

/* ── Feature Grid (HPP overview) ── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.feature-card {
    background-color: #ffffff;
    padding: 2rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.3s, border-color 0.3s;
    text-align: center;
}

.feature-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: #0693e3; }
.feature-card h4 { margin-top: 0; margin-bottom: 0.75rem; color: #313131; font-size: 1.25rem; font-weight: 700; }
.feature-card p  { color: #555; line-height: 1.6; margin-bottom: 0; }

/* ── System Cards (root portal index) ── */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 2rem 0;
}

.system-card {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #0693e3;
    display: flex;
    flex-direction: column;
}

.system-card:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.system-card .card-icon { font-size: 2.25rem; margin-bottom: 0.75rem; }
.system-card h3 { color: #007cba; margin: 0 0 0.75rem; font-size: 1.3rem; }

.system-card .card-tagline {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0693e3;
    margin-bottom: 0.75rem;
}

.system-card p    { color: #555; font-size: 0.95rem; flex: 1; margin-bottom: 1.25rem; }
.system-card ul   { color: #555; font-size: 0.9rem; margin-left: 1.25rem; margin-bottom: 1.5rem; flex: 1; }
.system-card ul li { margin-bottom: 0.35rem; }

.system-card .card-link {
    display: inline-block;
    background-color: #0693e3;
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s;
    text-align: center;
    align-self: flex-start;
}

.system-card .card-link:hover { background-color: #007cba; text-decoration: none; }

/* ── Navigation Footer (HPP pages) ── */
.nav-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.nav-footer a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #0693e3;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s;
    font-weight: 500;
}

.nav-footer a:hover { background-color: #007cba; text-decoration: none; transform: translateX(4px); }
.nav-footer .nav-prev { margin-right: auto; }
.nav-footer .nav-next { margin-left: auto; }

/* ── Footer ── */
footer {
    background-color: #313131;
    color: #e0e0e0;
    text-align: center;
    padding: 2rem 2.5rem;
    margin-top: auto;
    border-top: 1px solid #ddd;
}

footer p { margin: 0.25rem 0; font-size: 0.9rem; }
footer a { color: #adb5bd; }
footer a:hover { color: #e0e0e0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    header { flex-direction: column; text-align: center; gap: 1rem; }

    .content-wrapper { flex-direction: column; }

    .sidebar {
        width: 100%;
        padding: 1rem 0;
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    .sidebar ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .sidebar li { margin: 0; }

    .sidebar a {
        padding: 0.5rem 1rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: 4px;
    }

    .sidebar a:hover, .sidebar a.active { border-left: none; border-bottom-color: #0693e3; }

    main { padding: 2rem 2.5rem; }
}

@media (max-width: 768px) {
    header { padding: 1rem 1.5rem; }
    header .logo { height: 40px; }
    header h1 { font-size: 1.5rem; }
    header p  { font-size: 0.9rem; }

    main { padding: 1.5rem 2rem; }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    .feature-grid, .quick-links, .system-grid { grid-template-columns: 1fr; }

    table { font-size: 0.9rem; }
    th, td { padding: 0.5rem; }
    pre { padding: 1rem; font-size: 0.85rem; }

    .sidebar ul { flex-direction: column; align-items: stretch; }
    .sidebar a { text-align: left; border-left: 4px solid transparent; border-bottom: none; border-radius: 0; }
    .sidebar a:hover, .sidebar a.active { border-left-color: #0693e3; border-bottom: none; }

    .nav-footer { flex-direction: column; gap: 1rem; }
    .nav-footer a { text-align: center; }
    .nav-footer .nav-prev, .nav-footer .nav-next { margin: 0; }
}

@media (max-width: 480px) {
    header { padding: 1.5rem 1.5rem; }
    main { padding: 1rem 1.5rem; }
    ul, ol { margin-left: 1.5rem; }
    .feature-card { padding: 1rem; }
    .note, .warning, .info, .success { padding: 0.75rem; }
}

/* ── Print ── */
@media print {
    .sidebar, .nav-footer, footer { display: none; }
    .content-wrapper { flex-direction: column; }
    main { max-width: none; padding: 0; }
    header { background: #ffffff; border-bottom: 2px solid #007cba; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    pre { background-color: #f4f4f4; color: #333; border: 1px solid #ddd; page-break-inside: avoid; }
    h2, h3, h4 { page-break-after: avoid; }
    table { page-break-inside: avoid; }
}

/* ── Status Badges (triggered-responses, response-codes) ── */
.status-approved {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background-color: #d4edda;
    color: #155724;
}

.status-declined {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background-color: #f8d7da;
    color: #721c24;
}

.status-error {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background-color: #fff3cd;
    color: #856404;
}

/* ── Search ── */
.search-wrapper {
    position: relative;
    margin-left: auto;
    width: 260px;
    flex-shrink: 0;
}

.search-input-row {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0 0.6rem;
    gap: 0.4rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-row:focus-within {
    border-color: #0693e3;
    box-shadow: 0 0 0 3px rgba(6,147,227,0.15);
    background: #fff;
}

.search-icon {
    width: 16px;
    height: 16px;
    color: #6c757d;
    flex-shrink: 0;
}

#doc-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #313131;
    outline: none;
    min-width: 0;
    font-family: inherit;
}

#doc-search-input::placeholder { color: #adb5bd; }

/* hide browser's native "x" clear button */
#doc-search-input::-webkit-search-cancel-button { display: none; }

.search-shortcut {
    font-size: 0.7rem;
    color: #adb5bd;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    background: #fff;
    flex-shrink: 0;
    cursor: default;
}

.search-input-row:focus-within .search-shortcut { display: none; }

/* Results dropdown */
.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
}

.search-results.open { display: block; }

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.7rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.active {
    background: #e7f4f9;
    text-decoration: none;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #007cba;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-section {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #0693e3;
}

.search-result-snippet {
    font-size: 0.82rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-no-results {
    padding: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
}

/* Overlay backdrop */
#search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
}

#search-overlay.open { display: block; }

/* Responsive: full-width search on small screens */
@media (max-width: 1024px) {
    .search-wrapper {
        width: 100%;
        margin-left: 0;
        margin-top: 0.75rem;
    }
}

@media (max-width: 768px) {
    .search-results { left: 0; right: 0; }
}
