/* -----------------------------------------------------------
   Global
----------------------------------------------------------- */
body {
    font-size: .875rem;
}

.feather {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
}

.contextual-doc-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .8125rem;
    white-space: nowrap;
}

.contextual-doc-link > a:first-child {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.contextual-doc-link .feather {
    width: 14px;
    height: 14px;
}

.contextual-doc-link-edit {
    color: var(--bs-secondary-color);
    display: inline-flex;
    padding: .15rem;
    border-radius: .2rem;
}

.contextual-doc-link-edit:hover,
.contextual-doc-link-edit:focus-visible {
    color: var(--bs-primary);
    background: var(--bs-tertiary-bg);
}

.contextual-doc-link-compact > a:first-child span:not(.visually-hidden) {
    display: none;
}

/* -----------------------------------------------------------
   Layout: Main + Sidebar
----------------------------------------------------------- */
main {
    margin-top: 2rem;
}

/* Sidebar main box */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}

/* Sidebar content scroll area */
.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Sidebar link style */
.sidebar .nav-link {
    font-weight: 500;
    color: #333;
}

.sidebar .nav-link .feather {
    margin-right: 4px;
    color: #727272;
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
}

/* Active link (sidebar + general navigation) */
.nav-link.active {
    color: #0d6efd;
    font-weight: 600;
}

/* -----------------------------------------------------------
   Navbar
----------------------------------------------------------- */
.navbar-brand {
    padding-top: .25rem;
    padding-bottom: .25rem;
    font-size: 1rem;
    background: transparent;
    box-shadow: none;
}

.navbar-search {
    width: min(320px, 30vw);
    background-color: #1f242b;
    border: 1px solid #2c323a;
    color: #f8f9fa;
}

.navbar-search::placeholder {
    color: #a7b0ba;
}

.navbar-search:focus {
    background-color: #20262e;
    color: #ffffff;
    box-shadow: none;
    border-color: #3b424d;
}

/* -----------------------------------------------------------
   Refresh results table
----------------------------------------------------------- */
#refreshResults table {
    font-size: 0.85rem;
}

#refreshResults code {
    color: var(--bs-secondary);
}

/* -----------------------------------------------------------
   Clickable row behavior
----------------------------------------------------------- */
.clickable-row {
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.clickable-row:hover {
    background-color: #f5f7fa !important;
    box-shadow: inset 3px 0 0 #0d6efd;
}

/* -----------------------------------------------------------
   Form validation styling for textareas
----------------------------------------------------------- */
textarea.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 6px rgba(220,53,69,0.5);
}

textarea.is-valid {
    border-color: #198754 !important;
}

/* -----------------------------------------------------------
   Sortable column headers
----------------------------------------------------------- */
th.sortable {
    cursor: pointer;
    white-space: nowrap;
}

/* -----------------------------------------------------------
   Metric report modal + embed tightening
----------------------------------------------------------- */
.metric-report-modal .modal-dialog {
    max-width: 92vw;
}

.metric-report-frame {
    width: 100%;
    height: 82vh;
    min-height: 480px;
}

.embed-body h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.embed-body .card {
    margin-bottom: 0.75rem;
}

.embed-body .card-body {
    padding: 0.75rem;
}

th.sortable i {
    margin-left: 4px;
}

.sort-neutral svg {
    transform: rotate(180deg);
    opacity: 0.3;
}

/* -----------------------------------------------------------
   AP column settings (gear dropdown)
----------------------------------------------------------- */
.ap-col-settings-wrapper {
    position: absolute;
    right: 0;
    top: 0;
    padding: 4px 0;
}

.ap-col-settings-btn {
    padding: 4px 8px;
}

.ap-col-settings-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 36px;
    width: 220px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    z-index: 50;

    /* smooth fade-in */
    opacity: 0;
    transition: opacity 0.12s ease-out;
}

.ap-col-settings-panel.show {
    display: block;
    opacity: 1;
}

.ap-col-settings-wrapper:hover .ap-col-settings-panel {
    opacity: 1;
}
