:root {
    --bs-primary: #2c3e6b;
    --bs-primary-rgb: 44, 62, 107;
    --accent-teal: #20c997;
    --accent-coral: #ff6b6b;
}

.bg-primary, .btn-primary {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}
.btn-primary:hover {
    background-color: #1e2d50 !important;
    border-color: #1e2d50 !important;
}
.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.text-primary { color: var(--bs-primary) !important; }

.navbar { background-color: var(--bs-primary) !important; }

.card { border-radius: 0.75rem; }
.card-header { border-radius: 0.75rem 0.75rem 0 0 !important; }

.chat-bubble {
    max-width: 80%;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
}
.chat-bubble.user {
    background-color: var(--bs-primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}
.chat-bubble.assistant {
    background-color: var(--bs-tertiary-bg);
    border-bottom-left-radius: 0.25rem;
}

[data-bs-theme="dark"] .chat-bubble.user {
    background-color: #4a5fa0;
}

.page-image { cursor: crosshair; display: block; width: 100%; height: auto; }
.page-image-container { position: relative; display: block; width: 600px; max-width: 100%; }
.annotation-rect {
    position: absolute;
    border: 2px solid var(--accent-coral);
    background: rgba(255, 107, 107, 0.15);
    pointer-events: auto;
    cursor: pointer;
}
.annotation-label {
    position: absolute;
    top: -1.4em;
    left: 0;
    background: var(--accent-coral);
    color: white;
    font-size: 0.7rem;
    padding: 0 0.3em;
    border-radius: 0.2rem;
    white-space: nowrap;
    pointer-events: none;
}
.annotation-edit-btn {
    position: absolute;
    top: -1.4em;
    right: 1.2em;
    background: var(--accent-coral);
    color: white;
    border: none;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0 0.3em;
    border-radius: 0.2rem;
    cursor: pointer;
    pointer-events: auto;
}
.annotation-edit-btn:hover {
    background: #e04545;
}
.annotation-delete-btn {
    position: absolute;
    top: -1.4em;
    right: 0;
    background: var(--accent-coral);
    color: white;
    border: none;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0 0.3em;
    border-radius: 0.2rem;
    cursor: pointer;
    pointer-events: auto;
}
.annotation-delete-btn:hover {
    background: #e04545;
}
.ak-annotation-rect {
    border-color: var(--accent-teal);
    background: rgba(32, 201, 151, 0.15);
}
.ak-annotation-rect .annotation-label {
    background: var(--accent-teal);
}
.ak-annotation-rect .annotation-edit-btn {
    background: var(--accent-teal);
}
.ak-annotation-rect .annotation-edit-btn:hover {
    background: #1aab80;
}
.ak-annotation-rect .annotation-delete-btn {
    background: var(--accent-teal);
}
.ak-annotation-rect .annotation-delete-btn:hover {
    background: #1aab80;
}
.ak-page-image { cursor: crosshair; display: block; width: 100%; height: auto; }

/* ── Resize handles for annotation boxes ── */
.annotation-rect .resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-coral);
    border: 1px solid #fff;
    border-radius: 2px;
    z-index: 10;
    pointer-events: auto;
}
.ak-annotation-rect .resize-handle {
    background: var(--accent-teal);
}
.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.resize-handle.n  { top: -5px; left: calc(50% - 5px); cursor: n-resize; }
.resize-handle.s  { bottom: -5px; left: calc(50% - 5px); cursor: s-resize; }
.resize-handle.w  { top: calc(50% - 5px); left: -5px; cursor: w-resize; }
.resize-handle.e  { top: calc(50% - 5px); right: -5px; cursor: e-resize; }
.annotation-rect.dragging { cursor: grabbing; }
.annotation-rect:not(.dragging) { cursor: grab; }
