/* Custom utility classes for VcM Platform */

/* Image previews for evidence photos */
.img-preview {
    height: 120px;
    object-fit: cover;
}

/* Image thumbnail max height */
.img-thumbnail-md {
    max-height: 150px;
}

/* Scrollable boxes with max-height */
.scroll-box {
    max-height: 550px;
    overflow-y: auto;
}

/* Loading overlay positioning */
.loading-overlay {
    top: 15px;
    right: 15px;
    z-index: 9999;
}

/* Extra small close button */
.btn-close-xs {
    font-size: 0.65rem;
}

/* Logo sizing utilities */
.logo-sm {
    max-height: 70px;
    width: auto;
}

.logo-md {
    max-height: 150px;
    width: auto;
}

/* Modal backdrop (Bootstrap 4.6 compatible) */
.modal-backdrop-custom {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Border utilities for lists */
.border-left-4 {
    border-left-width: 4px !important;
}

.border-left-success {
    border-left-color: #28a745 !important;
}

/* Cursor pointer */
.cursor-pointer {
    cursor: pointer;
}

/* Horizontal bar charts (Chart.js 4) */
.chart-horizontal-bar,
.chart-horizontal-bar-lg {
    position: relative;
}

.chart-horizontal-bar {
    height: 400px;
}

.chart-horizontal-bar-lg {
    height: 620px;
}

@media (max-width: 767.98px) {
    .chart-horizontal-bar {
        height: 320px;
    }

    .chart-horizontal-bar-lg {
        height: 480px;
    }
}

/* Stat cards: 5 per row on xl, 3 on md, 1 on mobile (12 column grid cannot split by 5) */
.col-stat-5 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

@media (min-width: 768px) {
    .col-stat-5 {
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
    }
}

@media (min-width: 1200px) {
    .col-stat-5 {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/*
 * Activity scope assistant.
 *
 * Colours are declared once here. The blue is a darkened take on the reference
 * design: the original #7BA7D7 only reaches 2.51:1 against white text, well
 * under the 4.5:1 WCAG AA floor. #4C74A8 reaches 4.80:1 while keeping the same
 * family. The muted grey is #6b7079 (4.98:1); Bootstrap's text-gray-600 would
 * land at 3.56:1 and fail.
 */
:root {
    --activity-chat-blue: #4c74a8;
    --activity-chat-blue-dark: #3f6598;
    --activity-chat-muted: #6b7079;
    --activity-chat-surface: #f5f6f7;
    --activity-chat-online: #28a745;
    --activity-chat-focus: #ff8100;
}

/*
 * Floating draggable window.
 *
 * Without JavaScript the assistant falls back to a normal in-flow card and the
 * FAB stays hidden, so the feature never becomes unreachable. The script adds
 * "activity-chat-ready" to <html> plus the position custom properties, keeping
 * the state outside the markup that Livewire morphs.
 */
.activity-chat-fab {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1040;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.5rem;
    border: 0;
    border-radius: 999px;
    background-color: var(--activity-chat-blue);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.activity-chat-ready .activity-chat-fab {
    display: inline-flex;
}

.activity-chat-fab i {
    font-size: 1.4rem;
}

.activity-chat-ready .activity-chat-fab:hover {
    background-color: var(--activity-chat-blue-dark);
}

.activity-chat-fab:focus {
    outline: 3px solid var(--activity-chat-focus);
    outline-offset: 2px;
}

.activity-chat-panel {
    display: block;
    width: auto;
    overflow: hidden;
    border: 0;
    border-radius: 0.75rem;
    background-color: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

.activity-chat-ready .activity-chat-panel {
    position: fixed;
    top: var(--activity-chat-y, 24px);
    left: var(--activity-chat-x, 24px);
    right: auto;
    z-index: 1040;
    display: none;
    flex-direction: column;
    width: 360px;
    height: 600px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
}

/*
 * Both state classes live on <html> itself, so they must be chained on the same
 * element. Writing them with a descendant combinator never matches anything.
 */
.activity-chat-ready.activity-chat-visible .activity-chat-panel {
    display: flex;
}

/* The panel owns the corner while it is open, so the FAB steps aside. */
.activity-chat-ready.activity-chat-visible .activity-chat-fab {
    display: none;
}

.activity-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e6e8eb;
    background-color: #fff;
    cursor: default;
    touch-action: auto;
    user-select: none;
}

.activity-chat-ready .activity-chat-header {
    cursor: move;
    touch-action: none;
}

.activity-chat-ready .activity-chat-header:focus {
    outline: 3px solid var(--activity-chat-focus);
    outline-offset: -3px;
}

.activity-chat-header.is-dragging {
    cursor: grabbing;
}

.activity-chat-avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--activity-chat-surface);
}

.activity-chat-identity {
    flex: 1 1 auto;
    min-width: 0;
}

.activity-chat-title {
    margin: 0;
    color: #2f3440;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.activity-chat-presence {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.15rem 0 0;
    color: var(--activity-chat-muted);
    font-size: 0.8rem;
}

.activity-chat-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background-color: var(--activity-chat-online);
}

.activity-chat-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.15rem;
}

.activity-chat-action {
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--activity-chat-muted);
    font-size: 1rem;
    line-height: 1;
}

.activity-chat-action:hover {
    background-color: var(--activity-chat-surface);
    color: var(--activity-chat-blue-dark);
}

.activity-chat-action:focus {
    outline: 3px solid var(--activity-chat-focus);
    outline-offset: 1px;
}

.activity-chat-body {
    flex: 1 1 auto;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--activity-chat-surface);
}

.activity-chat-conversation-label {
    margin-bottom: 0.5rem;
    color: var(--activity-chat-muted);
    font-size: 0.85rem;
}

.activity-chat-notice {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background-color: #fff3cd;
    color: #6b5200;
    font-size: 0.85rem;
}

.activity-chat-empty {
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--activity-chat-blue);
    border-radius: 1.25rem;
    background-color: #fff;
    color: var(--activity-chat-blue-dark);
    font-size: 0.875rem;
}

.activity-chat-row {
    display: flex;
    margin-bottom: 0.6rem;
}

.activity-chat-row.is-assistant {
    justify-content: flex-start;
}

.activity-chat-row.is-user {
    justify-content: flex-end;
}

.activity-chat-bubble {
    max-width: 82%;
    padding: 0.7rem 1rem;
    white-space: pre-line;
    word-break: break-word;
    font-size: 0.875rem;
}

.activity-chat-bubble.is-assistant {
    border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
    background-color: var(--activity-chat-blue);
    color: #fff;
}

.activity-chat-bubble.is-user {
    border: 1px solid var(--activity-chat-blue);
    border-radius: 1.25rem;
    background-color: #fff;
    color: var(--activity-chat-blue);
}

.activity-chat-suggestion {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.activity-chat-suggestion-scope {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.activity-chat-suggestion-reason {
    display: block;
    margin-bottom: 0.6rem;
}

.activity-chat-apply {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background-color: #fff;
    color: var(--activity-chat-blue-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.activity-chat-apply:hover {
    background-color: #eef3f9;
}

.activity-chat-apply:focus {
    outline: 3px solid var(--activity-chat-focus);
    outline-offset: 1px;
}

.activity-chat-composer {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e6e8eb;
    background-color: #fff;
}

.activity-chat-pill {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.35rem 0.9rem;
    border: 1px solid #d7dbe0;
    border-radius: 1.5rem;
    background-color: #fff;
}

.activity-chat-pill:focus-within {
    border-color: var(--activity-chat-blue);
}

.activity-chat-pill-icon {
    flex: 0 0 auto;
    padding-bottom: 0.35rem;
    color: var(--activity-chat-muted);
    font-size: 1.2rem;
}

.activity-chat-field {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 6rem;
    padding: 0.35rem 0;
    border: 0;
    background: transparent;
    color: #2f3440;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: none;
}

.activity-chat-field:focus {
    outline: none;
}

.activity-chat-field.is-invalid {
    color: #b02a37;
}

.activity-chat-send {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background-color: var(--activity-chat-blue);
    color: #fff;
    font-size: 0.95rem;
}

.activity-chat-send:hover:not(:disabled) {
    background-color: var(--activity-chat-blue-dark);
}

.activity-chat-send:focus {
    outline: 3px solid var(--activity-chat-focus);
    outline-offset: 1px;
}

.activity-chat-send:disabled {
    background-color: #b9c3cf;
}

.activity-chat-error {
    margin-top: 0.4rem;
    color: #b02a37;
    font-size: 0.8rem;
}

@media (max-width: 767.98px) {
    .activity-chat-ready .activity-chat-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 0.75rem 0.75rem 0 0;
    }

    .activity-chat-ready .activity-chat-header {
        cursor: default;
        touch-action: auto;
    }

    .activity-chat-fab {
        right: 16px;
        bottom: 16px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
}

.activity-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
