/* Branding CSS Variables - fallback values */
:root {
    --brand-primary: #f67f1f;
    --brand-navbar-bg: #2d2e30;
    --brand-navbar-link: #e2e8f0;
}

/* Light mode sidebar background - uses branding variable */
html:not(.dark) .bg-sidebar-dark { background-color: var(--brand-navbar-bg, #2d2e30) !important; }
.hover\:bg-primary:hover { background-color: var(--brand-primary, #f67f1f); }

/* Hide time input dropdown arrows to force 15-minute increments */
.time-input-no-dropdown::-webkit-calendar-picker-indicator {
    display: none;
}
.time-input-no-dropdown::-webkit-inner-spin-button,
.time-input-no-dropdown::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.time-input-no-dropdown {
    -moz-appearance: textfield; /* Firefox */
}

/* Calendar slot selection highlight */
.calendar-slot-selected {
    background-color: rgba(246, 127, 31, 0.2) !important; /* Light mode - using brand primary with opacity */
}

.dark .calendar-slot-selected {
    background-color: rgba(246, 127, 31, 0.3) !important; /* Dark mode - slightly more opaque */
}

[type='text']:focus,
[type='email']:focus,
[type='url']:focus,
[type='password']:focus,
[type='number']:focus,
[type='date']:focus,
[type='datetime-local']:focus,
[type='month']:focus,
[type='search']:focus,
[type='tel']:focus,
[type='time']:focus,
[type='week']:focus,
[multiple]:focus,
textarea:focus,
select:focus,
input:where(:not([type])):focus {
    --tw-ring-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

table thead { border-bottom: 1px solid #e5e7eb; }

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

[data-modal-root] {
    overflow-y: auto;
}

[data-modal-root] [data-modal-overlay] {
    background-color: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(4px);
}

.dark [data-modal-root] [data-modal-overlay] {
    background-color: rgba(15, 23, 42, 0.8) !important;
}

/* Knowledge base video embed placeholder (shown inside the TinyMCE editor) */
.kb-embed {
    position: relative;
    display: inline-block;
    max-width: var(--kb-embed-max-width, 560px);
    width: 100%;
    aspect-ratio: var(--kb-embed-aspect-ratio, 16 / 9);
    cursor: default;
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: #0f172a;
}

.kb-embed img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kb-embed .kb-embed-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    background-color: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    font-size: 20px;
}

/* Knowledge base video embed on the rendered article view */
.kb-embed-wrapper {
    position: relative;
    max-width: var(--kb-embed-max-width, 560px);
    width: 100%;
}

.kb-embed-wrapper iframe {
    width: 100%;
    aspect-ratio: var(--kb-embed-aspect-ratio, 16 / 9);
    height: auto;
    border: 0;
    border-radius: 0.375rem;
}

/* Chat widget: links cited inline in an assistant reply, styled as clear inline citations rather than plain browser links */
.chat-widget-message-assistant p + p,
.chat-widget-message-assistant p + ul,
.chat-widget-message-assistant p + ol,
.chat-widget-message-assistant ul + p,
.chat-widget-message-assistant ol + p,
.chat-widget-message-assistant table + p,
.chat-widget-message-assistant p + table {
    margin-top: 0.5rem;
}

.chat-widget-message-assistant ul,
.chat-widget-message-assistant ol {
    margin-top: 0.375rem;
    margin-left: 1rem;
}

.chat-widget-message-assistant ul {
    list-style: disc;
}

.chat-widget-message-assistant ol {
    list-style: decimal;
}

.chat-widget-message-assistant li + li {
    margin-top: 0.25rem;
}

.chat-widget-message-assistant > div {
    overflow-x: auto;
}

.chat-widget-message-assistant table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.chat-widget-message-assistant th,
.chat-widget-message-assistant td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    padding: 0.25rem 0.375rem;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.chat-widget-message-assistant a {
    color: var(--brand-primary);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-widget-message-assistant a:hover {
    text-decoration-thickness: 2px;
}

/* Chat widget: the "Sources (N)" list, styled as small pill chips instead of plain stacked links */
.chat-widget-sources summary {
    list-style: none;
}

.chat-widget-sources summary::-webkit-details-marker {
    display: none;
}

.chat-widget-sources summary::before {
    content: '\f0da';
    font-family: 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    display: inline-block;
    margin-right: 0.25rem;
    transition: transform 0.15s ease;
}

.chat-widget-sources[open] summary::before {
    transform: rotate(90deg);
}

.chat-widget-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background-color: rgba(148, 163, 184, 0.15);
    color: var(--brand-primary) !important;
    text-decoration: none !important;
    max-width: 100%;
}

.chat-widget-source-link:hover {
    background-color: rgba(148, 163, 184, 0.3);
}

.chat-widget-source-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-widget-source-link i {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.chat-widget-source-card {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.5rem;
    background-color: rgba(148, 163, 184, 0.08);
    padding: 0.5rem 0.625rem;
}

.chat-widget-source-card-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.375rem 0.5rem;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.chat-widget-source-card-summary::-webkit-details-marker {
    display: none;
}

.chat-widget-source-card-summary::before {
    content: '\f0da';
    font-family: 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    transition: transform 0.15s ease;
}

.chat-widget-source-card[open] .chat-widget-source-card-summary::before {
    transform: rotate(90deg);
}

.chat-widget-source-type {
    grid-column: 2;
    width: max-content;
    max-width: 100%;
    border-radius: 9999px;
    background-color: rgba(14, 165, 233, 0.12);
    color: #0369a1;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
}

.dark .chat-widget-source-type {
    color: #7dd3fc;
}

.chat-widget-source-title {
    grid-column: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
}

.chat-widget-source-excerpt {
    margin-top: 0.5rem;
    max-height: 9rem;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #475569;
}

.dark .chat-widget-source-excerpt {
    color: #cbd5e1;
}

.chat-widget-source-full-link {
    display: inline-flex;
    margin-top: 0.5rem;
    color: var(--brand-primary) !important;
    font-weight: 600;
    text-decoration: none !important;
}

.chat-widget-source-full-link:hover {
    text-decoration: underline !important;
    text-underline-offset: 2px;
}