/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.5);
}

/* D3 SVG Canvas Styles */
#erd-svg {
    /* Dot grid background for canvas */
    background-image: radial-gradient(rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}
.dark #erd-svg {
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
}

/* Base D3 Elements */
.relation-line {
    fill: none;
    stroke: #94A3B8;
    stroke-width: 1.5px;
    transition: stroke-width 0.2s, stroke 0.2s;
    pointer-events: all;
    cursor: pointer;
}
.dark .relation-line {
    stroke: #475569;
}

.relation-line:hover, .relation-line.highlighted {
    stroke: #5A67D8;
    stroke-width: 2.5px;
}

/* Markdown node definitions using foreignObject */
.model-node {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    font-size: 12px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dark .model-node {
    background: #1E293B;
    border-color: #334155;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.model-node:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #5A67D8;
}

.dark .model-node:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    border-color: #5A67D8;
}

.model-node.selected {
    border-color: #5A67D8;
    border-width: 2px;
}

.model-header {
    background: #F8FAFC;
    padding: 8px 12px;
    border-bottom: 1px solid #E2E8F0;
    font-weight: 600;
    color: #0F172A;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .model-header {
    background: #0F172A;
    border-bottom-color: #334155;
    color: #F8FAFC;
}

.model-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-enum {
    background: #FEF3C7;
    color: #D97706;
}
.dark .badge-enum {
    background: rgba(245, 158, 11, 0.2);
    color: #FCD34D;
}

.badge-model {
    background: #E0E7FF;
    color: #4338CA;
}
.dark .badge-model {
    background: rgba(99, 102, 241, 0.2);
    color: #A5B4FC;
}

.model-fields {
    padding: 8px 0;
}

.model-field {
    display: flex;
    padding: 4px 12px;
    justify-content: space-between;
    align-items: center;
}

.model-field:hover {
    background: #F1F5F9;
}
.dark .model-field:hover {
    background: #334155;
}

.field-name {
    font-weight: 500;
    color: #334155;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    flex: 1;
}
.dark .field-name { color: #CBD5E1; }

.field-type {
    color: #64748B;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    margin-left: 8px;
}
.dark .field-type { color: #94A3B8; }

.field-type.relation {
    color: #5A67D8;
    cursor: pointer;
}
.dark .field-type.relation {
    color: #818CF8;
}

.field-attributes {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

/* Badges for attributes */
.attr-key { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.dark .attr-key { background: rgba(220, 38, 38, 0.2); color: #FCA5A5; border-color: rgba(220, 38, 38, 0.3); }

.attr-unique { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: #F0FDF4; color: #16A34A; border: 1px solid #BBF7D0; }
.dark .attr-unique { background: rgba(22, 163, 74, 0.2); color: #86EFAC; border-color: rgba(22, 163, 74, 0.3); }

.attr-default { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }
.dark .attr-default { background: rgba(75, 85, 99, 0.3); color: #D1D5DB; border-color: rgba(75, 85, 99, 0.4); }

/* SVG Relation Labels */
.relation-label {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    fill: #64748B;
    background: white;
    font-weight: 500;
}
.dark .relation-label {
    fill: #94A3B8;
}
