/* Root icons/colors */
:root {
    --bad-value-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
}

/* Theme colors */
[data-bs-theme="light"] {
    --hr-color: #C7C8C9;
    --header-bg: #e9ecef;
    --sidebar-bg: #e9ecef;
    --text-color: #212529;
    --amp-primary: #0a7d91;
    --amp-primary-rgb: 10, 125, 145;
    --amp-secondary: #8045e5;
    --amp-secondary-rgb: 128, 69, 229;
}

[data-bs-theme="dark"] {
    --hr-color: #515559;
    --header-bg: #222832;
    --sidebar-bg: #222832;
    --text-color: #f8f9fa;
    --amp-primary: #34a7bb;
    --amp-primary-rgb: 52, 167, 187;
    --amp-secondary: #9c5ffd;
    --amp-secondary-rgb: 156, 95, 253;
}

/* Layout */
.grid-container {
    display: grid;
    margin-top: 4em;
    grid-template-rows: 1fr 4em;
    min-height: calc(100vh - 4em);
    grid-template-columns: 400px 1fr;
    transition: grid-template-columns 0.3s;
}

.dummy-block {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.main-page {
    width: 80%;
    grid-row: 1;
    grid-column: 2;
}

.footer {
    grid-row: 2;
    display: flex;
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content:space-between;
    border-top: 1px solid var(--hr-color);
}

/* Responsive hide/show */
.sm-only {display: none}
.lg-only {display: flex}

/* General spacing */
.w-400px {width: 400px}

/* General font styles */
.bold-label {
    font-weight: bold;
}

/* General links */
.link {
    color: var(--amp-primary);
}

.link:hover {
    cursor: pointer;
    text-decoration:none;
    color: var(--amp-secondary);
    border-bottom: 3px solid var(--amp-secondary);
}

.link:focus-visible {
    outline: none !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

/* Ampworks buttons */
.amp-btn {
    border: 1px solid var(--amp-primary) !important;
    background-color: var(--amp-primary) !important;
}

.amp-btn:hover {
    filter: brightness(0.9);
}

.amp-btn:active {
    filter: brightness(0.8);
}

.amp-btn:focus-visible {
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
} 

/* Header */
.header {
    z-index: 1500;
}

.navbar {
    border-bottom: 1px solid var(--hr-color);
    background-color: var(--header-bg) !important;
}

.nav-btn i {
    font-size: 1.5em;
}

.nav-btn {
    border: none;
    border-radius: 0;
    color: var(--text-color);
    background-color: transparent;
    border-bottom: 3px solid transparent;
}

.nav-btn:hover {
    color: var(--amp-secondary);
    background-color: transparent;
    border-bottom: 3px solid var(--amp-secondary) !important;    
}

.nav-btn:active {
    color: var(--text-color) !important;
    background-color: transparent !important;
}

.nav-btn:focus:hover {
    color: var(--amp-secondary) !important;
}

.nav-btn:focus:active {
    color: var(--text-color) !important;
}

.nav-btn:focus:not(:focus-visible) {
    border: 0;
    outline: 0;
    border-radius: 0;
    color: var(--text-color);
    border-bottom: 3px solid transparent;
}

.nav-btn:focus:focus-visible {
    border: 0 !important;
    color: var(--text-color);
    border-radius: 5px !important;
    background-color: transparent !important;
    border-bottom: 3px solid transparent !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

.nav-link {
    margin-inline-end: 5px;
    color: var(--text-color) !important;
    border-bottom: 3px solid transparent;    
}

.nav-link:hover {
    color: var(--amp-secondary) !important;
}

.nav-link:hover:active {
    color: var(--text-color) !important;
}

.nav-link.active {
    border-bottom: 3px solid var(--amp-secondary);    
}

.nav-link:hover:active {
    color: var(--text-color) !important;
}

.nav-link:focus:focus-visible {
    border-radius: 5px !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid var(--hr-color);
    background-color: var(--sidebar-bg) !important;
}

.sidebar a {
    font-weight: bold;
}

.sidebar a:hover {
    cursor: pointer;
}

.sidebar .btn-close {
    background-color: transparent !important;
}

.sidebar .btn-close:focus {
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

.sidebar-icon {
    width: 2em;
    font-size: 1.35em;
    padding-right: 1em;
}

.upload-btn:focus-within {
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
} 

.upload-btn-active {
    background-color: var(--hr-color) !important;
    box-shadow: 0 0 3px 3px var(--bs-success) !important;
}

.upload-btn-reject {
    box-shadow: 0 0 3px 3px var(--bs-danger) !important;
}

/* Markdown blocks */
.dbc pre {
    margin: 0 !important;
    border-radius: inherit !important;
}

.dbc code {
    margin: 0 !important;
    overflow: auto !important;
    max-width: 90vw !important;
    white-space: pre !important;
    border-radius: inherit !important;
    background-color: var(--bs-dark) !important;
}

.markdown {
    margin: 0;
    padding: 0;
    border-radius: 5px;
    border: 1px solid var(--hr-color);
}

/* Range sliders */
.rc-slider-track {
    height: 8px;
    background-color: var(--amp-primary);
}

.rc-slider-rail {
    height: 8px;
}

.rc-slider-handle {
    width: 15px;
    height: 15px;
    margin-top: -4px;
    border: 2px solid var(--amp-primary);
}

.rc-slider-handle:hover,
.rc-slider-handle:active {
    border: 2px solid var(--amp-primary) !important;
    box-shadow: 0 0 3px 3px var(--amp-primary) !important;
}

.rc-slider-handle:focus {
    border: 2px solid var(--amp-primary) !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

.rc-slider-dot {
    width: 10px;
    height: 10px;
    bottom: -5px;
    margin-left: -5px;
    border: 2px solid var(--amp-primary);
}

/* Forms/inputs - overwrites bootstrap */
.form-check-input:checked {
    border-color: var(--amp-primary) !important;
    background-color: var(--amp-primary) !important;
}

select:focus,
input:focus:not(:invalid) {
    border: 1px solid var(--amp-secondary) !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

input:invalid {
    outline: none;
    background-repeat: no-repeat;
    border-color: var(--bs-danger);
    padding-right: calc(1.5em + 0.75rem);
    background-image: var(--bad-value-icon);
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

input:focus:invalid {
    outline: none;
    border-color: var(--bs-danger);
    box-shadow: 0 0 3px 3px var(--bs-danger);
}

/* Accordions - overwrites bootstrap */
.accordion-body {
    color: var(--text-color) !important;
    background-color: var(--sidebar-bg) !important;
}

.accordion-button {
    color: var(--text-color) !important;
    background-color: transparent !important;
    border-bottom: 1px solid var(--hr-color);
}

.accordion-button:hover {
    cursor: pointer;
    border-radius: 0;
    background-color: transparent;
    color: var(--amp-secondary) !important;
    border-bottom: 1px solid var(--amp-secondary) !important;
}

.accordion-button:active {
    color: var(--text-color) !important;
}

.accordion-button:focus {
    border-radius: 5px !important;
    box-shadow: 0 0 3px 3px var(--amp-secondary);
}

/* AG-grid colors */
.amp-ag-grid .ag-theme-alpine {
    --ag-alpine-active-color: var(--amp-primary);
    --ag-selected-row-background-color: rgba(var(--amp-secondary-rgb), 0.15);
    --ag-row-hover-color: rgba(var(--amp-secondary-rgb), 0.3);
    --ag-column-hover-color: rgba(var(--amp-secondary-rgb), 0.1);
    --ag-input-focus-border-color: rgba(var(--amp-secondary-rgb), 0.4);
    --ag-range-selection-background-color: rgba(var(--amp-secondary-rgb), 0.2);
    --ag-range-selection-background-color-2: rgba(var(--amp-secondary-rgb), 0.36);
    --ag-range-selection-background-color-3: rgba(var(--amp-secondary-rgb), 0.49);
    --ag-range-selection-background-color-4: rgba(var(--amp-secondary-rgb), 0.59);
    --ag-background-color: var(--bs-body-bg);
    --ag-foreground-color: var(--bs-body-color);
    --ag-border-color: rgba(173, 181, 189, 0.40);
    --ag-cell-horizontal-border: rgba(173, 181, 189, 0.20);
    --ag-secondary-border-color: rgba(173, 181, 189, 0.20);
    --ag-header-background-color: rgba(173, 181, 189, 0.20);
    --ag-odd-row-background-color: rgba(173, 181, 189, 0.05);
    --ag-control-panel-background-color: var(--bs-body-bg);
    --ag-subheader-background-color: var(--bs-body-bg);
    --ag-invalid-color: var(--bs-form-invalid-color);
    --ag-font-family: var(--bs-font-family);
    --ag-tooltip-background-color: var(--bs-body-bg);
}

/* Logging buttons */
.log-btn.success {
    border: 1px solid var(--bs-success) !important;
    background-color: var(--bs-success) !important;
}

.log-btn.danger {
    border: 1px solid var(--bs-danger) !important;
    background-color: var(--bs-danger) !important;
}

.log-btn.secondary {
    border: 1px solid var(--bs-secondary) !important;
    background-color: var(--bs-secondary) !important;
}

.log-btn:hover {
    filter: brightness(0.9);
}

.log-btn:active {
    filter: brightness(0.8);
}

.log-btn:focus-visible {
    box-shadow: 0 0 3px 3px var(--amp-secondary) !important;
}

/* Media queries */
@media (max-width: 1200px) {
    .header {z-index: 1000}
    .lg-only {display: none}
    .sm-only {display: flex}
    .nav-link-bottom {margin-bottom: 0.75em}
    .grid-container {grid-template-columns: 0 1fr}
    
    .nav-link {
        padding-inline: 0.25em;
        margin-inline-start: auto;
    }
    
    .navlinks-collapse {
        text-align: right;
        padding-right: 0.5em;
    }
}

@media (max-width: 992px) {
    .main-page {width: 90%}
}

@media (max-width: 768px) {
    .main-page {width: 90%}
}