/* ═══════════════════════════════════════════════════════ */
/*  CASEBOARD V5 - FULL REDESIGN
/* ═══════════════════════════════════════════════════════ */

/* --- Action Buttons --- */
button.cb-active {
    background-color: #2563eb !important; /* blue-600 */
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

/* --- Canvas & Workspace --- */
.cb-workspace {
    background: #0d1117;
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
    background-size: 40px 40px;
    cursor: grab;
}
.cb-workspace:active { cursor: grabbing; }

.cb-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 5000px;
    height: 5000px;
    transform-origin: 0 0;
    will-change: transform;
    transition: transform 0.05s linear;
}

.cb-sidebar-toggle {
    min-width: 1.75rem;
}

.cb-sidebar-toggle-collapsed {
    right: -0.85rem;
    width: 2.5rem !important;
    height: 5.5rem !important;
    background: rgba(22, 27, 34, 0.96);
    color: #cbd5e1;
    border-color: rgba(71, 85, 105, 0.9);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.cb-sidebar-toggle-collapsed:hover {
    color: #ffffff;
    border-color: rgba(96, 165, 250, 0.8);
}

/* Mini Map */
#cb-minimap-viewport {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.5);
    pointer-events: none;
}

/* Top Hint */
#cb-top-hint.visible {
    opacity: 1;
}

/* --- Sidebar Items --- */
.cb2-type-row {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb2-line-style-btn {
    background: transparent;
    border: none;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cb2-line-style-btn:hover {
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.03);
}
.cb2-line-style-btn.active {
    background: #1f2937;
    color: #60a5fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Pin Cards --- */
.cb-pin {
    position: absolute;
    width: 260px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}
.cb-pin:active {
    cursor: grabbing;
    transform: scale(1.02);
    z-index: 100;
}
.cb-pin.dragging {
    transition: none;
    opacity: 0.9;
}
.cb-pin:hover {
    border-color: #444c56;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6);
}
.cb-pin.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3), 0 15px 45px rgba(0, 0, 0, 0.6);
}

.cb-pin-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #30363d;
}
.cb-pin-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}
.cb-pin-title {
    font-size: 15px;
    font-weight: 800;
    color: #f0f6fc;
}
.cb-pin-type-name {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.5);
}

/* --- Pin Body --- */
.cb-pin-body {
    padding: 10px 14px;
    flex: 1;
}
.cb-pin-image {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.cb-pin-details-text {
    font-size: 0.78rem;
    line-height: 1.6;
    color: #94a3b8;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: pre-wrap;
}
.cb-pin-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}
.cb-pin-meta .meta-row {
    display: flex;
    font-size: 0.72rem;
    align-items: flex-start;
    gap: 6px;
}
.cb-pin-meta .meta-row .label {
    color: rgba(255, 255, 255, 0.35);
    width: 68px;
    flex-shrink: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cb-pin-meta .meta-row .val {
    color: #e2e8f0;
    font-weight: 600;
    flex: 1;
    word-break: break-word;
}

/* --- Pin Footer --- */
.cb-pin-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 14px;
}
.cb-pin-footer .fp-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.cb-pin-priority-badge {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 8px;
    border-radius: 8px;
    margin-left: auto;
}

/* --- Connection Labels --- */
.cb-line-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    pointer-events: auto;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    transition: all 0.15s ease;
    z-index: 1001;
}
.cb-line-label:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
    transform: translate(-50%, -50%) scale(1.05);
}

/* --- Modals & Overlays --- */
.cb2-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.cb2-modal-overlay.active {
    display: flex;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Input & Dropdown Styling --- */
.cb2-input,
.cb2-dropdown-btn {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.8);
    border-radius: 12px;
    padding: 12px 14px;
    color: #f8fafc;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    font-family: inherit;
}
.cb2-input:focus,
.cb2-dropdown-btn:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: rgba(15, 23, 42, 0.95);
}
.cb2-input::placeholder,
.cb2-dropdown-btn::placeholder {
    color: #4b5563;
}
select.cb2-input option {
    background: #111827;
    color: #f8fafc;
}
.cb2-dropdown-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cb2-dropdown-btn:hover {
    border-color: rgba(96, 165, 250, 0.7);
    background: rgba(15, 23, 42, 0.9);
}

/* --- Dropdown Menus --- */
.cb2-dropdown {
    display: none;
}
.cb2-dropdown.active {
    display: block;
    animation: cbDropPop 0.15s ease;
}
@keyframes cbDropPop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.cb2-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.12s ease;
}
.cb2-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

/* --- Context Menus --- */
.cb2-ctx-menu {
    position: fixed;
    z-index: 10000;
    min-width: 200px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
    display: none;
    backdrop-filter: blur(12px);
}
.cb2-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.12s ease;
}
.cb2-ctx-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.cb2-ctx-danger {
    color: #f87171 !important;
}
.cb2-ctx-danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}
.cb2-ctx-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}

/* --- Vehicle Autocomplete --- */
.cb-autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(51, 65, 85, 0.8);
    border-radius: 14px;
    z-index: 10001;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    display: none;
    padding: 8px;
    scrollbar-width: thin;
}
.cb-autocomplete-suggestions.active {
    display: block;
}
.cb-suggestion-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.cb-suggestion-item:hover,
.cb-suggestion-item.selected {
    background: rgba(59, 130, 246, 0.15);
}
.cb-suggestion-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f1f5f9;
}
.cb-suggestion-model {
    font-size: 0.72rem;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
}
mark.cb-highlight {
    background: rgba(234, 179, 8, 0.2);
    color: #fcd34d;
    border-radius: 3px;
    padding: 0 2px;
}

.cb-autocomplete-container {
    position: relative;
}

.cb-autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(51, 65, 85, 0.8);
    border-radius: 14px;
    z-index: 10001;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    display: none;
    padding: 8px;
    scrollbar-width: thin;
}

.cb-autocomplete-suggestions.active {
    display: block;
}

.cb-suggestion-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.12s ease;
}

.cb-suggestion-item:hover,
.cb-suggestion-item.selected {
    background: rgba(59, 130, 246, 0.15);
}

.cb-suggestion-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f1f5f9;
}

.cb-suggestion-model {
    font-size: 0.72rem;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
}
