/* Cavaliba custom CSS
 * Classes prefixed with "cv-" are Cavaliba-specific.
 * The prefix avoids collisions with Bootstrap and third-party libraries.
 * cv = Cavaliba
 */

:root {
    --cv-font-family:        'Verdana', sans-serif;
    --cv-font-size-base:     14px;
    --cv-sidebar-width:      214px;
    --cv-brand-color:        #629ffa;
    --cv-sidebar-link-color: #e9ecef;
    --cv-sidebar-active-color: #e9ec00;
    --cv-navbar-height:      70px;
    --cv-toc-width:          180px;
}

*,
::after,
::before {
    box-sizing: border-box;
}

html {
    font-size: var(--cv-font-size-base);
}

body {
    font-family: var(--cv-font-family);
    /* font-size: 0.875rem; */
    opacity: 1;
    overflow-y: scroll;
    margin: 0;
}


.starter-template {
  padding: 3rem 1.5rem;
  text-align: center;
}

.helptext {
    color: grey;
    font-size: 12px;
}

pre {
  margin-bottom: 0rem;
}

/* a {
  color: #000;
  text-decoration: none;

}  */


/* sidebar  */

a {
    cursor: pointer;
    text-decoration: none;
    color: #000;
    font-family: var(--cv-font-family);
}

li {
    list-style: none;
}

h4 {
    font-family: var(--cv-font-family);
    font-size: 1.275rem;
    color: var(--bs-emphasis-color);
}

/* Layout for admin dashboard skeleton */

.wrapper {
    align-items: stretch;
    display: flex;
    width: 100%;
}

#sidebar {
    max-width: var(--cv-sidebar-width);
    min-width: var(--cv-sidebar-width);
    background: var(--bs-dark);
    transition: all 0.35s ease-in-out;
}

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow: hidden;
    transition: all 0.15s ease-in-out;
    width: 100%;
    background: var(--bs-light-bg-subtle);
}

/* Sidebar Elements Style */

.sidebar-logo {
    padding: 1.15rem;
}

.sidebar-logo a {
    color: var(--cv-sidebar-link-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-logo-app {
    padding: 1.15rem;
}

.sidebar-logo-app a {
    color: #888888;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-nav {
    list-style: none;
    margin-bottom: 0;
    padding-left: 0;
    margin-left: 0;
}

.sidebar-header-active {
    color: var(--cv-sidebar-active-color);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.0rem 1.5rem .375rem;
}

.sidebar-header {
    color: var(--cv-brand-color);
    font-size: 0.95rem;
    padding: 1.0rem 1.5rem .175rem;
}

a.sidebar-link {
    padding: .325rem 1.625rem;
    color: var(--cv-sidebar-link-color);
    position: relative;
    display: block;
    font-size: 0.875rem;
}

.sidebar-link[data-bs-toggle="collapse"]::after {
    border: solid;
    border-width: 0 .075rem .075rem 0;
    content: "";
    display: inline-block;
    padding: 2px;
    position: absolute;
    right: 1.5rem;
    top: 1.4rem;
    transform: rotate(-135deg);
    transition: all .2s ease-out;
}

.sidebar-link[data-bs-toggle="collapse"].collapsed::after {
    transform: rotate(45deg);
    transition: all .2s ease-out;
}

.navbar-expand .navbar-nav {
  margin-left: auto;
}


/* TOC layout */

.cv-content-area {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.cv-main-content {
    flex: 1 1 auto;
    min-width: 0;
}

.cv-toc {
    flex: 0 0 var(--cv-toc-width);
    position: sticky;
    top: var(--cv-navbar-height);
    max-height: calc(100vh - var(--cv-navbar-height) - 20px);
    overflow-y: auto;
    font-size: 0.85rem;
}

.cv-toc:empty {
    display: none;
}

.cv-scrollable-content {
    height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 15px;
}

.cv-monitor-chart-wide   { width: 900px; }
.cv-monitor-chart-medium { width: 720px; }
.cv-monitor-chart-30d    { width: 806px; }

/* Scroll anchors (instance_detail page sections) */
.cv-scroll-anchor {
    scroll-margin-top: 60px;
}

/* Modal inline forms */
.cv-form-inline {
    display: inline;
}

/* Dropdown <button> styled as a dropdown item */
.cv-dropdown-btn {
    border: none;
    background: none;
    text-align: left;
    padding: 0.5rem 1rem;
    width: 100%;
}

/* Search form */
.cv-search-form {
    display: flex;
    align-items: center;
    width: 100%;
}
.cv-search-form .input-group {
    flex: 1;
}
.cv-search-help-btn {
    font-weight: bold;
}
.cv-search-help-table code {
    white-space: nowrap;
}

/* Export file viewer */
.cv-export-preview {
    max-height: 600px;
    overflow-y: auto;
}

/* Sirene message body blocks */
.cv-sirene-msg-body        { background-color: #fff; }
.cv-sirene-msg-sms         { background-color: #cdedfc; }
.cv-sirene-msg-update      { background-color: #eee; }
.cv-sirene-msg-update-sms  { background-color: #ddd; }

/* Sirene new-message page: header row (title + summary box) */
.cv-sirene-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Sirene notification summary box */
.cv-sirene-notify-summary {
    background-color: #eee;
    min-width: 200px;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Sirene notification loading spinner (toggled by JS/HTMX) */
.cv-sirene-notify-loading {
    display: none;
    margin-top: 0.5rem;
    text-align: center;
}

/* Larger inline icon */
.cv-icon-lg {
    font-size: 1.2rem;
}

/* Clickable table row */
.cv-row-clickable {
    cursor: pointer;
}

/* Public page message body (preserve newlines) */
.cv-pub-body {
    white-space: pre-wrap;
}

/* Related objects icon link */
.cv-related-icon i {
    display: inline-block;
    transition: transform 0.2s;
}
.cv-related-icon:hover i {
    transform: scale(1.5);
}

/* Related objects count badge */
.cv-related-count .badge {
    transition: filter 0.2s;
}
.cv-related-count:hover .badge {
    filter: brightness(0.6);
    font-weight: bold;
}

.cv-user-disabled {
    text-decoration: line-through;
    opacity: 0.6;
}

/* content  */
.content {
    flex: 1;
    max-width: 100vw;
    width: 100vw;
}

@media (min-width:768px) {
    .content {
        max-width: auto;
        width: auto;
    }
}



/* Sidebar Toggle */

#sidebar.collapsed {
    margin-left: calc(-1 * var(--cv-sidebar-width));
}

/* Footer and Nav */

@media (max-width:767.98px) {

    .js-sidebar {
        margin-left: calc(-1 * var(--cv-sidebar-width));
    }

    #sidebar.collapsed {
        margin-left: 0;
    }

    .navbar,
    footer {
        width: 100vw;
    }
}


/* DataTask */

.datatask-nav-item { position: relative; }

.datatask-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.datatask-dropdown { min-width: 280px; }

.datatask-item { display: block; padding: 4px 12px; }

.datatask-name { font-weight: 500; font-size: 0.85rem; }

.datatask-state { font-size: 0.75rem; font-weight: 600; }
.datatask-state-queued  { color: #888; }
.datatask-state-running { color: #2980b9; }
.datatask-state-done    { color: #27ae60; }
.datatask-state-failed  { color: #e74c3c; }
.datatask-state-aborted { color: #e67e22; }

.datatask-progress-bar-wrap {
    background: #e0e0e0;
    border-radius: 3px;
    height: 5px;
    margin: 3px 0;
    width: 100%;
}

.datatask-progress-bar {
    background: #2980b9;
    border-radius: 3px;
    height: 5px;
    min-width: 2px;
    transition: width 0.4s;
}

.datatask-progress-text { font-size: 0.72rem; color: #555; }

.datatask-label-idle {
    font-size: 0.75rem;
    color: #aaa;
    font-weight: 500;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 7px;
}

.datatask-label-running {
    font-size: 0.75rem;
    color: #27ae60;
    font-weight: 600;
    border: 1px solid #27ae60;
    border-radius: 4px;
    padding: 2px 7px;
}

.datatask-nav-item {
    margin-right: 0.75rem;
}

.navbar-user-dropdown {
    border-left: 1px solid #dee2e6;
    padding-left: 0.75rem;
}

.datatask-all-link { font-size: 0.82rem; }

.datatask-filter-select { max-width: 160px; }

.datatask-detail-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1.25rem;
    max-width: 860px;
}

.datatask-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.datatask-detail-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.datatask-detail-state {
    font-size: 0.85rem;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 1px 8px;
}

.datatask-detail-table th {
    width: 130px;
    color: #666;
    font-weight: 500;
}

.datatask-section-header {
    background: #e9ecef;
    color: #495057;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.6rem;
    border-top: 2px solid #dee2e6;
}

.datatask-detail-subkey {
    width: 130px;
    color: #888;
    font-weight: 500;
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

.datatask-detail-json {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Burger row action menu */
.cv-burger-cell { width: 2em; white-space: nowrap; padding: 0.1rem 0.2rem !important; }
.cv-burger-btn  { padding: 0.1rem 0.6rem; font-size: 0.75rem; line-height: 1.4; border: none; background: transparent; color: #888; }
.cv-burger-btn:hover { background: rgba(0,0,0,0.06); color: #333; }
.cv-burger-dropdown { display: inline-block; }
.cv-menu-danger { color: var(--bs-danger); }
