:root,
[data-bs-theme="light"] {
    --feb-surface: #f5f5f5;
    --feb-surface-border: #d3d3d3;
    --feb-border-strong: #666;
    --feb-border-muted: #ddd;
    --feb-reservation-text: #fff;
    --feb-reservation-confirmed-bg: #2d9434;
    --feb-reservation-option-bg: #f6e95c;
    --feb-reservation-option-text: #666;
    --feb-reservation-option-border: #999;
    --feb-weekend-bg: #eee;
    --feb-selection-bg: #f5f5f5;
    --feb-ui-selecting-bg: #feca40;
    --feb-ui-selected-bg: #f39814;
}

[data-bs-theme="dark"] {
    --feb-surface: #1f2226;
    --feb-surface-border: #3a3f45;
    --feb-border-strong: #9aa0a6;
    --feb-border-muted: #444a52;
    --feb-reservation-text: #f8f9fa;
    --feb-reservation-confirmed-bg: #2e7d32;
    --feb-reservation-option-bg: #bfa23a;
    --feb-reservation-option-text: #1b1b1b;
    --feb-reservation-option-border: #9f8732;
    --feb-weekend-bg: #3a3f44;
    --feb-selection-bg: #2a2f33;
    --feb-ui-selecting-bg: #b77724;
    --feb-ui-selected-bg: #c06a1b;
    --bs-primary: #1f4b8f;
    --bs-primary-rgb: 31, 75, 143;
}

[data-bs-theme="light"] .navbar.bg-primary {
    --bs-navbar-color: rgba(255, 255, 255, 0.85);
    --bs-navbar-hover-color: rgba(255, 255, 255, 1);
    --bs-navbar-active-color: rgba(255, 255, 255, 1);
    --bs-navbar-brand-color: rgba(255, 255, 255, 1);
    --bs-navbar-brand-hover-color: rgba(255, 255, 255, 1);
}

[data-bs-theme="dark"] .navbar.bg-primary {
    --bs-navbar-color: rgba(var(--bs-body-color-rgb), 0.85);
    --bs-navbar-hover-color: rgba(var(--bs-body-color-rgb), 1);
    --bs-navbar-active-color: rgba(var(--bs-body-color-rgb), 1);
    --bs-navbar-brand-color: rgba(var(--bs-body-color-rgb), 1);
    --bs-navbar-brand-hover-color: rgba(var(--bs-body-color-rgb), 1);
    --bs-navbar-toggler-border-color: rgba(var(--bs-body-color-rgb), 0.2);
}

[data-bs-theme="dark"] .btn-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-secondary-bg);
    --bs-btn-border-color: var(--bs-secondary-bg);
    --bs-btn-hover-bg: #2f3338;
    --bs-btn-hover-border-color: #2f3338;
    --bs-btn-active-bg: #3a3f45;
    --bs-btn-active-border-color: #3a3f45;
}

body {
    font-size: 0.9rem
}

.hk-row-form {
    display: contents;
}

.btn {
    font-size: 0.9rem;
}

.dropdown-menu {
    font-size: 0.9rem;
}

.popover-body, .popover-header {
    font-size: 0.9rem;
}

.form-switch > .form-check-input {
    margin-top: .25em;
    margin-right: .75em;
}

.login {
    border-color: var(--feb-surface-border);
    border-width: 1px;
    border-style: solid;
    border-radius: 15px;
    padding: 15px;
    background-color: var(--feb-surface);
}

.button-hidden {
    visibility: hidden;
}

.two-td-left {
    border-right: none !important;
}

.two-td-right {
    border-left: none !important;
}

.reservation {
    border-left: none !important;
    border-right: none !important;
    padding: 8px 2px !important;
}

.reservation-inner {
    border: 1px solid var(--feb-border-strong);
    color: var(--feb-reservation-text);
    padding: 3px;
}

.reservation-confirmed {
    background-color: var(--feb-reservation-confirmed-bg);
}

.reservation-option {
    background-color: var(--feb-reservation-option-bg);
    color: var(--feb-reservation-option-text);
    border-color: var(--feb-reservation-option-border);
}

.reservation-table-weekend-single {
    background-color: var(--feb-weekend-bg) !important;
}

.mouse-pointer {
    cursor: pointer;
}

.border-left-thick {
    border-left: 2px solid var(--feb-border-muted);
}

.cell-selected {
    background-color: var(--feb-selection-bg);
}

.table-reservation .ui-selecting, .table-reservation-year .ui-selecting { 
    background: var(--feb-ui-selecting-bg) !important;
}
.table-reservation .ui-selected, .table-reservation-year .ui-selected { 
    background: var(--feb-ui-selected-bg);
}

.table-reservation .table-days > th {
    position: relative;
}

/* remove border because of box-shadow for sticky header */
.table.table-sticky,.table-sticky tbody tr:first-child { 
    border-top: 0 !important;
}

/* remove border because of box-shadow for sticky header */
.table-sticky thead tr, .table-sticky thead th { 
    border-top: 0 !important; 
    border-bottom: 0 !important;
}

.table-responsive { position: relative; }

.table.table-sticky thead th, .table.table-sticky thead td {
  position: sticky;
  z-index: 3;
  /* fester Hintergrund, damit nichts durchscheint */
  background-color: var(--bs-table-bg, var(--bs-body-bg));
  /* klare Unterkante auch bei border-collapse */
  box-shadow: inset 0 -1px 0 var(--bs-border-color);
  background-clip: padding-box; /* verhindert „Border-Bleeding“ */
}

.table.table-sticky thead tr:first-child td{
  /* top + bottom Schatten kombinieren: */
  box-shadow:
    inset 0  1px 0 var(--bs-border-color),  /* obere Linie */
    inset 0 -1px 0 var(--bs-border-color);  /* untere Linie */
}

/* left sticky column in reservation overview*/
.table.table-sticky tbody tr > *:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background-color: var(--bs-table-bg, var(--bs-body-bg));
  box-shadow: 
    inset  1px 0 0 var(--bs-border-color), /* linke Linie */
    inset -1px 0 0 var(--bs-border-color); /* rechte Linie */
  background-clip: padding-box;
  border-right: 0;
  border-left: 0;
}

.template-editor-content {
    min-height: 320px;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    font-size: 0.95rem;
}

.template-editor-content:focus {
    outline: none;
}

.simple-html-editor-content .ProseMirror:focus {
    outline: none;
    box-shadow: none;
}

.template-editor-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
}

.template-editor-content table th,
.template-editor-content table td {
    border: 1px solid var(--bs-border-color);
    padding: 0.35rem 0.5rem;
    vertical-align: top;
}

.template-editor-content .header,
.template-editor-content .footer {
    border: 1px var(--bs-border-color) dashed;
    width: 100%;
}

.template-editor-snippet-panel {
    width: 260px;
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.75rem;
    margin-right: 0.75rem;
    border-right: 1px solid var(--bs-border-color);
}

.template-editor-snippet-panel h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary);
}

.template-editor-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.template-editor-toolbar .btn {
    line-height: 1;
}

.template-editor-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg);
}

.template-editor-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.template-editor-toolbar-row:has(.template-editor-row-controls) {
    flex-direction: column;
    align-items: flex-start;
}

.template-editor-toolbar-row:has(.template-editor-row-controls) > .template-editor-row-controls {
    align-self: stretch;
}

.template-editor-toolbar-row-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 auto;
}

.template-editor-toolbar-group {
    display: inline-flex;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.template-editor-btn {
    border: 0;
    border-right: 1px solid var(--bs-border-color);
    border-radius: 0 !important;
    min-width: 2.3rem;
}

.template-editor-toolbar-group .template-editor-btn:last-child {
    border-right: 0;
}

.template-editor-btn.is-active {
    background: var(--bs-primary);
    color: var(--bs-white);
}

.template-editor-mode-btn {
    margin-left: auto;
}

.template-editor-select {
    min-width: 120px;
    border: 0;
    border-right: 1px solid var(--bs-border-color);
    border-radius: 0 !important;
}

.template-editor-toolbar-group .template-editor-select:last-child {
    border-right: 0;
}

.template-editor-snippets {
    min-width: 220px;
}

.template-editor-row-controls {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    padding: 0.5rem;
    background: var(--bs-body-bg);
    min-width: 380px;
}

.template-editor-row-grid {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr auto;
    gap: 0.4rem;
    align-items: center;
}

.template-editor-row-grid .form-check-input {
    cursor: pointer;
}

.template-editor-row-grid .form-check-label {
    white-space: nowrap;
}

@media (max-width: 992px) {
    .template-editor-row-controls {
        min-width: 100%;
    }

    .template-editor-row-grid {
        grid-template-columns: 1fr;
    }
}

.snippet-item {
    cursor: grab;
    background: var(--bs-tertiary-bg);
    transition: background-color .15s ease-in-out;
    font-size: 0.82rem;
}

.snippet-item:hover {
    background: var(--bs-secondary-bg);
}

.template-editor-comment-token {
    display: none;
}

.template-editor-style-token {
    display: none;
}

.template-editor-content [data-template-style] {
    display: none !important;
}

/* ── Image resize & alignment ── */

.template-editor-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    cursor: default;
}

.template-editor-image-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
}

.template-editor-image-wrapper.is-selected {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.template-editor-image-resize-handle {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 12px;
    height: 12px;
    background: var(--bs-primary);
    border: 2px solid var(--bs-body-bg);
    border-radius: 2px;
    cursor: se-resize;
    opacity: 0;
    transition: opacity 0.15s;
}

.template-editor-image-wrapper:hover .template-editor-image-resize-handle,
.template-editor-image-wrapper.is-selected .template-editor-image-resize-handle {
    opacity: 1;
}

.template-editor-image-toolbar {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 2px;
    box-shadow: var(--bs-box-shadow-sm);
    z-index: 10;
}

.template-editor-image-toolbar .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
}

/* ── Variable picker ── */

.template-editor-variable-picker {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: var(--bs-box-shadow);
    width: 280px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
}

.template-editor-variable-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
    border-radius: 0.375rem 0.375rem 0 0;
}

.template-editor-variable-picker-header .btn-close {
    transform: scale(0.7);
}

.template-editor-variable-picker-list {
    overflow-y: auto;
    padding: 0.25rem 0;
}

.template-editor-variable-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    color: inherit;
    gap: 0.5rem;
}

.template-editor-variable-label:hover {
    background: var(--bs-primary-bg-subtle, #e8f0fe);
}

.template-editor-variable-name {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
}

.template-editor-variable-type-hint {
    font-size: 0.7rem;
    color: var(--bs-secondary);
    white-space: nowrap;
}

.template-editor-variable-type-entity > .template-editor-variable-label,
.template-editor-variable-type-collection > .template-editor-variable-label,
.template-editor-variable-type-array > .template-editor-variable-label {
    font-weight: 500;
}

.template-editor-variable-item.is-expanded > .template-editor-variable-label {
    background: var(--bs-tertiary-bg);
}

.template-editor-variable-children {
    padding-left: 0.75rem;
    border-left: 2px solid var(--bs-border-color);
    margin-left: 0.6rem;
}

.template-editor-variable-loop-action {
    color: var(--bs-primary);
    font-style: italic;
}

.template-editor-variable-loop-action:hover {
    background: var(--bs-primary-bg-subtle, #e8f0fe);
}

.table.table-sticky tbody tr > *:nth-child(2) {
  border-left: 0;
}


.reservation-table-weekend {
    background-color: var(--feb-weekend-bg) !important;
}


/* remove bottom border of tr for multiple reservations of one apartment (select tr where the next tr has border-top-0 class) */
#reservation-table tr:has( + .border-top-0) {
    border-bottom: 0 !important;
}

#reservation-table .room-info {
    white-space: nowrap;
    vertical-align: middle;
}

/* fix for autocomplete not  shown */
.ui-front { 
    z-index: 9999; 
}

.price-period .badge {
    font-size: 90%;
    margin: 4px;
}

.badge .close {
    margin-left: .25rem;
    color: inherit;
    font-size: medium;
    font-weight: bold;
}

/* yearly reservation overview */
.reservation-yearly-parent { 
    padding: 0 !important; 
    position: relative; 
    overflow:hidden; 
}

.no-pointer-events {
    pointer-events: none;
}

div .reservation-yearly {
    padding: .5rem;
    width: 100%; 
    height: 100%;
    pointer-events: auto; 
    z-index: 1;
    cursor: pointer;
}

div .reservation-yearly-day {
    width: 100%; 
    height: 100%; 
    position: absolute; 
    left: 0; 
    top: 0; 
    z-index: 2; 
    padding: .5rem;
}
.month-reservationstartend {
    flex: 1 0 100%;
}
.month-reservation-end {
    transform: skewY(-45deg);
    transform-origin: bottom left;
}

.month-reservation-start {
    transform: skewX(-45deg);
    transform-origin: top right;
}
.month-reservation-onlystart {
    transform: skewY(-45deg);
}

.dummy-day {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: unset;
    pointer-events: auto;
    z-index: 1;
}
.month-reservation-start.dummy-day {
    left: 1.4rem;
}

.month-reservation-end.dummy-day {
    left: -1.4rem;
    transform: skewX(-45deg);
}

/*
 * Forms
 */
/* reduce default font size of labels in modals */
.modal-body .col-form-label {
    font-size: 14px;
}

/* add hint to required fields */
#accordionSettings label.required:after {
    content: " *";
}
