/* --- CANVAS CONSTRUCTOR --- */

.diagram-sidebar {
    width: 44px;
    background: #0A0A0B;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.diagram-sidebar:hover {
    width: 320px;
}

.sidebar-content {
    width: 320px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.diagram-sidebar:hover .sidebar-content {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.1s;
}

.sidebar-toggle-icon {
    position: absolute;
    top: 20px;
    left: 12px;
    width: 20px;
    height: 20px;
    color: var(--gray-500);
    transition: transform 0.3s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    pointer-events: none;
}

.diagram-sidebar:hover .sidebar-toggle-icon {
    opacity: 0;
}

.diagram-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden; /* For panning */
    background-color: #000000; /* Minimalist dark base */
    background-image: 
        linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
    background-size: 40px 40px;
}

.canvas-node {
    position: absolute;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.3s, border-color 0.3s, transform 0.2s;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    text-align: center;
    z-index: 2;
}

.canvas-node.rectangle {
    width: 240px;
    height: 90px;
}

.canvas-node:active {
    cursor: grabbing;
}

.canvas-node:hover {
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15); /* Discrete sci-fi glow */
    border-color: rgba(56, 189, 248, 0.4);
}

.canvas-node.selected {
    border: 1px solid #38bdf8;
    box-shadow: 0 0 0 1px rgba(56,189,248,0.5), 0 0 20px rgba(56,189,248,0.25), 0 15px 30px rgba(0,0,0,0.8);
    transform: scale(1.02);
    z-index: 100;
}

.edge-base {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3px;
}

.edge-led {
    fill: none;
    stroke-width: 3px;
    stroke-dasharray: 6 12;
    animation: flowLed 0.8s linear infinite;
}

@keyframes flowLed {
    from { stroke-dashoffset: 18; }
    to { stroke-dashoffset: 0; }
}

.flow-token {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 30;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: #121212;
    border: 1px solid #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}
.flow-token .ic { font-size: 14px; line-height: 1; }
.flow-token .lb { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* --- TEAM MANAGEMENT MODAL --- */
#team-management-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}

.tm-modal-content {
    background: white;
    width: 1000px;
    max-width: 95vw;
    height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tm-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.tm-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.tm-panel {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.tm-panel.left {
    border-right: 1px solid var(--gray-200);
}

.tm-person-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
}

.tm-team-item {
    padding: 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
}

.tm-team-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tm-team-member {
    background: var(--gray-100);
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--gray-200);
}

.tm-team-member button {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.tm-team-member button:hover {
    color: #ef4444;
}

/* Document Link Styles */
.doc-link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
}
.doc-link-item a {
    color: var(--primary-600);
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-link-item a:hover {
    text-decoration: underline;
}

/* Assigned Teams Styles */
.assigned-badge {
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* --- DARK MODE OVERRIDES FOR PANELS --- */

/* Sidebar Content */
.sidebar-header h3 { color: #f8fafc !important; }
.sidebar-header p { color: #a1a1aa !important; }
.builder-controls h4 { color: #f8fafc !important; }
.builder-controls span { color: #38bdf8 !important; }
.builder-controls label { color: #a1a1aa !important; }
.builder-controls .form-input {
    background: #18181B !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}

/* Notes Panel (Right) */
#notes-panel {
    background: #0A0A0B !important;
    border-left: 1px solid rgba(255, 255, 255, 0.15) !important;
}
#notes-panel h3, #notes-panel h4 { color: #f8fafc !important; }
#notes-panel label { color: #a1a1aa !important; }
#notes-panel span { color: #38bdf8 !important; }
#notes-text-view { color: #a1a1aa !important; }
#notes-textarea {
    background: #18181B !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}
#notes-panel .form-input {
    background: #18181B !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
}
#btn-edit-notes { color: #a1a1aa !important; }
#btn-edit-notes:hover { color: #f8fafc !important; }

/* Assistant Widget */
.expand-widget {
    background: #0A0A0B !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
.widget-header {
    background: #121212 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}
.widget-body {
    background: #0A0A0B !important;
}
.chat-message.bot .msg-bubble {
    background: #18181B !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
.chat-input-area {
    background: #121212 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
}
.chat-input-area input {
    background: #18181B !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

